Skip to content

Commit b5a3510

Browse files
committed
Add options and capitalization for Japanese.
1 parent 7213cda commit b5a3510

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

scriptshifter/hooks/japanese/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ def s2r_post_config(ctx, src_code):
1919
if src_code not in "HKJ":
2020
raise ValueError(f"Source script code {src_code} not supported.")
2121
trans.setMode(src_code, "a")
22-
# TODO Use option switch: “Hepburn” , “Kunrei” or “Passport”
23-
trans.setMode("r", "Hepburn")
24-
trans.setMode("C", ctx.options["capitalize"] is not False)
22+
trans.setMode("r", ctx.options.get("table", "Hepburn"))
23+
trans.setMode("s", True)
24+
# Both "first" and "all" behave as "all".
25+
trans.setMode("C", not not ctx.options.get("capitalize", False))
2526

2627
ctx.dest = trans.getConverter().do(ctx.src)
2728

scriptshifter/tables/data/japanese_hiragana.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ general:
66
version: 2.0.0
77
date: 2026-02-11
88

9+
options:
10+
- id: table
11+
label: Romanization table
12+
description: Romanization table used for transliteration.
13+
type: list
14+
options:
15+
- id: Hepburn
16+
label: Hepburn
17+
- id: Kunrei
18+
label: Kunrei
19+
- id: Passport
20+
label: Passport
21+
default: Hepburn
22+
923
script_to_roman:
1024
hooks:
1125
post_config:

scriptshifter/tables/data/japanese_kanji.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ general:
66
version: 1.0.0
77
date: 2026-02-11
88

9+
options:
10+
- id: table
11+
label: Romanization table
12+
description: Romanization table used for transliteration.
13+
type: list
14+
options:
15+
- id: Hepburn
16+
label: Hepburn
17+
- id: Kunrei
18+
label: Kunrei
19+
- id: Passport
20+
label: Passport
21+
default: Hepburn
22+
923
script_to_roman:
1024
hooks:
1125
post_config:

scriptshifter/tables/data/japanese_katakana.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ general:
66
version: 2.0.0
77
date: 2026-02-11
88

9+
options:
10+
- id: table
11+
label: Romanization table
12+
description: Romanization table used for transliteration.
13+
type: list
14+
options:
15+
- id: Hepburn
16+
label: Hepburn
17+
- id: Kunrei
18+
label: Kunrei
19+
- id: Passport
20+
label: Passport
21+
default: Hepburn
22+
923
script_to_roman:
1024
hooks:
1125
post_config:

0 commit comments

Comments
 (0)