nickdesaulniers / fxos-irc

IRC client for FxOS (and now desktop FF)
GNU General Public License v3.0
37 stars 13 forks source link

Add l10n support #29

Closed fabricedesre closed 10 years ago

fabricedesre commented 10 years ago

Correct me if I'm wrong, but I see no l10n infrastructure in this code.

nickdesaulniers commented 10 years ago

Excellent point! @fabricedesre , would you recommend webl10n?

fabricedesre commented 10 years ago

For now yes. There's an ongoing effort to move gaia to l20n but it's not ready yet and will be quite similar in terms of APIs.

nickdesaulniers commented 10 years ago

I think @basta had mentioned that webl10n did not have support for attributes, IIRC. So things like placeholders wouldn't get localized. But, I really don't remember.

fabricedesre commented 10 years ago

I would be surprised. You can check with @fabi1cazenave to be sure.

fabi1cazenave commented 10 years ago

webL10n supports attributes, and it’s rather simple:

<input type="text" data-l10n-id="userName" />

and in your *.en-US.properties file, just add:

userName.placeholder = User name…
nickdesaulniers commented 10 years ago

Oh perfect, thanks @fabi1cazenave !

nickdesaulniers commented 10 years ago

Need to add placeholders

nickdesaulniers commented 10 years ago

@fabi1cazenave , I'm seeing a CSP warning in the app validator. Does webl10n violate CSP for privileged apps?

screen shot 2013-10-08 at 11 47 41 am

nickdesaulniers commented 10 years ago

@fabi1cazenave , should I be using webL10n from gaia instead?

fabi1cazenave commented 10 years ago

@nickdesaulniers the main difference between Gaia’s l10n.js library and the one in webL10n is that the latter is cross-browser — hence a slightly different API and a few fallbacks for IE<9. In other words:

Hope this helps!

nickdesaulniers commented 10 years ago

@fabi1cazenave , great info, I added it to webl10n's wiki.

fabi1cazenave commented 10 years ago

Great, thanks!