← Back to team overview

dhis2-devs team mailing list archive

Re: translations using d2

 

Hey Aamer,

You are correct, that is the plan and it is currently still just a plan ;)
I have started some exploratory work on it, but it is not implemented yet.
We have been too occupied with the features for 2.25.

There is a document on the translation workflow[1] that has more
information. The gist of it is that we'll probably use i18next[2] to
implement the getText translations.

We do plan to support a migration from the properties files to the getText
style (and perhaps being able to use both solutions at the same time for a
while). If you're just using the properties files for local app
translations however you could start to use the english text as keys in the
.properties files, as in that case your source code could stay the same.
(We don't properly support the .properties specification[3], so keys with
spaces and colons should work as it splits only on `=`, since we're
replacing the translation solution it won't be fixed to strictly adhere to
the .properties spec so it's safe to use it that way)

[1]
https://docs.google.com/document/d/1u0YhRZD2Q3F8p6VCsz7dXdZxJL45R0qsEfsNc0OCJYs/edit?usp=sharing
[2] http://i18next.com/
[3]
http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader)

On Fri, Sep 9, 2016 at 3:38 PM, Aamer Mohammed <aamerm@xxxxxxxxxxxxxxxx>
wrote:

> Hi Mark,
>
> We have been using d2 library in couple of our custom apps and we want to
> implement translations using the same. Currently the translations as they
> work in other dhis apps is by parsing the client side.properties file and
> getting the translation using
> d2.i18n.getTranslation('this_is_my_title') .....the keys are present in
> i18n files for different locales and the sources for i18n files are added
> to d2.config.i18n.sources
>
> We remember you were specifying in one of the previous mails on
> simplifying the workflow for translations i.e...moving from 'key' based
> system to getText style of workflow...something like d2.i18n.getTranslation('This
> is my title') which renders the english text if no translation is
> available.
> We wanted to check if it is implemented and can be used by our custom apps
> as well. If so could you point us to getting started on the same.
>
>
> Thanks
> Aamer.
>
>


-- 
Regards,


Mark Polak
Software developer, DHIS 2
University of Oslo
http://www.dhis2.org <https://www.dhis2.org/>
mark@xxxxxxxxx

References