Translating#
myMPD has a simple translation framework integrated. It is inspired by polyglot.js.
Following translations are available and maintained:
English (en-US) - default
German (de-DE)
User contributed translations:
bg-BG: 1158 missing phrases
es-AR: 1 missing phrases
es-ES: 1026 missing phrases
es-VE: 1005 missing phrases
fi-FI: 1002 missing phrases
fr-FR: 1 missing phrases
it-IT: 1 missing phrases
ja-JP: 71 missing phrases
ko-KR: fully translated
nl-NL: 1 missing phrases
pl-PL: 8 missing phrases
ru-RU: 82 missing phrases
zh-Hans: fully translated
zh-Hant: 6 missing phrases
Translations with more than 100 missing phrases are not included in the build.
Translate#
The translation files are imported to a public POEditor project. You can join the project and help translating.
Hint
There are some phrases that are only shortcuts for the full text. You can lookup the english phrase here.
Translation files#
Translations are defined in one file per language. The translation files resides under <srcdir>/src/i18n/json and are named by the language code, e.g. en-US.json. The perl script translate.pl creates the i18n.json from these files, do not edit this file directly.
Syntax#
JSON key / value pairs
key is the phrase, value the translation
%{smart_count}is used for pluralization||||separates the pluralization formsthe phrase before is used for number one
the phrase after is user for numbers zero or greater than one
more pluralization forms can be easily added (please open an issue)
all other
%{variables}are replaced with values
Example#
"Num playlists": "%{smart_count} Playlist |||| %{smart_count} Playlists"
Expands to 1 Playlist or 5 Playlists or 0 Playlists
Adding missing translations#
This example is for the german translation (de-DE).
Show missing translation phrases for one language:
./build.sh translate 2>&1 | grep "de-DE"Add translation to file:
src/i18n/json/de-DE.json
Adding a new language#
Add language code and description to
src/i18n/i18n.txtCopy a existing translation to a file with the new language code
Translate it
You can check the translation files manually. The build process shows all missing or obsolete translations.
./build.sh translate
Debug builds should use the new translation after a successful build.
Adding a new translation#
Add the file to:
src/web_server/embedded_files.cthe struct
embedded_filesinsrc/web_server/utility.cCMakeLists.txtsrc/compile_time.h.in