Daniel Dadush wrote:
Hi, I'm trying to do some work in i18n and I've having trouble getting
vim to properly display text in different languages. I'm currently
working with the MoinMoin wiki, looking at it's translatable text
strings (which are in 18 different languages) and almost all of them
render with strange characters on the screen. I set both file-encoding
and encoding to utf-8 and still no luck. If I open this files in IDLE
(the python editor) all the text displays perfectly, so I'm pretty
sure I have all the right language packs installed (I think...). Does
anyone know what I'm doing wrong? Any suggestions would be highly
appreciated.

Vim Version: 7.0
OS: WinXP SP2



To have the messages in a language other than your locale's, use for instance

        language messages fr_CA

at the very top of your vimrc (BEFORE sourcing vimrc_example.vim if, like me, you do it). The last string (the language) is OS-dependent; in Windows, you may (or may not) have to use "French_Canada" instead of "fr_CA". 'encoding' and 'fileencoding' are something else (see below). To have Vim start in English even in non-English locales, you may have to use

        if has("unix")
                language messages C
        else
                language messages en
        endif

Vim doesn't use the same language packs as other programs (and it's not the only program with its own language translations). If you installed Vim from a binary installer such as Steve Hall's for Windows, all available message translations are included. If you compiled it yourself, you have them if you downloaded not only the "unix" and (possibly) "extra" archives but also the "lang" archive (which resides in the same FTP directory as the "extra" archive). Since I use FTP and not CVS, SVN or AAP, I'm not sure how to get them by these means; but you have them if (after compiling) you have a number of *.mo and *.po files somewhere in your "build" directory structure (you should not build directly in $VIM, but at some other place from which the programs and runtime files can be moved to their final location if the build is successful). If you type "vim --version" in, say, a French locale and the answer comes out in French, then the message translations are included.

'encoding', a global option, defines how Vim represents the data in memory.
'fileencoding', a buffer-local option, defines how the data is represented in the file. If empty it defaults to the value of 'encoding'. If nonempty and different from 'encoding' the data will be translated on reading and writing. When opening a file for editing, the value passed with ++enc= is used if present, otherwise 'fileencoding' is determined by the (global) 'fileencodings' heuristics. None of those options ending in -encoding define the language of the messages: for instance, messages in English (US), English (UK), Irish, French (France), French (Canada), German (Germany), German (Switzerland), Dutch, Spanish, Portuguese (Portugal), Portuguese (Brazil), Italian, Danish, Finnish, Swedish, Norwegian (Bokmål), Norwegian (Nynorsk), Icelandic, ... would all be displayed correctly in any of latin1, ISO-8859-15, cp1252 or UTF-8.

see
        :help :language
        :help 'encoding'
        :help 'fileencoding'
        :help 'fileencodings'
        :help ++opt


Best regards,
Tony.

Reply via email to