[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Taler] i18n
From: |
Florian Dold |
Subject: |
Re: [Taler] i18n |
Date: |
Wed, 10 Feb 2016 00:00:19 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
Just for the record, Chrome extensions have their own system for i18n
[1], which will probably not be supported by WebExtensions.
It's also resource-based (as opposed to gettext-style), which some
developers might find less easy to use, and they have their own
non-standard format for messages [2].
- Florian
[1] https://developer.chrome.com/extensions/i18n
[2] https://developer.chrome.com/extensions/i18n-messages
On 01/26/2016 04:26 PM, Florian Dold wrote:
> Hi!
>
> Gabor pointed me to some resources for JavaScript internationalization
> (i18n), I'll summarize how the situation looks to me here.
>
> In general, there are two distinct flavors of i18 approaches:
>
> 1. resource-based: Most of today's larger (web) applications seem to
> use this. The programmer never writes string constants directly, but
> always refers to a resource, like:
>
> showDialog(getTranslation(MessageResources.Welcome, args))
>
> This is more tedious for the programmer, but allows to use the
> MessageFormat [1] translation standard, which allows all kinds of fancy
> things (complex queries, support for gender, ...).
>
> Enterprise-y frameworks like AngularJS follow this style as well [2].
>
>
> 2. gettext-style: Programmers just write all strings that should be
> translated in their favorite language and mark then, usually via this
> underscore macro. Some helper program then extracts the translatable
> string.
>
> JavaScript has enough libraries to *read* .po/.mo files, but barely any
> support for extracting these strings from source.
>
> However, it would be trivial(ish) to just use an off-the-shelf JS parser
> (esprima [3] is very good for that) to extract marked strings,
> preferably tagged template literals like:
>
> i18n`This is a translated message. Hello ${user}.`
>
> Alternatively, we'd just have to hack together our own message catalogue
> for gettext by grepping the source code in the beginning.
>
>
> Does anybody have more experience with i18n in JavaScript projects?
>
> Do we want to do gettext or resource-based translations?
>
> Personally as a developer I'd prefer gettext-style, but in the end I
> wouldn't mind either too much.
>
> - Florian
>
>
> [1] http://userguide.icu-project.org/formatparse/messages
> [2] https://docs.angularjs.org/guide/i18n
> [3] http://esprima.org/
> [4] https://github.com/gmarty/xgettext
>
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Taler] i18n,
Florian Dold <=