robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
cf347110c1
master
1*mlang.txt* Nvim 2 3 4 VIM REFERENCE MANUAL by Bram Moolenaar 5 6 7Multi-language features *multilang* *multi-lang* 8 9This is about using messages and menus in various languages. For editing 10multibyte text see |multibyte|. 11 12The basics are explained in the user manual: |usr_45.txt|. 13 14 Type |gO| to see the table of contents. 15 16============================================================================== 171. Messages *multilang-messages* 18 19Vim picks up the locale from the environment. In most cases this means Vim 20will use the language that you prefer, unless it's not available. 21 22To see a list of supported locale names on your system, look in one of these 23directories (for Unix): 24 /usr/lib/locale ~ 25 /usr/share/locale ~ 26Unfortunately, upper/lowercase differences matter. Also watch out for the 27use of "-" and "_". 28 29 *:lan* *:lang* *:language* *E197* 30:lan[guage] 31:lan[guage] mes[sages] 32:lan[guage] cty[pe] 33:lan[guage] tim[e] 34:lan[guage] col[late] 35 Print the current language (aka locale). 36 With the "messages" argument the language used for 37 messages is printed. Technical: LC_MESSAGES. 38 With the "ctype" argument the language used for 39 character encoding is printed. Technical: LC_CTYPE. 40 With the "time" argument the language used for 41 strftime() is printed. Technical: LC_TIME. 42 With the "collate" argument the language used for 43 collation order is printed. Technical: LC_COLLATE. 44 Without argument all parts of the locale are printed 45 (this is system dependent). 46 The current language can also be obtained with the 47 |v:lang|, |v:ctype|, |v:collate| and |v:lc_time| 48 variables. 49 50:lan[guage] {name} 51:lan[guage] mes[sages] {name} 52:lan[guage] cty[pe] {name} 53:lan[guage] tim[e] {name} 54:lan[guage] col[late] {name} 55 Set the current language (aka locale) to {name}. 56 The locale {name} must be a valid locale on your 57 system. Some systems accept aliases like "en" or 58 "en_US", but some only accept the full specification 59 like "en_US.ISO_8859-1". On Unix systems you can use 60 this command to see what locales are supported: > 61 :!locale -a 62< With the "messages" argument the language used for 63 messages is set. This can be different when you want, 64 for example, English messages while editing Japanese 65 text. This sets $LC_MESSAGES. 66 With the "ctype" argument the language used for 67 character encoding is set. This affects the libraries 68 that Vim was linked with. It's unusual to set this to 69 a different value from 'encoding' or "C". This sets 70 $LC_CTYPE. 71 With the "time" argument the language used for time 72 and date messages is set. This affects strftime(). 73 This sets $LC_TIME. 74 With the "collate" argument the language used for the 75 collation order is set. This affects sorting of 76 characters. This sets $LC_COLLATE. 77 Without an argument all are set, and additionally 78 $LANG is set. 79 The LC_NUMERIC value will always be set to "C" so 80 that floating point numbers use '.' as the decimal 81 point. This will make a difference for items that 82 depend on the language (some messages, time and date 83 format). 84 Not fully supported on all systems. 85 If this fails there will be an error message. If it 86 succeeds there is no message. Example: > 87 :language 88 Current language: C 89 :language de_DE.ISO_8859-1 90 :language mes 91 Current messages language: de_DE.ISO_8859-1 92 :lang mes en 93< 94 95Message files (vim.mo) have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", 96where "xx" is the abbreviation of the language (mostly two letters). If you 97write your own translations you need to generate the .po file and convert it 98to a .mo file. 99 100To overrule the automatic choice of the language, set the $LANG variable to 101the language of your choice. use "en" to disable translations. > 102 103 :let $LANG = 'ja' 104 105(text for Windows by Muraoka Taro) 106 107============================================================================== 1082. Menus *multilang-menus* 109 110See |45.2| for the basics, esp. using 'langmenu'. 111 112Note that if changes have been made to the menus after the translation was 113done, some of the menus may be shown in English. Please try contacting the 114maintainer of the translation and ask him to update it. You can find the 115name and e-mail address of the translator in 116"$VIMRUNTIME/lang/menu_<lang>.vim". 117 118To set the font to use for the menus, use the |:highlight| command. Example: > 119 120 :highlight Menu font=k12,r12 121 122 123ALIAS LOCALE NAMES 124 125Unfortunately, the locale names are different on various systems, even though 126they are for the same language and encoding. If you do not get the menu 127translations you expected, check the output of this command: > 128 129 echo v:lang 130 131Now check the "$VIMRUNTIME/lang" directory for menu translation files that use 132a similar language. A difference in a "-" being a "_" already causes a file 133not to be found! Another common difference to watch out for is "iso8859-1" 134versus "iso_8859-1". Fortunately Vim makes all names lowercase, thus you 135don't have to worry about case differences. Spaces are changed to 136underscores, to avoid having to escape them. 137 138If you find a menu translation file for your language with a different name, 139create a file in your own runtime directory to load that one. The name of 140that file could be: > 141 142 ~/.config/nvim/lang/menu_<v:lang>.vim 143 144Check the 'runtimepath' option for directories which are searched. In that 145file put a command to load the menu file with the other name: > 146 147 runtime lang/menu_<other_lang>.vim 148 149 150TRANSLATING MENUS 151 152If you want to do your own translations, you can use the |:menutrans| command, 153explained below. It is recommended to put the translations for one language 154in a Vim script. For a language that has no translation yet, please consider 155becoming the maintainer and make your translations available to all Vim users. 156Send an e-mail to the Vim maintainer <maintainer@vim.org>. 157 158 *:menut* *:menutrans* *:menutranslate* 159:menut[ranslate] clear 160 Clear all menu translations. 161 162:menut[ranslate] {english} {mylang} 163 Translate menu name {english} to {mylang}. All 164 special characters like "&" and "<Tab>" need to be 165 included. Spaces and dots need to be escaped with a 166 backslash, just like in other |:menu| commands. 167 Case in {english} is ignored. 168 169See the $VIMRUNTIME/lang directory for examples. 170 171To try out your translations you first have to remove all menus. This is how 172you can do it without restarting Vim: > 173 :source $VIMRUNTIME/delmenu.vim 174 :source <your-new-menu-file> 175 :source $VIMRUNTIME/menu.vim 176 177Each part of a menu path is translated separately. The result is that when 178"Help" is translated to "Hilfe" and "Overview" to "Überblick" then 179"Help.Overview" will be translated to "Hilfe.Überblick". 180 181============================================================================== 1823. Scripts *multilang-scripts* 183 184In Vim scripts you can use the |v:lang| variable to get the current language 185(locale). The default value is "C" or comes from the $LANG environment 186variable. 187 188The following example shows how this variable is used in a simple way, to make 189a message adapt to language preferences of the user, > 190 191 :if v:lang =~ "de_DE" 192 : echo "Guten Morgen" 193 :else 194 : echo "Good morning" 195 :endif 196< 197 198 vim:tw=78:sw=4:ts=8:noet:ft=help:norl: