On Wed, 05 Sep 2012 16:48:06 +0200, Bram Moolenaar wrote:
> 
> Alick Zhao wrote:
> 
>> On Mon, 03 Sep 2012 23:14:13 +0200, Bram Moolenaar wrote:
>>>
>>> Alick Zhao wrote:
>>>
>>>> Also there's an issue about Chinese version of vim tutor file. Nowadays
>>>> Simplified Chinese user typically use zh_CN.UTF-8 locale in Linux/Unix
>>>> systems. When they(including me) type the command 'vimtutor', they will
>>>> get tutor in Traditional Chinese. The reason is that the tutor file
>>>> 'tutor.zh.utf-8' is in Traditional Chinese, and there is no Simplified
>>>> Chinese UTF-8 version. I see in the manual that language is a two-letter
>>>> name, but I don't think *two*-letter is required indeed. Is it so? Can
>>>> we have separate tutor files 'tutor.zh_cn.utf-8' and
>>>> 'tutor.zh_tw.utf-8', like the case in gui menu translation?
>>>
>>> We definitely need two Chinese tutors.  Calling them with the five
>>> letter name is appropriate.
>>>
>>> This requires changing tutor/tutor.vim.  Currently it cuts off
>>> everything after the first two characters in line 44.  That will require
>>> some work.  Probably by using s:lang around line 78, where Chinese is
>>> handled.  That avoids having to change much in the rest of the file.
>>>
>>
>> Use iconv to get a usable (a bit outdated though) 'tutor.zh_cn.utf-8':
>>
>>   iconv -f CP936 -t UTF-8 tutor.zh.euc > tutor.zh_cn.utf8
>>
>> And rename tutor.zh.utf-8 to tutor.zh_tw.utf-8 (to be more consistent).
>>
>> And then with the following patch the issue should be fixed.
>> (Last change info at line 4 of tutor.vim should be updated too.)
>>
>> --- tutor.vim.bak    2012-09-04 21:15:23.330111701 +0800
>> +++ tutor.vim        2012-09-04 21:57:46.597714283 +0800
>> @@ -80,6 +80,12 @@
>>      let s:ext = ".zh.big5"
>>    elseif &enc != 'utf-8'
>>      let s:ext = ".zh.euc"
>> +  elseif exists("s:lang")
>> +    if s:lang =~? 'zh_cn'
>> +      let s:ext = ".zh_cn"
>> +    else
>> +      let s:ext = ".zh_tw"
>> +    endif
>>    endif
>>  endif
> 
> If we rename tutor.zh.utf-8 to tutor.zh_tw.utf-8, then we need to have a
> fallback for when s:lang is not defined.  Using the zh_cn one is the
> best guess, so this should work:
> 
> if s:ext =~? '\.zh'
>   if &enc =~ 'big5\|cp950'
>     let s:ext = ".zh.big5"
>   elseif &enc != 'utf-8'
>     let s:ext = ".zh.euc"
>   elseif exists("s:lang") && s:lang =~? 'zh_tw'
>     let s:ext = ".zh_tw"
>   else
>     let s:ext = ".zh_cn"
>   endif
> endif
> 
> Please check.
> 

If s:lang does not exist, the user should be providing lang code in the
command line, like 'vimtutor zh_tw'. This change will make 'vimtutor
zh_tw' also return a zh_cn tutor file, which is not the expected
behavior IMO.

-- 
alick
Fedora 16 (Verne) user
https://fedoraproject.org/wiki/User:Alick

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to