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