Add new language in Oxygen framework for localization

Post here questions and problems related to oXygen frameworks/document types.
Isabelle
Posts: 29

Add new language in Oxygen framework for localization

Fri Jan 12, 2018 2:16 pm

Hello,

We use oxygen-18.1.0.0.jar, and we need to add the Portuguese, Spanish and Chinese language to our "translation.xml" file.

I have read this page http://www.oxygenxml.com/doc/versions/1 ... works.html and I have updated the "translation.xml" file this way :

Code: Select all

    <languageList>
        <language description="English" lang="en_US"/>
        <language description="French" lang="fr_FR"/>
        <language description="Portuguese" lang="pt_BR"/>
        <language description="Spanish" lang="es_AR"/>
        <language description="Chinese" lang="zh_CN"/>
    </languageList>
    <key value="font_style">
        <val lang="en_US">Font style</val>
        <val lang="fr_FR">Style</val>
        <val lang="pt_BR">Test Portuguese</val>
        <val lang="es_AR">Test Spanish</val>
        <val lang="zh_CN">Test Chinese</val>
    </key>


However, when I select one of this 3 new languages, I only get english value.

So I have tested the value of

Code: Select all

ro.sync.exml.workspace.api.PluginWorkspaceProvider.getPluginWorkspace().getUserInterfaceLanguage()
.
The value is correct for English and French but stay in English for Portuguese, Spanish and Chinese.

Can you explain me how to add this 3 new languages, please ?
Thanks.

Regards,
Isabelle
Radu
Posts: 5459

Re: Add new language in Oxygen framework for localization

Fri Jan 12, 2018 4:33 pm

Hi Isabelle,

What "translation.xml" are you referring to? The one in your custom framework folder?

About this remark:

The value is correct for English and French but stay in English for Portuguese, Spanish and Chinese.


Did you set the default locale to the corresponding language in your Java code before initializing the AuthorComponentFactory?
It will not be enough I'm afraid.
If you open the "oxygen-18.1.0.0.jar" in a zip utility, it will contain a "languageList.properties" file. Those are the only language our code knows of. So you would also need to update that properties file with more languages.
In the same JAR there are also files like "Messages_en_US.properties" containing translations for all the Oxygen common keys in that specific language.
You will probably need to create such files also for your languages. There are a lot of keys so probably for starters you will just copy the content of the English translation properties file.
These keys are used for error messages and various common action names which are not contributed by the framework.
But once the ""languageList.properties"" has been modified to contain the additional languages, and the default locale has been set to one of those languages, Oxygen should also pick up from the framework "translation.xml" the translations for those specific languages for the framework keys.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Isabelle
Posts: 29

Re: Add new language in Oxygen framework for localization

Fri Jan 12, 2018 5:47 pm

Radu,

Yes, I was referring to the "translation.xml" file in my custom framework folder.

And yes I set the default locale to the corresponding language in my Java code before initializing the AuthorComponentFactory.

I have tested to add the 3 languages in the file "languageList.properties" and it works fine now.
It was the information I missed.

Thanks for your help.

Regards,
Isabelle
Radu
Posts: 5459

Re: Add new language in Oxygen framework for localization

Mon Jan 15, 2018 10:05 am

Hi Isabelle,

No problem, sorry for the cumbersome way in which you need to be doing this right now. In a future version we'll try to have some proper API to add new languages to Oxygen.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 2 guests