[openstack-dev] [tripleo][ui] another i18n proposal for heat templates 'description' help strings
Peng Wu
peng.e.wu at gmail.com
Mon May 8 08:20:01 UTC 2017
Hi Julie,
I generated one example javascript file containing the translatable
strings.
URL: https://pwu.fedorapeople.org/openstack-i18n/tripleo/tripleo-heat
-templates.js
And the code to generate the above file is in:
https://pwu.fedorapeople.org/openstack-i18n/tripleo/
The generated file need to be copied to tripleo-ui project, and
translate as other javascript files.
Please review it, thanks!
Regards,
Peng
On Mon, 2017-04-10 at 16:13 +0100, Julie Pichon wrote:
> 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/iss
> > ues/
> > 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-typ
> es/#supported-types
> [2] https://github.com/openstack/tripleo-ui/blob/master/docs/translat
> ion.rst#extracting-messages-from-components
> [3] https://github.com/openstack/tripleo-ui/blob/master/src/js/compon
> ents/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