Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | TRANSLATING VIM MESSAGES |
| 2 | |
| 3 | This file explains how to create and maintain po files using |
| 4 | gnu-gettext.win32, a Windows port of gettext by Franco Bez |
| 5 | <franco.bez@gmx.de>. You can find it at: |
| 6 | |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 7 | http://people.freenet.de/franco.bez/gettext/gettext_win32_en.html |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | |
| 9 | First read the README.txt file in this directory for general remarks on |
| 10 | translating Vim messages. |
| 11 | |
| 12 | |
| 13 | SETUP |
| 14 | |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 15 | Set the environment variable LANGUAGE to the language code for the language |
| 16 | you are translating Vim messages to. Language codes are typically two |
| 17 | characters and you can find a list of them at: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 18 | |
| 19 | http://www.geocities.com/click2speak/languages.html |
| 20 | |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 21 | Another possibility is to use the gnuwin32 port of gettext. This is |
| 22 | recommended especially if you use already gnuwin32 tools to gunzip, bunzip, |
| 23 | patch etc. these files. You find the gnuwin32 version of gettext here: |
| 24 | |
| 25 | http://gnuwin32.sourceforge.net/packages/gettext.htm |
| 26 | |
| 27 | Yet another very strait forward way is to get the sources of gettext from |
| 28 | |
| 29 | http://www.gnu.org/software/gettext/gettext.html |
| 30 | |
| 31 | and build your own version of these tools. The documentation states that this |
| 32 | should be possible with MSVC4.0, MSVC5.0, MSVC6.0 or MSVC7.0, but you can |
| 33 | build it even successfully with MSVC8.0. |
| 34 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 35 | The LANGUAGE environment variable can be set from the command line, by adding |
| 36 | a line to your autoexec.bat file, or by defining a user variable from the |
| 37 | Advanced tab in the System control panel. |
| 38 | |
| 39 | Next, edit Make_mvc.mak so that GETTEXT_PATH points the binary directory of |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 40 | the installation. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 41 | |
| 42 | |
| 43 | CREATING A NEW TRANSLATION |
| 44 | |
| 45 | When creating a new translation you must add your language code to the |
| 46 | Make_mvc.mak file in the lines defining LANGUAGES and MOFILES. To create the |
| 47 | initial .po file for your language you must use the command: |
| 48 | |
| 49 | make -f make_mvc.mak first_time |
| 50 | |
| 51 | Note: You need to be in the po directory when using this makefile. |
| 52 | |
| 53 | Once you have your new .po file load it into Vim and source cleanup.vim, this |
| 54 | will convert untranslated messages to comments. If you have syntax |
| 55 | highlighting turned on then untranslated messages will stand out more easily. |
| 56 | |
| 57 | You will also need to edit the file names in the comments in the .po file. |
| 58 | You need to remove the absolute directory specification (which has the form |
| 59 | c:\vim61\src\). You can do this in Vim with the following command with the |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 60 | appropriate directory specification for where you have installed the Vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 61 | source: |
| 62 | |
| 63 | %s/c:\\vim61\\src\\//g |
| 64 | |
| 65 | |
| 66 | UPDATING A TRANSLATION |
| 67 | |
| 68 | If there are new or changed messages in Vim that need translating, then the |
| 69 | first thing to do is merge them into the existing translations. This is done |
| 70 | with the following command: |
| 71 | |
| 72 | nmake -f Make_mvc.mak xx.po |
| 73 | |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 74 | where xx is the language code for the language needing translations. The |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 75 | original .po file is copied to xx.po.orig. |
| 76 | |
| 77 | |
| 78 | DOING THE TRANSLATION |
| 79 | |
| 80 | Now that you have a .po file you can do the translations for all messages that |
| 81 | need it. See README.txt for specific instructions. |
| 82 | |
| 83 | Once you have finished translating the messages you should make sure all |
| 84 | non-translated strings are commented out. This can be done by sourcing |
| 85 | cleanup.vim once again. |
| 86 | |
| 87 | |
| 88 | CHECKING THE TRANSLATION |
| 89 | |
| 90 | Check the translation with the following command: |
| 91 | |
| 92 | nmake -f make_mvc.mak xx.mo |
| 93 | |
| 94 | Correct any syntax errors reported. When there are no more errors, the |
| 95 | translation is ready to be installed. |
| 96 | |
| 97 | |
| 98 | INSTALLING THE TRANSLATION |
| 99 | |
| 100 | Install your translation with the following command: |
| 101 | |
| 102 | nmake -f make_mvc.mak install |
| 103 | |
| 104 | This will create the xx\LC_MESSAGES directory in runtime\lang if it does not |
| 105 | already exist. |
| 106 | |
| 107 | |
| 108 | vim:tw=78: |