Skip to content

catch up 7.4.1175 #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/src/po/vim.pot
/src/po/*.po.old
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# How to contribute

## 統一済み訳語

訳語 |根拠
----------------|-----------------------------------------------------------
サーバー |[※1](#note1)
ユーザー |[※1](#note1)

## 資料

* [Vimマニュアル翻訳: vim-jp/vimdoc-ja](https://github.com/vim-jp/vimdoc-ja)
* [外来語の表記: 内閣告示第二号](http://www.mext.go.jp/b_menu/hakusho/nc/k19910628002/k19910628002.html)

> 英語の語末の‐er, ‐or, ‐arなどに当たるものは,原則としてア列の長音とし長音符号「ー」を用いて書き表す。 (<a name="note1>※1</a>
40 changes: 38 additions & 2 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,42 @@ runtime/lang/menu\_ja\_jp.utf-8.vim |Vimの日本語メニューファイルの

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

## 更新手順
## ja.po 更新手順

(TODO: そのうち書く)
1. vim.pot を作成(要xgettext)

Vimのソースで以下を実行して、生成される vim.pot を src/po へコピー

$ cd src/po
$ make vim.pot

2. ja.po に vim.pot をマージ (古いのは ja.po.old へ退避)

$ mv ja.po ja.po.old
$ msgmerge ja.po.old vim.pot -o ja.po

3. ja.po のコピーライトやヘッダーを適宜修正

これはPRを作るだけの場合は、やらないほうが良いかも。

4. 翻訳する

Vimを使って下記の検索コマンドで翻訳すべき場所を探すと良い。

/fuzzy\|^msgstr ""\(\n"\)\@!

5. 不要な情報の削除

Vim で以下のようにする。

:source cleanup.vim

cleanup.vim は Vim 本体からのコピー

6. チェック

$ vim -S check.vim ja.po

7. euc-jp と sjis 版の作成

本来なら自動化すべきところなので、今は忘れて良い。
7 changes: 4 additions & 3 deletions runtime/lang/menu_ja_jp.utf-8.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"
" Menu Translations: Japanese (UTF-8)
" Translated By: MURAOKA Taro <[email protected]>
" Last Change: 12-May-2013.
" Last Change: 26-Jan-2016.
"
" Copyright (C) 2001-13 MURAOKA Taro <[email protected]>
" Copyright (C) 2001-16 MURAOKA Taro <[email protected]>
" Copyright (C) 2016 vim-jp (http://vim-jp.org/)
" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.

" Quit when menu translations have already been done.
Expand All @@ -20,7 +21,7 @@ scriptencoding utf-8
" Help menu
menutrans &Help ヘルプ(&H)
menutrans &Overview<Tab><F1> 概略(&O)<Tab><F1>
menutrans &User\ Manual ユーザマニュアル(&U)
menutrans &User\ Manual ユーザーマニュアル(&U)
menutrans &How-to\ links &How-toリンク
menutrans &Credits クレジット(&C)
menutrans Co&pying 著作権情報(&P)
Expand Down
88 changes: 88 additions & 0 deletions src/po/check.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
" Vim script for checking .po files.
"
" Go through the file and verify that:
" - All %...s items in "msgid" are identical to the ones in "msgstr".
" - An error or warning code in "msgid" matches the one in "msgstr".

if 1 " Only execute this if the eval feature is available.

" Function to get a split line at the cursor.
" Used for both msgid and msgstr lines.
" Removes all text except % items and returns the result.
func! GetMline()
let idline = substitute(getline('.'), '"\(.*\)"$', '\1', '')
while line('.') < line('$')
+
let line = getline('.')
if line[0] != '"'
break
endif
let idline .= substitute(line, '"\(.*\)"$', '\1', '')
endwhile

" remove '%', not used for formatting.
let idline = substitute(idline, "'%'", '', 'g')

" remove '%' used for plural forms.
let idline = substitute(idline, '\\nPlural-Forms: .\+;\\n', '', '')

" remove everything but % items.
return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g')
endfunc

" This only works when 'wrapscan' is set.
let s:save_wrapscan = &wrapscan
set wrapscan

" Start at the first "msgid" line.
1
/^msgid
let startline = line('.')
let error = 0

while 1
if getline(line('.') - 1) !~ "no-c-format"
let fromline = GetMline()
if getline('.') !~ '^msgstr'
echo 'Missing "msgstr" in line ' . line('.')
let error = 1
endif
let toline = GetMline()
if fromline != toline
echo 'Mismatching % in line ' . (line('.') - 1)
echo 'msgid: ' . fromline
echo 'msgstr: ' . toline
let error = 1
endif
endif

" Find next msgid.
" Wrap around at the end of the file, quit when back at the first one.
/^msgid
if line('.') == startline
break
endif
endwhile

" Check that error code in msgid matches the one in msgstr.
"
" Examples of mismatches found with msgid "E123: ..."
" - msgstr "E321: ..." error code mismatch
" - msgstr "W123: ..." warning instead of error
" - msgstr "E123 ..." missing colon
" - msgstr "..." missing error code
"
1
if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0
echo 'Mismatching error/warning code in line ' . line('.')
let error = 1
endif

if error == 0
echo "OK"
endif

let &wrapscan = s:save_wrapscan
unlet s:save_wrapscan

endif
19 changes: 19 additions & 0 deletions src/po/cleanup.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
" Vim script to cleanup a .po file:
" - Remove line numbers (avoids that diffs are messy).
" - Comment-out fuzzy and empty messages.
" - Make sure there is a space before the string (required for Solaris).
" Requires Vim 6.0 or later (because of multi-line search patterns).

" Disable diff mode, because it makes this very slow
let s:was_diff = &diff
setl nodiff

silent g/^#: /d
silent g/^#, fuzzy\(, .*\)\=\nmsgid ""\@!/.+1,/^$/-1s/^/#\~ /
silent g/^msgstr"/s//msgstr "/
silent g/^msgid"/s//msgid "/
silent g/^msgstr ""\(\n"\)\@!/?^msgid?,.s/^/#\~ /

if s:was_diff
setl diff
endif
Loading