Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| translations:translation_guidance_in_xfce [2010/10/02 17:26] – external edit 127.0.0.1 | translations:translation_guidance_in_xfce [2026/09/11 21:44] (current) – removed kevinbowen | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Short Guide About Translating Messages ====== | ||
| - | |||
| - | ===== 0. License and Authors ===== | ||
| - | |||
| - | This document is provided under the [[http:// | ||
| - | It is based on the contributions by the following authors: | ||
| - | |||
| - | * Christian Biere < | ||
| - | * Thomas Schürger < | ||
| - | * Murphy < | ||
| - | * Daichi Kawahata < | ||
| - | * Stavros Giannouris < | ||
| - | * Mike Massonnet < | ||
| - | * Added entry about web pages and po-doc documentation | ||
| - | * Updated old references from SVN to Git | ||
| - | |||
| - | ===== 1. Intro ===== | ||
| - | |||
| - | This is a short summary of the gettext documentation. See the [[# | ||
| - | if this information isn't sufficient for you. | ||
| - | ===== 2. Get the PO files ===== | ||
| - | |||
| - | You can get the latest PO files from the Transifex platform, available at http:// | ||
| - | |||
| - | Regarding Xfce, it's recommended having translation for the current stable version at first, the development version would be frequently changed unless they are frozen by developer. | ||
| - | |||
| - | ===== 3. Get the editor for PO file editing ===== | ||
| - | |||
| - | You can use a text editor Emacs with `po-mode', | ||
| - | `po.vim' | ||
| - | `gtranslator (requires GNOME)', | ||
| - | have special features for editing PO file. You can use normal editor like | ||
| - | Mousepad, Vi etc. of course, but it's highly recommended using one of | ||
| - | those editors. | ||
| - | |||
| - | Here are the links: | ||
| - | |||
| - | * Emacs with PO mode - Major mode for GNU gettext PO files. | ||
| - | * http:// | ||
| - | |||
| - | * Vim with po.vim - A ftplugin for easier editing of GNU gettext PO files. | ||
| - | * http:// | ||
| - | |||
| - | * poEdit - A cross-platform gettext catalogs editor. | ||
| - | * http:// | ||
| - | |||
| - | * gtranslator - The GNOME 2.x translation making program. | ||
| - | * http:// | ||
| - | |||
| - | * KBabel - An advanced and easy to use PO-file editor. | ||
| - | * http:// | ||
| - | |||
| - | If you are going to continue as translator, you might want to learn | ||
| - | one of above. | ||
| - | |||
| - | ===== 4. Contact with the former translator in your language ===== | ||
| - | |||
| - | To save your time from duplicate work already on going, it's better to | ||
| - | contact the translator in the header string, | ||
| - | |||
| - | Last-Translator: | ||
| - | |||
| - | if that address isn't used no longer or you couldn' | ||
| - | the last translator, then please post your message to the Xfce | ||
| - | translations mailing list (xfce-i18n@xfce.org). | ||
| - | |||
| - | |||
| - | ===== 5. Prepare the PO file ===== | ||
| - | |||
| - | To create the PO file for your language, simply type, | ||
| - | |||
| - | $ msginit | ||
| - | |||
| - | in the target po directory, according to your current locale, it | ||
| - | creates lang.po in which the suitable header strings will be given | ||
| - | automatically without your bothering. This newly created PO file, | ||
| - | however, may not have UTF-8 charset depending on your locale, so | ||
| - | you'll need to convert its charset to UTF-8 later. | ||
| - | |||
| - | Note: The command " | ||
| - | generated .pot file. | ||
| - | |||
| - | ===== 6. Translate the messages ===== | ||
| - | |||
| - | In the PO file you'll find something like this: | ||
| - | |||
| - | #: main.c:42 | ||
| - | msgid "Hello world" | ||
| - | msgstr "" | ||
| - | |||
| - | If you want to translate to German, you would change the 3rd line to | ||
| - | the following: | ||
| - | |||
| - | msgstr "Hallo Welt" | ||
| - | |||
| - | Don't touch the string behind " | ||
| - | this string must be corrected in the source file. If you see a string | ||
| - | with a "'' | ||
| - | change the order of these " | ||
| - | backslash "'' | ||
| - | |||
| - | msgid "%-8s are %d time faster than %s.\n" | ||
| - | msgstr "%-8s sind %d mal schneller als %s.\n" | ||
| - | |||
| - | "'' | ||
| - | another example from Xfmedia: | ||
| - | |||
| - | msgid "" | ||
| - | "This is a printf-like format string controlling the display of the " | ||
| - | " | ||
| - | "\t%p: Artist/ | ||
| - | "\t%t: Track Title\n" | ||
| - | "\t%a: Album Name\n" | ||
| - | "\t%T: Track Number\n" | ||
| - | "\t%g: Genre\n" | ||
| - | "\t%y: Year\n" | ||
| - | "\t%f: Filename\n" | ||
| - | "\t%%: a percent sign" | ||
| - | |||
| - | in that case "'' | ||
| - | translation, | ||
| - | of putting "'' | ||
| - | |||
| - | You don't have to translate every message. If you cannot or don't | ||
| - | want to translate a message just leave "'' | ||
| - | copy the string of msgid! | ||
| - | |||
| - | Some strings contain a single underscore (e.g., "_Edit list..." | ||
| - | Xfdesktop). In this case the underscore declares the following letter | ||
| - | as accelerator key. In this example, the key combination < | ||
| - | sometimes < | ||
| - | this string. You should use an appropriate character as accelerator | ||
| - | in the translation as well, just append an underscore to selected | ||
| - | character: | ||
| - | |||
| - | msgid "_Edit list..." | ||
| - | msgstr " | ||
| - | |||
| - | If you change the accelerator key, try to make sure that the chosen | ||
| - | key doesn' | ||
| - | you might want to discard the underscore so that no accelerator will | ||
| - | be available for the GUI element. | ||
| - | |||
| - | Okay, sometimes you see the special marks, format-indicator in your | ||
| - | PO file like bellow, | ||
| - | |||
| - | #: ../ | ||
| - | #, fuzzy | ||
| - | msgid "About Xfce 4" | ||
| - | msgstr "O XFce 4" | ||
| - | |||
| - | with the "'' | ||
| - | will ask " | ||
| - | with translation under gettext mechanism, the more you are getting know | ||
| - | what "'' | ||
| - | |||
| - | #: ../ | ||
| - | msgid "About Xfce 4" | ||
| - | msgstr "O XFce 4" | ||
| - | |||
| - | now, the translated string will work for the certain place. "Then, how | ||
| - | should I do the following case?" you might wonder, | ||
| - | |||
| - | #: ../ | ||
| - | #, fuzzy, c-format | ||
| - | msgid "%s Info" | ||
| - | msgstr "%s Info" | ||
| - | |||
| - | in that case, "'' | ||
| - | be a C format string and, like above mentioned, you'll have to leave "'' | ||
| - | as-is. Simply remove "'', | ||
| - | |||
| - | #: ../ | ||
| - | #, c-format | ||
| - | msgid "%s Info" | ||
| - | msgstr "%s Info" | ||
| - | |||
| - | (more continues...) | ||
| - | |||
| - | FIXME | ||
| - | |||
| - | * An explanation for plural mechanism. | ||
| - | * Commenting with "''#''" | ||
| - | |||
| - | ==== 6.1 Translation Context ==== | ||
| - | |||
| - | The GUI often uses single words or short word combinations. When used | ||
| - | as a frame title a colon is appended the English to disambiguate its | ||
| - | meaning. Another possibility to disambiguate especially short strings | ||
| - | is using the character "'' | ||
| - | this character, the part up to the "'' | ||
| - | translator and/or simply declare a name space so that the word can be | ||
| - | translated in a certain meaning even if the same word is used with | ||
| - | different meanings in other places. For example (from Xfce4-panel): | ||
| - | |||
| - | msgid " | ||
| - | msgstr " | ||
| - | |||
| - | In the translated string discard everything up to the first "'' | ||
| - | translate the rest only. | ||
| - | |||
| - | ==== 6.2 Order switching ==== | ||
| - | |||
| - | Sometimes it is needed to switch the order of the c-formats. | ||
| - | you will have to change the %< | ||
| - | |||
| - | msgid " | ||
| - | msgstr "%2$s space left on device %1$s" | ||
| - | |||
| - | ===== 7 Convert the output to UTF-8 (if it's not already UTF-8 encoded) ===== | ||
| - | |||
| - | $ iconv -f CHARSET -t UTF-8 ${lang}.po > utf8.po | ||
| - | $ mv utf8.po ${lang}.po | ||
| - | |||
| - | Replace CHARSET by the one you use e.g., if you are from Western | ||
| - | Europe it's probably ISO-8859-1. Otherwise see what echo $LC_CTYPE | ||
| - | says, and strip the part up to the . (dot). For example: | ||
| - | |||
| - | $ echo $LC_CTYPE | ||
| - | ja_JP.eucJP | ||
| - | $ iconv -f eucJP -t UTF-8 lang.po > utf8.po | ||
| - | $ mv utf8.po ${lang}.po | ||
| - | |||
| - | If you use Vim you can also convert lines on the fly like this: | ||
| - | |||
| - | :,!iconv -f ISO-8859-1 -t UTF-8 | ||
| - | |||
| - | This usually works even if your terminal doesn' | ||
| - | encoded character sets. | ||
| - | |||
| - | |||
| - | ===== 8. Checking and Submitting the PO file ===== | ||
| - | |||
| - | Firstly, verify whether your PO file is valid: | ||
| - | |||
| - | $ msgfmt --check --check-accelerators=_ -o /dev/null ${lang}.po | ||
| - | |||
| - | You should get no warnings, but if you got them, fix it following | ||
| - | outputted warning messages. After checking, you can send your | ||
| - | translation to the Xfce Transifex platform. To get an account with upload | ||
| - | rights you can follow the instructions found on the translations wiki page | ||
| - | in the //Getting started// section. | ||
| - | |||
| - | Note: This part is so important that please don't post your | ||
| - | translations to the list unless you have no warning. | ||
| - | |||
| - | |||
| - | ===== 9. Template updates ===== | ||
| - | |||
| - | The messages may be changed from release to release and with growing | ||
| - | functionality there will be more messages that should be translated. | ||
| - | Thus, translation isn't something static. Every few month there will | ||
| - | be a few more sentences to be translated. | ||
| - | |||
| - | The following part concerns the project maintainers. To update the PO | ||
| - | files to reflect any changes to translatable strings | ||
| - | in the source files, it requires full source codes in which you'll have | ||
| - | to run | ||
| - | |||
| - | $ ./ | ||
| - | |||
| - | will be required in the each module' | ||
| - | update your files, | ||
| - | |||
| - | $ cd po | ||
| - | $ make update-po | ||
| - | |||
| - | This will scan the source files for translatable strings, will (re-)build | ||
| - | the file "'' | ||
| - | the POT file. | ||
| - | |||
| - | Sometimes, it requires updating POFILES.in in the first place, when there are strings in new source files. | ||
| - | |||
| - | ===== 10. Desktop files (4.2 branch only and it requires full source) ===== | ||
| - | |||
| - | //The desktop files for the 4.4 branch are translated directly in the po files. | ||
| - | |||
| - | The Name, GenericName, | ||
| - | format is: | ||
| - | |||
| - | Key[locale]=localestring | ||
| - | |||
| - | For example (from Xfcalendar): | ||
| - | |||
| - | Name=Xfce Calendar | ||
| - | [...] | ||
| - | Name[he]=לוח שנה Xfce | ||
| - | |||
| - | Make sure the file stays UTF-8 encoded, language order should be | ||
| - | alphabetically. | ||
| - | |||
| - | This isn't required if you're having translation for SVN trunk version, | ||
| - | instead you'll have to install decent intltool. If you are using Emacs, | ||
| - | "'' | ||
| - | |||
| - | * Here are the desktop files that should be translated: | ||
| - | |||
| - | xfcalendar/ | ||
| - | xfcalendar/ | ||
| - | xfce-mcs-manager/ | ||
| - | xfce-mcs-plugins/ | ||
| - | xfce-mcs-plugins/ | ||
| - | xfce-mcs-plugins/ | ||
| - | xfce-mcs-plugins/ | ||
| - | xfce-utils/ | ||
| - | xfce-utils/ | ||
| - | xfce4-appfinder/ | ||
| - | xfce4-iconbox/ | ||
| - | xfce4-mixer/ | ||
| - | xfce4-panel/ | ||
| - | xfce4-session/ | ||
| - | xfce4-session/ | ||
| - | xfdesktop/ | ||
| - | xfdesktop/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xffm/ | ||
| - | xfprint/ | ||
| - | xfprint/ | ||
| - | xfprint/ | ||
| - | xfwm4/ | ||
| - | xfwm4/ | ||
| - | |||
| - | |||
| - | ===== 11. XML files for desktop menu (it requires full source) ===== | ||
| - | |||
| - | //The translations for the desktop menu are translated directly in the po files for the development branch (post 4.4 branch). | ||
| - | |||
| - | You might want to localize desktop menu appearing by right click on the | ||
| - | desktop, your files are, | ||
| - | |||
| - | * For the 4.4 branch | ||
| - | |||
| - | xfdesktop/ | ||
| - | xfdesktop/ | ||
| - | |||
| - | to translate into your language, follow the instructions in those files, | ||
| - | after translations and installation finished, the desktop menu will be | ||
| - | automatically localized. | ||
| - | |||
| - | Note: If you have already installed those XML files but would like to | ||
| - | check your modified translations on the fly, remove | ||
| - | |||
| - | ${HOME}/ | ||
| - | |||
| - | then, newly translations will appear. | ||
| - | |||
| - | |||
| - | ===== 12. Checking your translations in the actual situation ===== | ||
| - | |||
| - | As for the development branch, the relevant module should be built and installed. | ||
| - | This is only for the brave and those that know what to do, instructions | ||
| - | and information are to be found elsewhere. | ||
| - | |||
| - | As for the 4.4 branch, and assuming that the translator has this | ||
| - | installed, it is a matter of running | ||
| - | |||
| - | $ msgfmt -c -o ${lang}.mo ${lang}.po | ||
| - | $ su | ||
| - | # cp ${lang}.mo ${xfce-prefix}/ | ||
| - | |||
| - | and restarting the application. | ||
| - | |||
| - | |||
| - | ===== 13. Documentation translation ===== | ||
| - | |||
| - | The documentations are translated inside the '' | ||
| - | |||
| - | * Maintain the documentation (job for the maintainer/ | ||
| - | - Run the "'' | ||
| - | - Update the POT and PO files with "'' | ||
| - | - Update the XML files with the newly translated PO files with "'' | ||
| - | |||
| - | Note: you need the '' | ||
| - | |||
| - | * Compile the DocBook into HTML format (anyone who wants to check the results) | ||
| - | - Run the "'' | ||
| - | - Run "'' | ||
| - | - The result is compiled inside '' | ||
| - | |||
| - | What you should do **as translator**, | ||
| - | |||
| - | ===== 14. Web page translation ===== | ||
| - | |||
| - | The following command line will checkout the translatable files for the web pages. This will create a local svn tree from which you can begin translating in your language the contents of Xfce's web page. | ||
| - | |||
| - | $ svn co http:// | ||
| - | |||
| - | |||
| - | ===== 15. Feedback ===== | ||
| - | |||
| - | If you have comments, ideas or corrections, | ||
| - | |||
| - | * Xfce translations mailing list < | ||
| - | |||
| - | Your feedback will be gratefully appreciated. | ||
| - | |||
| - | |||
| - | |||
| - | ===== 16. Appendix ===== | ||
| - | |||
| - | * The complete GNU gettext manual: | ||
| - | * http:// | ||
| - | |||
| - | * Standard country codes (ISO 3166): | ||
| - | * http:// | ||
| - | |||
| - | * Standard language codes (ISO 639): | ||
| - | * http:// | ||
| - | |||
| - | * Freedesktop.org desktop entry spec: | ||
| - | * http:// | ||
| - | |||
| - | * Translation Project: | ||
| - | * http:// | ||
| - | |||
| - | * Xfce translations statistics: | ||
| - | * http:// | ||