Closed mareklibra closed 7 years ago
The API message translations require:
Let's contemplate options for i18n/l10n.
In general, Zanata seems to be a good choice for the actual translation, so let's consider all bellow in its context.
There are plenty of choices how to i18n a JS application. When considering the viable ones, let's focus on:
Nice to have:
So far, following approaches meet the criteria:
"Home-made" text extraction
gettext / Jed
react-intl
I slightly prefer the react-intl. Any real-project experience?
Please comment/suggest. @jelkosz , @vojtechszocs , @gregsheremeta , @jniederm , @matobet , @bond95
Even though the first option is tempting it would get a bit more complicated to implement things like: ___("Maximum allowed memory is {} MiB", someValue) which we will need. From quick look I liked the react-intl too.
@jelkosz , I think this would not be an issue: __("Some formatted {value} in MB").format(someValue)
Ah, right, the messages themselves would contain the {value} string. But still, the react-intl looks nicer to me.
ovirt-engine-dashboard is currently using a bit of react-intl on the message format and string storage side of things. We're not using it for date/time or number formatting. Standard ECMA-402 Intl is used in those cases. We're also not using react-intl straight in the jsx code - the messages are wrapped up in function accessors similar to the way GWT handles things. So maybe the dashboard isn't a good example for pure react-intl use in JSX.
However, I do have the react-intl messages well integrated to zanata. The process used is documented in [1]. Essentially there is a nice little package to transform from react-intl json to a gnutext pot file that gets pushed to Zanata. Once translated, the same package takes the .po files and creates the json. The README reasonably explains the whole workflow.
At least you can crack the Zanata nut by using the dashboard setup.
Done in #309, #310, #335 and related fixes.
How will be the application translated? Consider REST API error messages.