Language support

From Official Kodi Wiki
Revision as of 19:01, 23 April 2014 by NedBot (talk | contribs) (Robot: Changing Category:Skin Development to Category:Skin development)
Jump to navigation Jump to search
Home icon grey.png   ▶ Development
▶ Add-on development
▶ Language support
Cleanup.png 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.


Time.png THIS PAGE IS OUTDATED:

This page or section has not been updated in a long time, no longer applies, refers to features that have been replaced/removed, and/or may not be reliable.

This page is only kept for historical reasons, or in case someone wants to try updating it.

The following page explains exactly how to add a new language translation to XBMC, and how to maintain/update an existing language file in XBMC. English is the default language of XBMC 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 XBMC can be found and downloaded here (link).

The Language Folders

The "language" folder in XBMC contains one directory for each language. Each language folder contains two files, langinfo.xml and strings.xml. There are also a language folder in skin/PM3.HD that needs translation as well.

What is langinfo.xml

The langinfo.xml file contains language and region specific localization settings used internally by XBMC. Basically it is the default code page XBMC uses for this language file.

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 XBMC 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 DVDPlayer. 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.

What is strings.xml

This files contains all strings displayed in the user interface of XBMC.


Layout of the strings.po file

# XBMC Media Center language file
# Addon Name: Skin Widgets
# Addon id: service.skin.widgets
# Addon Provider: Martijn|phil65
msgid ""
msgstr ""
"Project-Id-Version: XBMC 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: XBMC Translation Team\n"
"Language-Team: English (http://www.transifex.com/projects/p/xbmc-addons/language/en/)\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 ""


Layout of the strings.xml file

   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <strings>
       <string id="32001">Recommended</string>
       <string id="32002">Random Items</string>
       <string id="32003">Only unplayed</string>
       <string id="32004">Randomize time (minutes)</string>
       <string id="32005">Use season folders</string>
       <string id="32006">Use timer</string>
       <string id="32007">After database update</string>
       <string id="32008">Update method</string>
       <string id="32009">Recent Items</string>
   </strings>


Each string is enclosed in a <string> tag. It contains a tag named id="32001" with a number xbmc uses to reference a string internally.


Hint: Multi-Line Text-Values
If you want your text-values to span multiple lines, you can insert a new line character [br] in your tag.

For example:

   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <strings>
      <string id="32001"><value>This will be on the first line[br]And this will be on the second line</string>
   </strings>

The encoding attribute of the XML header sets the charset the file is encoded with. See List of charsets of possible values. If you don't know what charset your language uses please follow this link to find out.

String ID range:

  • 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

Adding a new language to XBMC

See: Translation System

Maintaining a language

The English (UK) language file ([1]) is the master for all language files. From time to time the English (UK) language file changes. This will be automatically update from time to time to Transifex translation pages.

How to keep track of changes: Use our Translation System

Related articles in the XBMC online manual


Notes for developers

XBMC uses UTF-8 as internal character encoding. Please make sure if you add new features to xbmc 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.