-
Notifications
You must be signed in to change notification settings - Fork 76
15 Translations
MaterialSkin's translation files are split across 3 different file formats; the main UI translation (JSON files), server-side (LMS specific text files), and a simple HTML file for help text.
For the WebApp MaterialSkin loads language specific JSON files from LMS, and these map from the English used in the source code to the language specific translations. With the MaterialSkin/HTML/material/html/lang
folder you will find .json
file for each currently translated language.
{
"color":"translated version of 'color'",
...
}
The translation of MaterialSkin's server-side settings (e.g. those that are shown from Settings / Server / Plugins / MaterialSkin) uses LMS's
strings.txttranslation system. Within
MaterialSkinyou will find a
strings.txtfile that contains the MaterialSkin specific strings to translate. In this file each 'string' is represented by an uppercase 'key' followed by a line for each language. Each line has a specfic
TAB-LANG-TAB-Translated text` format (and you must use a tab character, not spaces).
e.g.
SOME_STRING_KEY
EN English translation of 'some string'
FR French translation
The 'Help' entry in MaterialSkin's main menu shows a help page detailing basic usage, long-press items, etc. To simplify coding this is simply another HTML file, with a unique file per language. Within MaterialSkin/HTML/EN/html/material-skin/
you will find various index.html
files, with language specific extensions - e.g. index.html.fr
for French. These are not 100% plain HTML files, but contain some LMS HTML templating code. The format of these files is:
[% PROCESS materialhelpheader.html %]
<h1>Introduction</h1>
...
[% PROCESS materialhelpfooter.html %]
The lines between materialhelpheader.html
and materialhelpfooter.html
are what need to be translated, and any translations should (try to at least) keep the same styling for formatting.
- Use GitHub to fork the MaterialSkin repo
- Clone your forked repo
- Create a branch for your changes (e.g. 'xxx-translation' ('xxx' being your language))
- Copy
MaterialSkin/HTML/material/html/lang/blank.json
toMaterialSkin/HTML/material/html/lang/<iso-lang-code>.json
(e.g.en-gb.json
for British English). The 'iso-lang-code' will depend upon which language you are translating into. If this is not one of LMS's supported language, you will probably also need to have LMS updated to support your language. Language codes need to be all lowercase, and separated by a dash. - Update each entry in your
<iso-lang-code>.json
to translate the English into your language - Update
MaterialSkin/strings.txt
to add new language specific translations of each item (remember the 'tab' spacing) - Copy
MaterialSkin/HTML/EN/html/material-skin/index.html
toMaterialSkin/HTML/EN/html/material-skin/index.html.<iso-lang-code>
Language codes need to be all lowercase, and separated by an underscore - e.g.index.html.en_gb
- Translate the strings in this
index.html.<iso-lang-code>
file -
git add
your new<iso-lang-code>.json
andindex.html.<iso-lang-code>
files -
git commit
all your changes - Push all your changes to your github repo
- Use github to request a merge of your branch into the master branch of this repo
If you are not familiar with git, or find the above too technical, you can simply send your new (or updated) translation files via email. Yoi will find my email address in the LICENSE
file.
The basic steps for translating will then be:
- Download blank.json
- Rename
blank.json
to<iso-lang-code>.json
(e.g.en-gb.json
for British English). The 'iso-lang-code' will depend upon which language you are translating into. If this is not one of LMS's supported language, you will probably also need to have LMS updated to support your language. Language codes need to be all lowercase, and separated by a dash. - Update each entry in your
<iso-lang-code>.json
to translate the English into your language - Download strings.txt
- Update
strings.txt
to add new language specific translations of each item (remember the 'tab' spacing) - Download index.html
- Rename
index.html
toindex.html.<iso-lang-code>
Language codes need to be all lowercase, and separated by an underscore - e.g.index.html.en_gb
- Translate strings in
index.html.<iso-lang-code>
- Send me an email with your updated files, and I will add to the MaterialSkin repo