Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | TRANSLATING VIM MESSAGES |
| 2 | |
| 3 | In this directory you will find xx.po files, where "xx" is a language code. |
| 4 | Each file contains the translation of English Vim messages for one language. |
| 5 | The files are in "po" format, used by the gettext package. Please refer to |
| 6 | the gettext documentation for more information. |
| 7 | |
| 8 | The GNU gettext library, starting with version 0.10.37, supports converting |
| 9 | messages from one encoding to another. This requires that it was compiled |
| 10 | with HAVE_ICONV. The result is that the messages may be in any encoding |
| 11 | supported by iconv and will be automatically converted to the currently used |
| 12 | encoding. |
| 13 | |
| 14 | The GNU gettext library, starting with version 0.10.36, uses a new format for |
| 15 | some encodings. This folows the C99 standard for strings. It means that when |
| 16 | a multi-byte character includes the 0x5c byte, this is not recognized as a |
| 17 | backslash. Since this format is incompatible with Solaris, Vim uses the old |
| 18 | format. This is done by setting the OLD_PO_FILE_OUTPUT and OLD_PO_FILE_INPUT |
| 19 | environment variables. When you use the Makefile in this directory that will |
| 20 | be done for you. This does NOT work with gettext 0.10.36. Don't use it, get |
| 21 | 0.10.37. |
| 22 | |
| 23 | |
| 24 | ON MS-WINDOWS |
| 25 | |
| 26 | The distributed files are generated on Unix, but this should also be possible |
| 27 | on MS-Windows. Download the gettext packages, for example from: |
| 28 | |
| 29 | http://sourceforge.net/projects/gettext |
| 30 | |
| 31 | You might have to do the commands manually. Example: |
| 32 | |
| 33 | cd c:\vim\vim60 |
| 34 | mkdir runtime\lang\ja\LC_MESSAGES |
| 35 | msgfmt -o runtime\lang\ja\LC_MESSAGES\vim.mo src\po\ja.po |
| 36 | |
| 37 | |
| 38 | WHEN THERE IS A MISTAKE |
| 39 | |
| 40 | If you find there is a mistake in one of the translations, please report this |
| 41 | to the maintainer of the translation. His/her E-mail address is in the |
| 42 | comments at the start of the file. You can also see this with the ":messages" |
| 43 | command in Vim when the translation is being used. |
| 44 | |
| 45 | |
| 46 | CREATING A NEW PO FILE |
| 47 | |
| 48 | We will use "xx.po" as an example here, replace "xx" with the name of your |
| 49 | language. |
| 50 | |
| 51 | - Edit Makefile to add xx to LANGUAGES and xx.mo to MOFILES. |
| 52 | - Copy the header of an existing file, e.g., de.po, to xx.po. Do not copy any |
| 53 | of the translated messages, delete everything after the "msgstr". |
| 54 | - The remaining work is like updating, see the next section. |
| 55 | |
| 56 | |
| 57 | UPDATING A PO FILE |
| 58 | |
| 59 | If you are the maintainer of a .po file, this is how you update the file. We |
| 60 | will use "xx.po" as an example here, replace "xx" with the name of your |
| 61 | language. |
| 62 | |
| 63 | (1) Add new and changed messages from the Vim sources: |
| 64 | |
| 65 | make xx |
| 66 | |
| 67 | This will extract all the strings from Vim and merge them in with the |
| 68 | existing translations. Requires the GNU gettext utilities. Also requires |
| 69 | unpacking the extra archive. |
| 70 | Your original xx.po file will be copied to xx.po.orig |
| 71 | |
| 72 | -- After you do this, you MUST do the next three steps! -- |
| 73 | |
| 74 | (2) Translate |
| 75 | See the gettext documentation on how to do this. You can also find |
| 76 | examples in the other po files. |
| 77 | Search the po file for items that require translation: |
| 78 | |
| 79 | /fuzzy\|^msgstr ""\(\n"\)\@! |
| 80 | |
| 81 | Remove the "#, fuzzy" line after adding the translation. |
| 82 | |
| 83 | There is one special message: |
| 84 | msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" |
| 85 | You should include your name and E-mail address instead, for example: |
| 86 | msgstr "Berichten übersetzt bei: John Doe <john@doe.org>" |
| 87 | |
| 88 | (3) Clean up |
| 89 | This is very important to make sure the translation works on all systems. |
| 90 | Comment-out all non-translated strings. There are two types: |
| 91 | - items marked with "#, fuzzy" |
| 92 | - items with an empty msgstr |
| 93 | You can do this with the cleanup.vim script: |
| 94 | |
| 95 | :source cleanup.vim |
| 96 | |
| 97 | Background: on Solaris an empty msgstr results in an empty message; GNU |
| 98 | gettext ignores empty strings and items marked with "#, fuzzy". |
| 99 | |
| 100 | (4) Check: |
| 101 | |
Bram Moolenaar | 58d9823 | 2005-07-23 22:25:46 +0000 | [diff] [blame^] | 102 | vim -S check.vim xx.po |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 103 | make xx.mo |
| 104 | |
| 105 | Look out for syntax errors and fix them. |