On 2016-06-10 4:51 AM, zbranie...@mozilla.com wrote:
While working on the new localization API (See Intent to Implement post from
yesterday), we're developing bindings into UI languages used by Firefox and we
have some decisions to make that could be better answered by this group.
The general API is declarative and DOM-based. Instead of forcing developers to
programmatically create string bundles, request raw strings from them and
manually interpolate variables, L20n uses a Mutation Observer which is notified
about changes to data-l10n-* attributes. The complexity of the language
negotiation, resource loading, error fallback and string interpolation is
hidden in the mutation handler. Most of our questions in this email relate to
what the best way to declare resources is.
The one thing I would recommend you do (and I mentioned this many years
ago when this was first proposed) is to not use the jargon terms 'l10n'
or 'l20n' anywhere. They are hard to type and hard to read. Three of the
four characters in 'l10n' are indistinguishable from similar characters
in some fonts which can lead to hard to detect bugs.
You should instead spell out words such as 'locale' making it clearer to
a casual reader the meaning.
<window>
<localization name="browser">
<source src="./locales/resource1.ftl" />
<source src="./locales/resource2.ftl" />
</localization>
<label data-l10n-bundle="browser" data-l10n-id="foo></label>
</window>
The open questions are:
* Can we use custom elements like <localization> in XUL?
Yes. Is there a need for two different elements? The HTML case doesn't
have this. You could also just use the existing stringbundle element and
make it handle a different file syntax, perhaps.
* Is it okay to use the "name" attribute in XUL for the <localization> object?
Yes
* Is it okay to use data-l10n-* attributes for localizable elements? Or
perhaps l10n-* would be sufficient?
You should just use bundle="browser". I'm not sure what the data
attribute is meant to represent here, but the attribute name should be
simpler as mentioned above (XUL attributes don't have hyphens in them
either)
It's hard to give concrete suggestions when only some examples are
given. It would help if you posted a more descriptive proposal of what
all these elements/attributes do for each language. Maybe this is
already available?
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform