Difference between revisions of "Translation"

From MythTV Official Wiki
Jump to: navigation, search
m (Update translation files)
(Page cleanup / Minor rewrite)
Line 1: Line 1:
I use as an example the German translation file. Dont forget to use it also for the plugins.
+
== Translate MythTV ==
 
+
Throughout this page, German (de) translation files will be used as examples.
== Checkout the SVN version ==
 
  
 +
=== Checkout the latest SVN version ===
 
Checkout the latest SVN version by running:
 
Checkout the latest SVN version by running:
 
  svn co http://svn.mythtv.org/svn/trunk
 
  svn co http://svn.mythtv.org/svn/trunk
Line 8: Line 8:
 
Go to the <code>mythtv/i18n</code> directory. All remaining steps will be done in this directory.
 
Go to the <code>mythtv/i18n</code> directory. All remaining steps will be done in this directory.
  
== Update translation files ==
+
=== Update translation files ===
  
 
To update the translation files with the latest strings, run the following command:
 
To update the translation files with the latest strings, run the following command:
 
  lupdate translate.pro
 
  lupdate translate.pro
This will ensure that all translatable strings in the source code are included in the <code>.ts</code> file we will work on later.
+
This will ensure that all translatable strings in the source code are included in the <code>.ts</code> file, which we will work on later.
  
== Translate ==
+
=== Do the translation ===
  
 
Translate .ts file, e.g. mythfrontend_de.ts (for German)
 
Translate .ts file, e.g. mythfrontend_de.ts (for German)
Line 20: Line 20:
 
You can use any editor for this, but it is most convenient to use the tool Linguist included in Qt (on Debian, this is found in the qt4-dev-tools package).
 
You can use any editor for this, but it is most convenient to use the tool Linguist included in Qt (on Debian, this is found in the qt4-dev-tools package).
  
<code>linguist mythfrontend_de.ts</code>
+
linguist mythfrontend_de.ts
  
== Compile translation ==
+
=== Compile and test translation ===
  
<code>lrelease translate.pro</code>
+
Compile .ts files into .qm files by running:
 +
lrelease translate.pro
  
<code>cp mythfrontend_de.qm /usr/share/mythtv/i18n/ </code> (destination path depends on your MythTV installation)
+
The generated .qm file of your language can now be copied into a MythTV installation for testing:
 +
cp mythfrontend_de.qm /usr/share/mythtv/i18n/
 +
(destination path depends on your MythTV installation)
  
 
After restarting the frontend, you can test your translations. If all is OK you can proceed.
 
After restarting the frontend, you can test your translations. If all is OK you can proceed.
  
== Create Diff ==
+
=== Create patch ===
 +
You can now create a patch for your translation:
 +
 
 +
cd ../..
 +
svn diff mythtv/i18n/mythfrontend_de.ts > german_mythtv_translation.diff
 +
 
 +
If you translate several files (eg. MythTV and some plugins), please merge all of the translations into one patch, instead of creating several patches.
 +
 
 +
To do this, just put all files on the same line when creating the patch, for example:
  
<code>svn diff mythfrontend_de.ts > translation.diff</code>
+
cd ../..
 +
svn diff mythtv/i18n/mythfrontend_de.ts mythplugins/mythvideo/i18n/mythvideo_de.ts > german_translation.diff
  
== Submit the Patch ==
+
=== Submit the patch ===
  
 
Submit the Diff to trac, via the URL: http://svn.mythtv.org/trac/newticket
 
Submit the Diff to trac, via the URL: http://svn.mythtv.org/trac/newticket
  
Summary: [PATCH i18n] $LANGUAGE translation
+
-
 +
Summary: [PATCH i18n] $LANGUAGE translation
 +
Type: patch
 +
Version: Trunk Head
 +
Component: Translations
 +
-
 +
Leave the rest of the fields (milestone, priority, severity) untouched.
 +
 
  
 
== Translate the plugins ==
 
== Translate the plugins ==
  
Now back out of the mythtv directory, enter mythplugins, and each plugin's i18n directory, eg:
+
To translate the plugins, back out of the mythtv directory, enter mythplugins, and each plugin's i18n directory, eg:
  
 
  cd ../..
 
  cd ../..
 
  cd mythplugins/mythvideo/i18n
 
  cd mythplugins/mythvideo/i18n
  
and repeat the above steps (beginning with "Update Translation Files") to translate each plugin.
+
and repeat the above steps (beginning with "Update translation files").
  
