Skip to content

Commit 82a5c3d

Browse files
committed
automate update of sjis and euc-jp ver.
part of #17
1 parent f006c91 commit 82a5c3d

File tree

6 files changed

+82
-0
lines changed

6 files changed

+82
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/src/po/*.po.bak
22
/src/po/*.po.old
33
/src/po/vim.pot
4+
/src/po/sjiscorr.exe
5+
/src/po/sjiscorr

runtime/lang/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
MASTER_MENU = menu_ja_jp.utf-8.vim
2+
3+
default: menu_ja_jp.euc-jp.vim menu_japanese_japan.932.vim
4+
5+
menu_ja_jp.euc-jp.vim: $(MASTER_MENU)
6+
iconv -f utf-8 -t euc-jp $< | \
7+
sed -e 's/^scriptencoding utf-8/scriptencoding euc-jp/' -e 's/Menu Translations:\tJapanese (UTF-8)/Menu Translations:\tJapanese (EUC-JP)/' > $@
8+
9+
menu_japanese_japan.932.vim: $(MASTER_MENU)
10+
iconv -f utf-8 -t cp932 $< | \
11+
sed -e 's/^scriptencoding utf-8/scriptencoding cp932/' -e 's/Menu Translations:\tJapanese (UTF-8)/Menu Translations:\tJapanese (CP932)/' > $@

runtime/lang/menu_ja_jp.utf-8.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
" Last Change: 28-Jan-2016.
66
"
77
" Copyright (C) 2016 vim-jp (http://vim-jp.org/)
8+
"
89
" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
910

1011
" Quit when menu translations have already been done.

src/po/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
default: ja.sjis.po ja.euc-jp.po
2+
3+
ja.sjis.po: ja.po
4+
@$(MAKE) sjiscorr
5+
rm -f ja.sjis.po
6+
iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
7+
8+
ja.euc-jp.po: ja.po
9+
iconv -f utf-8 -t euc-jp ja.po | \
10+
sed -e 's/charset=utf-8/charset=euc-jp/' -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' > ja.euc-jp.po
11+
12+
sjiscorr: sjiscorr.c
13+
$(CC) -o sjiscorr sjiscorr.c
14+
15+
clean:
16+
rm -f sjiscorr sjiscorr.exe

src/po/ja.po

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
# Do ":help credits" in Vim to see a list of people who contributed.
55
#
66
# Copyright (C) 2016 vim-jp (http://vim-jp.org/)
7+
#
78
# THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
89
#
10+
# Original translations.
11+
#
912
msgid ""
1013
msgstr ""
1114
"Project-Id-Version: Vim 7.4\n"

src/po/sjiscorr.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Simplistic program to correct SJIS inside strings. When a trail byte is a
3+
* backslash it needs to be doubled.
4+
* Public domain.
5+
*/
6+
#include <stdio.h>
7+
#include <string.h>
8+
9+
int
10+
main(argc, argv)
11+
int argc;
12+
char **argv;
13+
{
14+
char buffer[BUFSIZ];
15+
char *p;
16+
17+
while (fgets(buffer, BUFSIZ, stdin) != NULL)
18+
{
19+
for (p = buffer; *p != 0; p++)
20+
{
21+
if (strncmp(p, "charset=utf-8", 13) == 0)
22+
{
23+
fputs("charset=cp932", stdout);
24+
p += 12;
25+
}
26+
else if (strncmp(p, "# Original translations", 23) == 0)
27+
{
28+
fputs("# generated from ja.po, DO NOT EDIT", stdout);
29+
while (p[1] != '\n')
30+
++p;
31+
}
32+
else if (*(unsigned char *)p == 0x81 && p[1] == '_')
33+
{
34+
putchar('\\');
35+
++p;
36+
}
37+
else
38+
{
39+
if (*p & 0x80)
40+
{
41+
putchar(*p++);
42+
if (*p == '\\')
43+
putchar(*p);
44+
}
45+
putchar(*p);
46+
}
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)