Language support: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Scape
>Scape
Line 87: Line 87:
==XBMC Translator==
==XBMC Translator==


Our XBMC Translator can be used to translate each strings contained in the english language strings.xml file very easily.
Our XBMC Translator can be used to easily translate each strings contained in the english language file to other languages.


===Features===
===Features===

Revision as of 13:14, 12 July 2006

Introduction

The following page explains how to add and/or maintain a language in xbmc.

The Language Folder

The language folder contains one directory for each language. Each language folder contains two files, langinfo.xml and strings.xml.

What is langinfo.xml

The file contains language specific settings used internally by xbmc. Basicly it's the default codepage xbmc uses for this language file.

Layout of a langinfo.xml file

<xml>

 <language>
   <charsets>
     <gui>CP1252</gui>
     <subtitle>CP1252</subtitle>
   </charsets>
 
   <dvd>
     <menu>en</menu>
     <audio>en</audio>
     <subtitle>en</subtitle>
   </dvd>
 </language>

</xml>

The <charset> section: <gui>: Specifies the character encoding of everything within xbmc that is not unicode. Eg. id3 tags with none unicode encoding. <subtitle>: Default character encoding of subtitles when using a True-Type-Font. Choose one encoding for each in the list below. The values may differ if you like.
The <dvd> section: Defines the defaults for 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 you are playing doesn't support the language you specified, it defaults to english.

What is strings.xml

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

Layout of the strings.xml file

<xml>

 <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
 <strings>
   <string><id>0</id><value>My Programs</value></string>
   <string><id>1</id><value>My Pictures</value></string>
   <string><id>2</id><value>My Music</value></string>
   <string><id>3</id><value>My Videos</value></string>
   <string><id>4</id><value>TV Guide</value></string>
   <string><id>5</id><value>Settings</value></string>
   <string><id>6</id><value>Xbox Media Center CVS</value></string>
   <string><id>7</id><value>My Files</value></string>
   <string><id>8</id><value>Weather</value></string>
   .
   .
   .
 </strings>

</xml>

Each string is enclosed in a <string> tag. It contains a tag named <id> with a number xbmc uses to reference a string internally. The <value> tag is the string displayed by xbmc.

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 you language uses please follow this link to find out.

Adding a new language

If you want to add a new language to xbmc, this is the easiest way to start: 1. Copy the english language folder and name it like the language you want to add. The foldername must be in english 2. Edit the langinfo.xml to the defaults of your language 3. Edit the strings.xml and set the encoding attribute of the xml header to the appropriate of your language 4. Translate the strings in strings.xml

It is also possible to set the encoding to UTF-8 but then make sure the file is also encoded to UTF-8. (A textfile can be encoded to UTF-8 with the Editor of Windows)

If you have everything ready you can upload your new language files as a patch to sourceforge.net

Maintaining a language

The english language file (strings.xml) is the master for all language files. From time to time the english language file changes. The file is updated with new strings or existing strings are replaced. You will have to keep track of the changes to the english language file and add them to your file.

How to keep track of changes: From time to time check the xbmc cvs repository for updates to the english language file. (the link takes you directly to the english language folder.) Another way is to subscribe to cvs mailinglist (xbmc-cvs Archives). But be warned you do not only get a mail when the language file is updated. All updates to the sourcecode of xbmc are posted in this list!

After you are done you can upload your edited language file as a patch to sourceforge.net

List of Supported Charsets

List of language codes (ISO-639:1988)

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.

XBMC Translator

Our XBMC Translator can be used to easily translate each strings contained in the english language file to other languages.

Features

  • create new translations
  • keep track of untranslated strings
  • keep track of changed strings
  • search function to find strings easily
  • edit language specific settings, like codepages and date/time format
  • the language file is saved with utf-8 encoding

Installation

Just run the setup program. While running setup, you are asked to enter you name and your email adress.
These are optional, but it would be nice if you can provide them to know where the language file comes from (for credits).

Using the XBMC Translator

First Start

When you first start the application, you have to set the folder where your language files are located. (Use File/Set language folder... ) The folder you have to choose must contain at least the english language folder. It can also contain the folder of the language to be translated, if it already exists. In short, you can use the folder [xbmcroot]\language of your downloaded XBMC.

Importing existing language files

It may be possible that you will get an error message when importing existing files. It is important that characters like "&" are replaced with &. You may also get a message that a string has a duplicate ID. You have to fix all of those errors in your file before you can use the language file.

Download

Here you can download our latest XBMC Translator program: XBMC Translator


Note: You need a XBMC version greater or equal then the 06/20/2006 to use the generated language files within XBMC.