Skip to content

Translating to Other Languages

Mikhail Kulesh edited this page Jan 17, 2018 · 1 revision

microMathematics has three types of language-depended resources that shall be translated:

  • GUI elements placed in the file app/src/main/res/values/strings.xml

  • Build-in documentation in the XML-format. This documentation consist of separate chapters, each chapter is placed in one XML-file having special MMT-shema. Such a file can be directly opened, edited and saved in the microMathematics app. All these files are placed in the app/src/main/assets/doc_en directory

  • Online documentation in PDF format. This documentation is placed in the directory microMathematics/doc. It is build manually, tagged with the corresponding release and can be downloaded by the user from microMathematics app

Therefore, there are two strategies to translate the app: partial translation and full translation

Partial translation

The simplest way is only translate GUI elements in the file app/src/main/res/values/strings.xml:

  • Translate all strings from this file except activity_resources array, parameter activity_welcome, and all strings declared with a parameter translatable="false"
  • activity_resources array and parameter activity_welcome still be unchanged. This means that the build-in documentation, “Welcome” page and PDF documentation still be in English.
  • Register your translation in the app:
    • Not translatable array <string-array name="pref_language_codes"> contains language codes (with region suffix) for all languages that are already presented in the microMathematics. Add you language/region to this array in the basic locale (app/src/main/res/values/strings.xml), do not copy this array into your locale-specific strings.xml.
    • Add the name (in your language and layout) of your language in the array pref_language_names. This array is also not translatable, do not copy this array into your locale-specific strings.xml
  • Compile and run the app, change the language in the "App settings" dialog from the main menu and ensure that the menu, navigation drawer, button hints in the mathematical palette and all dialogs are translated correctly.
  • After this step, you are welcome to submit a pull-request. Please do not submit any not yet finished translation since I observe code quality with LINT, and a not finished translation generates unnecessary warnings.

Full translation

This translation takes a lot of time and shall be performed carefully since it includes the translation of mathematical documentation. After the partial translation is finished, you need additional steps:

  • All XML-files placed in the app/src/main/assets/doc_en directory shall be translated first and placed into the new directory app/src/main/assets/doc_<lacale>. These files are worksheet files in the microMathematics format. To translate these files, ether use an XML-editor or edit these files directly in the app using any tablet with hardware keyboard.

  • If you activate the "Developer options" in the main menu, you can export all these chapters including all images in the LaTeX format (see this page for more details). The exported files for all languages shall be than downloaded from the device into the microMathematics/doc directory.

  • After it, build the PDF documentation in your language. To build the documentation, see README.md in microMathematics/doc directory.

  • You can temporary commit newly created PDF file into the microMathematics/doc directory.

  • The array activity_resources and the parameter activity_welcome in the strings.xml file in your locale shall be than updated. Put in this array the links to XML-files from app/src/main/assets/doc_<lacale> and to the newly created PDF file.

Clone this wiki locally