Instructions (how-to, faq)

Translations of Neutron's UI into different languages other than those coming in standard package.
Post Reply
dmitrykos
Site Admin
Posts: 1978
Joined: Mon Apr 25, 2011 6:15 pm

Instructions (how-to, faq)

Post by dmitrykos » Thu Mar 08, 2012 9:55 am

Currently Neutron supports user-side translation which every user is able to activate.

HOW-TO:
  • 1) Extract 2 files strings.xml and strings_en_US.xml files from APK (/assets) to the folder where neutronmp.db is located: (/sdcard/NeutronMP, or /sdcard/Android/data/com.neutroncode.mp);
    2) Translate strings_en_US.xml to the desired language;
    3) Rename translated strings_en_US.xml by correcting the locale code 'en_US' to the locale you translated, for example 'ru_RU', so it would become: strings_ru_RU.xml;
    4) Edit strings.xml, delete all entries except one to modify and point it to the file with translation, like this:

    Code: Select all

    <?xml version="1.0" encoding="utf-8" ?>
    <locale>
        <file locale="ru_RU" name="strings_ru_RU.xml" version="1" default="0">Русский</file>
    </locale>
    
    5) Kill Neutron's process and re-start it;
    6) Additional translation option shall appear in: Neutron's UI -> Settings -> Interface Language.
FAQ:
  • Q: I have XML file with translation, how to to provide it on this forum?
    A: Simply create own thread and mention for which language this translation is.

    Q: There is translation existing but I think mine is better! Shall I make another thread?
    A: No, please post in the thread which already manages translation for this language. Your link will be moved to the heading 1-st post, so everybody will notice it.

    Q: Why Neutron does not have these additional translations in standard?
    A: Because Neutron's UI is under constant development and synchronizing many translations is problematic at the moment.

    Q: The translation I am using is in yellow color in the Interface Language list, why is that?
    A: Due to interface updates new strings may appear in strings_en_US.xml. Neutron has internal version for strings which can be seen in /NeutronMP.apk/assets/strings.xml file in 'version' field.

    Q: Is there any PC application which may help in finding differences between old strings_en_US.xml and new?
    A: There is excellent developer tool which allows to see differences of 2 text files - WinMerge: http://winmerge.org

acr
Posts: 17
Joined: Tue Apr 24, 2012 12:34 pm

Re: Instructions (how-to, faq)

Post by acr » Wed Aug 08, 2012 6:47 am

Hiho,

If you prefer to work with Linux:
An example of the processing of the German language file. Of course, also valid for all other languages

- Copy the two files "strings_en_US.xml" and "strings_de_DE.xml" in a separate folder (it's safer)
- Generate a list of all variables (Shell commands)
cat strings_en_US.xml |cut -d '>' -f 1 > en.txt
cat strings_de_DE.xml |cut -d '>' -f 1 > de.txt
- Compare contents (Shell commands)
diff -y en.txt de.txt

The small arrows between the columns show the changes.
Searching in the English file for the changed variable, translate the text and paste it into the new language file.
After editing the language file must be copied to your device.

Have fun translating :-)

eevan
Posts: 4
Joined: Mon Jul 13, 2020 7:38 pm

Re: Instructions (how-to, faq)

Post by eevan » Mon Sep 25, 2023 11:37 am

There is an excellent perl tool po4a that I use to maintain translation.
It creates a gettext .po file that is used for translation and automatically genererates the translated output xml file. During a translation update step, it also automatically finds changes in existing source strings and any eventual new ones.

Post Reply

Who is online

Users browsing this forum: No registered users and 52 guests