|This page or section may require cleanup, updating, spellchecking, reformatting and/or updated images. Please improve this page if you can. The discussion page may contain suggestions.|
The following page explains exactly how to add a new language translation to Kodi, and how to maintain/update an existing language file in Kodi.
English (United Kingdom) is the default language of Kodi so it is the English language in the Git repository that is always up-to-date.
Please always base your translations of the latest English language file from Git. The latest language files for Kodi can be found and downloaded here (link).
1 Language add-ons
By default Kodi only includes one language which is English (united Kingdom). All other languages have been moved to individual language add-ons which are available form our Kodi repository for download and install. They are auto update by Team Kodi once in a while and pushed to our repository from which you will receive these updates depending on what language(s) you have installed.
2 What is langinfo.xml
The langinfo.xml file contains language and region specific localization settings used internally by Kodi. Basically it is the default code page Kodi uses for this language file.
2.1 Layout of a langinfo.xml file
<language> <charsets> <gui>GB2312</gui> <subtitle>GB2312</subtitle> </charsets> <dvd> <menu>cn</menu> <audio>cn</audio> <subtitle>cn</subtitle> </dvd> </language>
The <charset> section:
<gui>: Specifies the character encoding of everything within Kodi that is not unicode. E.g. id3 tags with none unicode encoding.
<subtitle>: Default character encoding of subtitles when using a TTF (True-Type-Font).
Choose one encoding for each in the list below. The values may differ if you like.
The <dvd> section: Defines the default languages for DVD-Video menu, audio and subtitle language for the VideoPlayer. Choose one for each entry out of the list of ISO-639 language abbreviations. If the DVD-Video you are playing does not support the language that you specified then it will default to English.
3 What is strings.po
This GNU Gettext format file contains all text strings displayed in the user interface of Kodi.
Using that file the entire application or any add-on can be translated to any language whose graphemes are available within Unicode.
3.1 Layout of the strings.po file
# Kodi Media Center language file # Addon Name: Skin Widgets # Addon id: service.skin.widgets # Addon Provider: Martijn, phil65 msgid "" msgstr "" "Project-Id-Version: Kodi Addons\n" "Report-Msgid-Bugs-To: [email protected]\n" "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Kodi Translation Team\n" "Language-Team: English (https://kodi.weblate.cloud/languages/en_gb/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: en\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgctxt "#32001" msgid "Recommended" msgstr "" msgctxt "#32002" msgid "Random Items" msgstr "" # empty string with id 32003 msgctxt "#32004" msgid "Randomize time (minutes)" msgstr "" msgctxt "#32005" msgid "Use season folders" msgstr ""
This is a format defined by GNU gettext but adapted in a very specific way by Kodi. The blocks of 3 settings in the example above are defined by GNU gettext as:
msgctxt context msgid untranslated-string msgstr translated-string
Where the text is defined by untranslated-string and context serves to differentiate identical values.
Take note, in Kodi, these are used as follows:
msgctxt "#label_id" msgid label_text msgstr translation
where label_id is a numeric ID. These IDs are reserved by Kodi:
- strings 30000 thru 30999 reserved for plugins and plugin settings
- strings 31000 thru 31999 reserved for skins
- strings 32000 thru 32999 reserved for scripts
- strings 33000 thru 33999 reserved for common strings used in add-ons
and are used in settings.xml to label settings.
label_text defines the English text for the label.
translation is empty for "en_GB" labels, and the translation for other languages with msgid retaining the English text.
The important thing is that you cannot refer to the label with msgid in the settings.py file, you need to use the label_id which must be encoded in msgctxt as above.
You can of course edit .po files in a text editor or with a specialist editor.
3.2 Layout of the language folders
Kodi loads the strings.po file depending on the set interface language. Should it find a matching language it will try to load that strings.po. If not available it will always fall back to English (United Kingdom).
For this to work you will need to place the strings.po in the correctly named folder depending on the language. These folders use "language-country" naming scheme.
/resources/language/resource.language.en_gb/strings.po /resources/language/resource.language.fr_fr/strings.po /resources/language/resource.language.it_it/strings.po
/language/resource.language.en_gb/strings.po /language/resource.language.fr_fr/strings.po /language/resource.language.it_it/strings.po
Please use lower case for folder and file names.
An extensive example list of used languages can be found here https://github.com/xbmc/xbmc/tree/master/addons/skin.estuary/language
4 Adding a new language to Kodi
- See: Language portal
5 Maintaining a language
The English (UK) language file () is the master for all language files.
From time to time the English (UK) language file changes. This will instantly be automatically updated at Weblate translation pages.
6 Related articles in the Kodi online manual
- Translations in Kodi
- Translating your add-on
- List of Supported Charsets
- List of language codes (ISO-639:1988)
7 Notes for developers
Kodi uses UTF-8 as internal character encoding. Please make sure if you add new features to Kodi which depend on external data to convert these to UTF-8 if they aren't already. Use the languagefile from branches/linuxport, since we merge that file into trunk.