== Translate the Menus ==
 
  
Translation of menus are now done through QT/Linguist as well. However, for this to work, you'll need to delete the old deprecated XML-translations. If you submit a patch which edits the XML-translations instead of removing them, there'll be no guarantee that your patch will be accepted, instead it will most likely be rejected ([http://svn.mythtv.org/trac/ticket/7771 Ticket #7771] is one example of this).
+
== Translate the menus ==
  
 +
Translation of menus are now done through the .ts files as well. However, if you've translated the menu strings in the .ts files and this doesn't work, then you'll need to delete some old deprecated XML-translations.
  
 
You can find the XML-translations in:
 
You can find the XML-translations in:
Line 58: Line 77:
 
  mythtv/themes/*/*.xml
 
  mythtv/themes/*/*.xml
 
  mythplugins/*/theme/menus/*.xml
 
  mythplugins/*/theme/menus/*.xml
 +
 +
If you submit a patch which edits the XML-translations instead of removing them, there'll be no guarantee that your patch will be accepted, instead it will most likely be rejected ([http://svn.mythtv.org/trac/ticket/7771 Ticket #7771] is one example of this).
  
 
You can use the following grep command to find these old translations (this example uses Germany - "DE"):
 
You can use the following grep command to find these old translations (this example uses Germany - "DE"):
Line 69: Line 90:
 
If you get no output from the above commands, all old XML-translations are already deleted.
 
If you get no output from the above commands, all old XML-translations are already deleted.
  
If you DO get some output, you'll need to delete the lines mentioned in the output and make a patch with the changes. Otherwise your QT/Linguist menu translations will not be used.
+
If you DO get some output, you'll need to delete the lines mentioned in the output and make a patch with the changes. Otherwise your .ts menu translations will not be used.
  
 
[[Category:Developer Documentation]]
 
[[Category:Developer Documentation]]

Revision as of 14:41, 28 April 2010

Translate MythTV

Throughout this page, German (de) translation files will be used as examples.

Checkout the latest SVN version

Checkout the latest SVN version by running:

svn co http://svn.mythtv.org/svn/trunk

Go to the mythtv/i18n directory. All remaining steps will be done in this directory.

Update translation files

To update the translation files with the latest strings, run the following command:

lupdate translate.pro

This will ensure that all translatable strings in the source code are included in the .ts file, which we will work on later.

Do the translation

Translate .ts file, e.g. mythfrontend_de.ts (for German)

You can use any editor for this, but it is most convenient to use the tool Linguist included in Qt (on Debian, this is found in the qt4-dev-tools package).

linguist mythfrontend_de.ts

Compile and test translation

Compile .ts files into .qm files by running:

lrelease translate.pro

The generated .qm file of your language can now be copied into a MythTV installation for testing:

cp mythfrontend_de.qm /usr/share/mythtv/i18n/

(destination path depends on your MythTV installation)

After restarting the frontend, you can test your translations. If all is OK you can proceed.

Create patch

You can now create a patch for your translation:

cd ../..
svn diff mythtv/i18n/mythfrontend_de.ts > german_mythtv_translation.diff

If you translate several files (eg. MythTV and some plugins), please merge all of the translations into one patch, instead of creating several patches.

To do this, just put all files on the same line when creating the patch, for example:

cd ../..
svn diff mythtv/i18n/mythfrontend_de.ts mythplugins/mythvideo/i18n/mythvideo_de.ts > german_translation.diff

Submit the patch

Submit the Diff to trac, via the URL: http://svn.mythtv.org/trac/newticket

-
Summary: [PATCH i18n] $LANGUAGE translation
Type: patch
Version: Trunk Head
Component: Translations
-
Leave the rest of the fields (milestone, priority, severity) untouched.


Translate the plugins

To translate the plugins, back out of the mythtv directory, enter mythplugins, and each plugin's i18n directory, eg:

cd ../..
cd mythplugins/mythvideo/i18n

and repeat the above steps (beginning with "Update translation files").


Translate the menus

Translation of menus are now done through the .ts files as well. However, if you've translated the menu strings in the .ts files and this doesn't work, then you'll need to delete some old deprecated XML-translations.

You can find the XML-translations in:

mythtv/themes/*/*.xml
mythplugins/*/theme/menus/*.xml

If you submit a patch which edits the XML-translations instead of removing them, there'll be no guarantee that your patch will be accepted, instead it will most likely be rejected (Ticket #7771 is one example of this).

You can use the following grep command to find these old translations (this example uses Germany - "DE"):

mythtv:

grep -H -i 'lang="DE"' mythtv/themes/*/*.xml

mythplugins:

grep -H -i 'lang="DE"' mythplugins/*/theme/menus/*.xml

If you get no output from the above commands, all old XML-translations are already deleted.

If you DO get some output, you'll need to delete the lines mentioned in the output and make a patch with the changes. Otherwise your .ts menu translations will not be used.