translate_mail2voice
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | translate_mail2voice [2023/04/25 16:52] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How to translate Mail2Voice? ====== | ||
+ | |||
+ | ===== Generalities ===== | ||
+ | |||
+ | Mail2Voice native language is english, thus if no locale file exists, it will display in english. | ||
+ | |||
+ | The translation is made with locale files (using XML code). All locales files are in the locales folder and are named with the .lng extension. The reference file is english.lng so each locale file must translate every words/ | ||
+ | |||
+ | You must not modify the reference file (english.lng) directly (but it's OK for the others). If you want to modify the english translations, | ||
+ | |||
+ | In a .lng file, there are two types of translations: | ||
+ | |||
+ | The translatable strings are the ones in the " | ||
+ | |||
+ | //Note: the translations are sorted alphabetically in each section.// | ||
+ | |||
+ | ===== Write translatable strings in the code ===== | ||
+ | |||
+ | The reference locale file (english.lng) must be generated when the source code of Mail2Voice is modified. This file is generated from the translatable strings found in the source code. We are taking into account two types of translatable strings: the widgets texts and the voice sentences. | ||
+ | |||
+ | ==== Widgets ==== | ||
+ | |||
+ | For Widgets, Mail2Voice is capable of translating the Text and TextHeader properties of any widget. So, when translating, | ||
+ | |||
+ | There are two rules: | ||
+ | - Every translatable widget must be created in *.Designer.cs files. | ||
+ | - in your code, you must use the widget name as the widget variable identifier, like this: | ||
+ | |||
+ | this.mailtoContactButton.Name = " | ||
+ | | ||
+ | Then you can add a Text or a TextHeader property to your widget: | ||
+ | |||
+ | this.mailtoContactButton.Text = " | ||
+ | |||
+ | | ||
+ | When the reference locale file is generated, you will see a line like this in the english.lng file: | ||
+ | | ||
+ | <setting name=" | ||
+ | |||
+ | | ||
+ | ==== Vocal messages ==== | ||
+ | |||
+ | Vocal messages work differently. First, unlike widgets, these messages must be created in *.cs files. | ||
+ | |||
+ | Then, in your code, you must register vocal messages like this: | ||
+ | SpeechObject.Singleton.AddVoiceString(" | ||
+ | | ||
+ | The first parameter is the identifier of the string which will be used in the .lng file. | ||
+ | |||
+ | When the reference locale file is generated, you will see a line like this in the voiceSentences section of the english.lng file: | ||
+ | <setting name=" | ||
+ | |||
+ | ===== Generate the reference locale file ===== | ||
+ | |||
+ | To generate/ | ||
+ | - in Mail2Voice root folder, open Git Bash : right click > Git Bash, | ||
+ | - type: utils/ | ||
+ | - check for the default.lng file in the locales folder. | ||
+ | - replace the english.lng file with the default.lng file, | ||
+ | |||
+ | ===== Update translations ===== | ||
+ | - make sure you have generated the latest reference locale file. | ||
+ | - merge changes between the new english.lng and the other locales files and translate the new strings. | ||