-
Notifications
You must be signed in to change notification settings - Fork 68
Translating to Other Languages
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
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, parameteractivity_welcome
, and all strings declared with a parametertranslatable="false"
-
activity_resources
array and parameteractivity_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-specificstrings.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-specificstrings.xml
- Not translatable array
- 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.
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 directoryapp/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 parameteractivity_welcome
in thestrings.xml
file in your locale shall be than updated. Put in this array the links to XML-files fromapp/src/main/assets/doc_<lacale>
and to the newly created PDF file.