Skip to content

Commit d1eb3a4

Browse files
committed
Merge pull request #16 from vim-jp/catchup-7.4.1175
catch up 7.4.1175
2 parents 31688a0 + 99ea75c commit d1eb3a4

File tree

7 files changed

+377
-116
lines changed

7 files changed

+377
-116
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/src/po/vim.pot
2+
/src/po/*.po.old

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# How to contribute
2+
3+
## 統一済み訳語
4+
5+
訳語 |根拠
6+
----------------|-----------------------------------------------------------
7+
サーバー |[※1](#note1)
8+
ユーザー |[※1](#note1)
9+
10+
## 資料
11+
12+
* [Vimマニュアル翻訳: vim-jp/vimdoc-ja](https://github.com/vim-jp/vimdoc-ja)
13+
* [外来語の表記: 内閣告示第二号](http://www.mext.go.jp/b_menu/hakusho/nc/k19910628002/k19910628002.html)
14+
15+
> 英語の語末の‐er, ‐or, ‐arなどに当たるものは,原則としてア列の長音とし長音符号「ー」を用いて書き表す。 (<a name="note1>※1</a>

README.mkd

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,42 @@ runtime/lang/menu\_ja\_jp.utf-8.vim |Vimの日本語メニューファイルの
1313

1414
src/po/ 及び runtime/lang/ 配下の、上記以外のファイルは基本的にマスターから変換するものなので通常直接は編集しないでください。
1515

16-
## 更新手順
16+
## ja.po 更新手順
1717

18-
(TODO: そのうち書く)
18+
1. vim.pot を作成(要xgettext)
19+
20+
Vimのソースで以下を実行して、生成される vim.pot を src/po へコピー
21+
22+
$ cd src/po
23+
$ make vim.pot
24+
25+
2. ja.po に vim.pot をマージ (古いのは ja.po.old へ退避)
26+
27+
$ mv ja.po ja.po.old
28+
$ msgmerge ja.po.old vim.pot -o ja.po
29+
30+
3. ja.po のコピーライトやヘッダーを適宜修正
31+
32+
これはPRを作るだけの場合は、やらないほうが良いかも。
33+
34+
4. 翻訳する
35+
36+
Vimを使って下記の検索コマンドで翻訳すべき場所を探すと良い。
37+
38+
/fuzzy\|^msgstr ""\(\n"\)\@!
39+
40+
5. 不要な情報の削除
41+
42+
Vim で以下のようにする。
43+
44+
:source cleanup.vim
45+
46+
cleanup.vim は Vim 本体からのコピー
47+
48+
6. チェック
49+
50+
$ vim -S check.vim ja.po
51+
52+
7. euc-jp と sjis 版の作成
53+
54+
本来なら自動化すべきところなので、今は忘れて良い。

runtime/lang/menu_ja_jp.utf-8.vim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"
33
" Menu Translations: Japanese (UTF-8)
44
" Translated By: MURAOKA Taro <[email protected]>
5-
" Last Change: 12-May-2013.
5+
" Last Change: 26-Jan-2016.
66
"
7-
" Copyright (C) 2001-13 MURAOKA Taro <[email protected]>
7+
" Copyright (C) 2001-16 MURAOKA Taro <[email protected]>
8+
" Copyright (C) 2016 vim-jp (http://vim-jp.org/)
89
" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
910

1011
" Quit when menu translations have already been done.
@@ -20,7 +21,7 @@ scriptencoding utf-8
2021
" Help menu
2122
menutrans &Help ヘルプ(&H)
2223
menutrans &Overview<Tab><F1> 概略(&O)<Tab><F1>
23-
menutrans &User\ Manual ユーザマニュアル(&U)
24+
menutrans &User\ Manual ユーザーマニュアル(&U)
2425
menutrans &How-to\ links &How-toリンク
2526
menutrans &Credits クレジット(&C)
2627
menutrans Co&pying 著作権情報(&P)

src/po/check.vim

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
" Vim script for checking .po files.
2+
"
3+
" Go through the file and verify that:
4+
" - All %...s items in "msgid" are identical to the ones in "msgstr".
5+
" - An error or warning code in "msgid" matches the one in "msgstr".
6+
7+
if 1 " Only execute this if the eval feature is available.
8+
9+
" Function to get a split line at the cursor.
10+
" Used for both msgid and msgstr lines.
11+
" Removes all text except % items and returns the result.
12+
func! GetMline()
13+
let idline = substitute(getline('.'), '"\(.*\)"$', '\1', '')
14+
while line('.') < line('$')
15+
+
16+
let line = getline('.')
17+
if line[0] != '"'
18+
break
19+
endif
20+
let idline .= substitute(line, '"\(.*\)"$', '\1', '')
21+
endwhile
22+
23+
" remove '%', not used for formatting.
24+
let idline = substitute(idline, "'%'", '', 'g')
25+
26+
" remove '%' used for plural forms.
27+
let idline = substitute(idline, '\\nPlural-Forms: .\+;\\n', '', '')
28+
29+
" remove everything but % items.
30+
return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g')
31+
endfunc
32+
33+
" This only works when 'wrapscan' is set.
34+
let s:save_wrapscan = &wrapscan
35+
set wrapscan
36+
37+
" Start at the first "msgid" line.
38+
1
39+
/^msgid
40+
let startline = line('.')
41+
let error = 0
42+
43+
while 1
44+
if getline(line('.') - 1) !~ "no-c-format"
45+
let fromline = GetMline()
46+
if getline('.') !~ '^msgstr'
47+
echo 'Missing "msgstr" in line ' . line('.')
48+
let error = 1
49+
endif
50+
let toline = GetMline()
51+
if fromline != toline
52+
echo 'Mismatching % in line ' . (line('.') - 1)
53+
echo 'msgid: ' . fromline
54+
echo 'msgstr: ' . toline
55+
let error = 1
56+
endif
57+
endif
58+
59+
" Find next msgid.
60+
" Wrap around at the end of the file, quit when back at the first one.
61+
/^msgid
62+
if line('.') == startline
63+
break
64+
endif
65+
endwhile
66+
67+
" Check that error code in msgid matches the one in msgstr.
68+
"
69+
" Examples of mismatches found with msgid "E123: ..."
70+
" - msgstr "E321: ..." error code mismatch
71+
" - msgstr "W123: ..." warning instead of error
72+
" - msgstr "E123 ..." missing colon
73+
" - msgstr "..." missing error code
74+
"
75+
1
76+
if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0
77+
echo 'Mismatching error/warning code in line ' . line('.')
78+
let error = 1
79+
endif
80+
81+
if error == 0
82+
echo "OK"
83+
endif
84+
85+
let &wrapscan = s:save_wrapscan
86+
unlet s:save_wrapscan
87+
88+
endif

src/po/cleanup.vim

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
" Vim script to cleanup a .po file:
2+
" - Remove line numbers (avoids that diffs are messy).
3+
" - Comment-out fuzzy and empty messages.
4+
" - Make sure there is a space before the string (required for Solaris).
5+
" Requires Vim 6.0 or later (because of multi-line search patterns).
6+
7+
" Disable diff mode, because it makes this very slow
8+
let s:was_diff = &diff
9+
setl nodiff
10+
11+
silent g/^#: /d
12+
silent g/^#, fuzzy\(, .*\)\=\nmsgid ""\@!/.+1,/^$/-1s/^/#\~ /
13+
silent g/^msgstr"/s//msgstr "/
14+
silent g/^msgid"/s//msgid "/
15+
silent g/^msgstr ""\(\n"\)\@!/?^msgid?,.s/^/#\~ /
16+
17+
if s:was_diff
18+
setl diff
19+
endif

0 commit comments

Comments
 (0)