[openstack-dev] [tripleo][ui] another i18n proposal for heat templates 'description' help strings
Julie Pichon
jpichon at redhat.com
Mon Apr 10 15:13:45 UTC 2017
Hi Peng,
I added some thoughts in-line, let me know what you think.
On 10 April 2017 at 08:10, Peng Wu <peng.e.wu at gmail.com> wrote:
> Hi,
>
> In TripleO UI project users requested translation of the web UI. But
> some web UI strings are displayed from heat template files in tripleo-
> heat-templates project.
>
> In order to get translated templates displayed in tripleo-ui, we
> propose another solution as follows, which needs to change code in
> tripleo-heat-templates and tripleo-ui projects.
>
> I18n proposal for Heat templates 'description' help strings
>
> 1. Update tripleo-heat-templates to generate the javascript files to
> include all translation strings, like "tripleo-heat-templates.js"
>
> a. Need to write python script to extract "title" and
> "description" field from yaml files and generate "tripleo-heat-
> templates.js" for react-intl usage in tripleo-ui
I think extracting the strings directly into js/json format may be not
be a viable option, because it isn't a format supported by
Zanata [1].
For tripleo-ui itself we use react-intl which expects json, and work
with scripts to convert to/from pot and po (see [2]) which are fully
supported by Zanata.
Or is the idea that we'd also generate pot/po as intermediary steps and
only store json in the repo?
> b. Use default message as message id or consider nodejs-i18n for
> tripleo-ui
I'm wary of considering a library change considering the amount of
churn it would cause in the code base for all the existing strings,
plus that would then make backports more difficult. It really needs to
be considered carefully.
>
> 2. Update tripleo-ui to use "tripleo-heat-templates.js"
>
> a. Write some script to sync "tripleo-heat-templates.js" from
> tripleo-heat-templates
>
> b. Call formatMessage function for "title" and "description" field
> with message id (use default message) and default message or consider
> nodejs-i18n for tripleo-ui
>
> Refer URL for message id: https://github.com/yahoo/react-intl/issues/
> 912
Could you explain a bit more the issue with the ids? I see us defining
an id in every message [3] and this is how they are referenced in the
locale json [4] (the mapping is not done by message, but by ID).
When it comes to the THT message, I think they all have a hierarchy
that perhaps could be used as a key to map between the original string
and the translation? Something along the lines of
OS::TripleO::Services::Apache::ApacheMaxRequestWorkers::description,
whichever form the API gives us at the moment.
> Please evaluate it, thanks!
Thank you!
Julie
[1] http://docs.zanata.org/en/release/user-guide/projects/project-types/#supported-types
[2] https://github.com/openstack/tripleo-ui/blob/master/docs/translation.rst#extracting-messages-from-components
[3] https://github.com/openstack/tripleo-ui/blob/master/src/js/components/nodes/Nodes.js#L17
[4] https://github.com/openstack/tripleo-ui/blob/master/i18n/locales/es.json#L3
More information about the OpenStack-dev
mailing list