oVirt / ovirt-web-ui

Modern lightweight UI for standard (non-admin) oVirt users
https://www.ovirt.org
Apache License 2.0
116 stars 72 forks source link

I18n and Localization #33

Closed mareklibra closed 7 years ago

mareklibra commented 8 years ago

How will be the application translated? Consider REST API error messages.

jelkosz commented 7 years ago

The API message translations require:

mareklibra commented 7 years ago

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:

I slightly prefer the react-intl. Any real-project experience?

Please comment/suggest. @jelkosz , @vojtechszocs , @gregsheremeta , @jniederm , @matobet , @bond95

jelkosz commented 7 years ago

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.

mareklibra commented 7 years ago

@jelkosz , I think this would not be an issue: __("Some formatted {value} in MB").format(someValue)

jelkosz commented 7 years ago

Ah, right, the messages themselves would contain the {value} string. But still, the react-intl looks nicer to me.

sjd78 commented 7 years ago

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.

[1] - https://github.com/oVirt/ovirt-engine-dashboard/blob/master/README.adoc#internationalization-and-localization

jniederm commented 7 years ago
jniederm commented 7 years ago

Done in #309, #310, #335 and related fixes.