1 " Vim tutor support file
2 " Author: Eduardo F. Amatria <eferna1@platea.pntic.mec.es>
3 " Last Change: 2007 Mar 01
5 " This small source file is used for detecting if a translation of the
6 " tutor file exist, i.e., a tutor.xx file, where xx is the language.
7 " If the translation does not exist, or no extension is given,
8 " it defaults to the english version.
10 " It is invoked by the vimtutor shell script.
12 " 1. Build the extension of the file, if any:
18 " Check that a potential value has at least two letters.
19 " Ignore "1043" and "C".
20 if exists("v:lang") && v:lang =~ '\a\a'
22 elseif $LC_ALL =~ '\a\a'
24 elseif $LANG =~ '\a\a'
28 " Remove "@euro" (ignoring case), it may be at the end
29 let s:lang = substitute(s:lang, '\c@euro', '', '')
30 " On MS-Windows it may be German_Germany.1252 or Polish_Poland.1250. How
31 " about other languages?
34 elseif s:lang =~ "Polish"
36 elseif s:lang =~ "Slovak"
38 elseif s:lang =~ "Czech"
40 elseif s:lang =~ "Dutch"
43 let s:ext = "." . strpart(s:lang, 0, 2)
48 " The japanese tutor is available in two encodings, guess which one to use
49 " The "sjis" one is actually "cp932", it doesn't matter for this text.
53 elseif &enc =~ "utf-8$"
54 let s:ext = ".ja.utf-8"
56 let s:ext = ".ja.sjis"
60 " The korean tutor is available in two encodings, guess which one to use
63 let s:ext = ".ko.utf-8"
69 " The Chinese tutor is available in two encodings, guess which one to use
70 " This segment is from the above lines and modified by
71 " Mendel L Chan <beos@turbolinux.com.cn> for Chinese vim tutorial
73 if &enc =~ 'big5\|cp950'
74 let s:ext = ".zh.big5"
80 " The Polish tutor is available in two encodings, guess which one to use.
83 let s:ext = ".pl.cp1250"
84 elseif &enc =~ "utf-8$"
85 let s:ext = ".pl.utf-8"
89 " The Turkish tutor is available in two encodings, guess which one to use
92 let s:ext = ".tr.utf-8"
93 elseif &enc == "iso-8859-9"
94 let s:ext = ".tr.iso9"
98 " The Greek tutor is available in three encodings, guess what to use.
99 " We used ".gr" (Greece) instead of ".el" (Greek); accept both.
100 if s:ext =~? '\.gr\|\.el'
101 if &enc == "iso-8859-7"
103 elseif &enc == "utf-8"
104 let s:ext = ".gr.utf-8"
106 let s:ext = ".gr.cp737"
110 " The Slovak tutor is available in three encodings, guess which one to use
113 let s:ext = ".sk.utf-8"
115 let s:ext = ".sk.cp1250"
119 " The Czech tutor is available in three encodings, guess which one to use
122 let s:ext = ".cs.utf-8"
124 let s:ext = ".cs.cp1250"
128 " The Russian tutor is available in three encodings, guess which one to use.
131 let s:ext = '.ru.utf-8'
132 elseif &enc =~ '1251'
133 let s:ext = '.ru.cp1251'
134 elseif &enc =~ 'koi8'
139 " The Hungarian tutor is available in two encodings, guess which one to use.
142 let s:ext = '.hu.utf-8'
143 elseif &enc =~ 'iso-8859-2'
148 " Somehow ".ge" (Germany) is sometimes used for ".de" (Deutsch).
157 " 2. Build the name of the file:
158 let s:tutorfile = "/tutor/tutor"
159 let s:tutorxx = $VIMRUNTIME . s:tutorfile . s:ext
161 " 3. Finding the file:
162 if filereadable(s:tutorxx)
163 let $TUTOR = s:tutorxx
165 let $TUTOR = $VIMRUNTIME . s:tutorfile
166 echo "The file " . s:tutorxx . " does not exist.\n"
167 echo "Copying English version: " . $TUTOR
171 " 4. Making the copy and exiting Vim: