Skip to content
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

toRomaji custom mapping not always respected #167

Open
1 of 2 tasks
gmarty opened this issue Nov 7, 2023 · 0 comments
Open
1 of 2 tasks

toRomaji custom mapping not always respected #167

gmarty opened this issue Nov 7, 2023 · 0 comments

Comments

@gmarty
Copy link

gmarty commented Nov 7, 2023

Issue Type

Description

I an trying to use WanaKana to transliterate hiragana to romaji using the Hepburn romanisation system.
I have configured a custom mapping. There are cases where the custom mapping is not respected.

Steps to reproduce

const customRomajiMapping = {
  うう: 'û',
  おう: 'ô',
  くう: 'kû',
  こう: 'kô',
  すう: 'sû',
  そう: 'sô',
  つう: 'tsû',
  とう: 'tô',
  ぬう: 'nû',
  のう: 'nô',
  ふう: 'fû',
  ほう: 'hô',
  むう: 'mû',
  もう: 'mô',
  ゆう: 'yû',
  よう: 'yô',
  ろう: 'rû',
  ろう: 'rô',
  ぐう: 'gû',
  ごう: 'gô',
  ずう: 'zû',
  ぞう: 'zô',
  づう: 'zû',
  どう: 'dô',
  ぶう: 'bû',
  ぼう: 'bô',
  ぷう: 'pû',
  ぽう: 'pô',
  きゅう: 'kyû',
  きょう: 'kyô',
  しゅう: 'shû',
  しょう: 'shô',
  ちゅう: 'chû',
  ちょう: 'chô',
  にゅう: 'nyû',
  にょう: 'nyô',
  ひゅう: 'hyû',
  ひょう: 'hyô',
  みゅう: 'myû',
  みょう: 'myô',
  りゅう: 'ryû',
  りょう: 'ryô',
  ぎゅう: 'gyû',
  ぎょう: 'gyô',
  じゅう: 'jû',
  じょう: 'jô',
  ぢゅう: 'jû',
  ぢょう: 'jô',
  びゅう: 'byû',
  びょう: 'byô',
  ぴゅう: 'pyû',
  ぴょう: 'pyô',
}
name = toRomaji('こういち', { customRomajiMapping }) // Returns 'Kôichi' (correct)
name = toRomaji('いっこう', { customRomajiMapping }) // Returns 'Ikkou'
name = toRomaji('ゆうじ', { customRomajiMapping }) // Returns 'Yûji' (correct)
name = toRomaji('けんゆう', { customRomajiMapping }) // Returns 'Ken'yuu'

It seems that 'っ' or an apostrophe before the pattern trips it and the transliteration fails.

Versions

  • Browser: Node 20
  • OS/Device: Mac
  • Keyboard/Input Method: UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant