diff --git a/rules/nan/nan-latn-pehoeji-transliteration.js b/rules/nan/nan-latn-pehoeji-transliteration.js new file mode 100644 index 00000000..8bec36f6 --- /dev/null +++ b/rules/nan/nan-latn-pehoeji-transliteration.js @@ -0,0 +1,115 @@ +( function ( $ ) { + 'use strict'; + + var nanLatnPehoejiTransliteration = { + id: 'nan-latn-pehoeji-transliteration', + name: '閩南語白話字IME / Bân-lâm-gú Pe̍h-ōe-jī IME', + description: 'Hokkien Pe̍h-ōe-jī Transliteration input method', + date: '2024-11-19', + URL: 'http://github.com/wikimedia/jquery.ime', + author: 'Winston Sung', + license: 'MIT', + version: '1.0', + maxKeyLength: 4, + patterns: [ + [ 'a([hi])?nn', 'a$1ⁿ' ], + [ 'a(ⁿ|iⁿ?|m|ng?|u)?1', 'a$1' ], + [ 'a(ⁿ|iⁿ?|m|ng?|u)?(2|\\\/)', 'á$1' ], + [ 'a(ⁿ|iⁿ?|m|ng?|u)?(3|\\\\)', 'à$1' ], + [ 'a(p|t|k|hⁿ?|uh)4', 'a$1' ], + [ 'a(ⁿ|iⁿ?|m|ng?|u)?(5|\\\^)', 'â$1' ], + [ 'a(ⁿ|iⁿ?|m|ng?|u)?(6|~)', 'ã$1' ], + [ 'a(ⁿ|iⁿ?|m|ng?|u)?(7|_)', 'ā$1' ], + [ 'a(p|t|k|hⁿ?|uh)(8|\')', 'a̍$1' ], + [ 'e(h)?nn', 'e$1ⁿ' ], + [ 'e(ⁿ|ng)1', 'e$1' ], + [ 'e(ⁿ|ng)(2|\\\/)', 'é$1' ], + [ 'e(ⁿ|ng)(3|\\\\)', 'è$1' ], + [ 'e(hⁿ?|k)4', 'e$1' ], + [ 'e(ⁿ|ng)(5|\\\^)', 'ê$1' ], + [ 'e(ⁿ|ng)(6|~)', 'ẽ$1' ], + [ 'e(ⁿ|ng)(7|_)', 'ē$1' ], + [ 'e(hⁿ?|k)(8|\')', 'e̍$1' ], + [ 'i(a[hu]?)?nn', 'i$1ⁿ' ], + [ 'ia(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], + [ 'o͘(7|_)', 'ō͘' ], + [ 'o͘h(8|\')', 'o̍͘h' ], + [ 'u(i|n)?1', 'u$1' ], + [ 'u(i|n)?(2|\\\/)', 'ú$1' ], + [ 'u(i|n)?(3|\\\\)', 'ù$1' ], + [ 'u(h|t)4', 'u$1' ], + [ 'u(i|n)?(5|\\\^)', 'û$1' ], + [ 'u(i|n)?(6|~)', 'ũ$1' ], + [ 'u(i|n)?(7|_)', 'ū$1' ], + [ 'u(h|t)(8|\')', 'u̍$1' ], + ] + }; + + $.ime.register( nanLatnPehoejiTransliteration ); +}( jQuery ) ); diff --git a/src/jquery.ime.inputmethods.js b/src/jquery.ime.inputmethods.js index b8035a29..61e0b433 100755 --- a/src/jquery.ime.inputmethods.js +++ b/src/jquery.ime.inputmethods.js @@ -734,6 +734,10 @@ name: 'မြန်မာဘာသာ xkb', source: 'rules/my/my-xkb.js' }, + 'nan-latn-pehoeji-transliteration': { + name: '閩南語白話字IME / Bân-lâm-gú Pe̍h-ōe-jī IME', + source: 'rules/nan/nan-latn-pehoeji-transliteration.js' + }, 'nb-normforms': { name: 'Normal transliterasjon', source: 'rules/nb/nb-normforms.js' @@ -1618,6 +1622,26 @@ autonym: 'မြန်မာ', inputmethods: [ 'my-mm3', 'my-xkb' ] }, + nan: { + autonym: '閩南語 / Bân-lâm-gú', + inputmethods: [ 'nan-latn-pehoeji-transliteration' ] + }, + 'nan-hani': { + autonym: '閩南語(漢字)', + inputmethods: [ 'nan-latn-pehoeji-transliteration' ] + }, + 'nan-hant': { + autonym: '閩南語(傳統漢字)', + inputmethods: [ 'nan-latn-pehoeji-transliteration' ] + }, + 'nan-latn-pehoeji': { + autonym: 'Bân-lâm-gú (Pe̍h-ōe-jī)', + inputmethods: [ 'nan-latn-pehoeji-transliteration' ] + }, + 'nan-latn-tailo': { + autonym: 'Bân-lâm-gú (Tâi-lô)', + inputmethods: [ 'nan-latn-pehoeji-transliteration' ] + }, naq: { autonym: 'Khoekhoegowab', inputmethods: [ 'mul-click-tilde' ] diff --git a/test/jquery.ime.test.fixtures.js b/test/jquery.ime.test.fixtures.js index 5b5af7f0..50b1f0da 100644 --- a/test/jquery.ime.test.fixtures.js +++ b/test/jquery.ime.test.fixtures.js @@ -5132,6 +5132,33 @@ var palochkaVariants = { { input: '!@#$%^&*()', output: 'ဍၒဋၓၔၕရ*()', description: 'Myanmar xkb !@#$%^&*()' } ] }, + { + description: 'Hokkien Pe̍h-ōe-jī test', + inputmethod: 'nan-latn-pehoeji-transliteration', + tests: [ + { input: 'an', output: 'an', description: 'Hokkien Pe̍h-ōe-jī an' }, + { input: 'ann', output: 'aⁿ', description: 'Hokkien Pe̍h-ōe-jī aⁿ' }, + { input: 'ann1', output: 'aⁿ', description: 'Hokkien Pe̍h-ōe-jī aⁿ' }, + { input: 'aⁿ1', output: 'aⁿ', description: 'Hokkien Pe̍h-ōe-jī aⁿ' }, + { input: 'ann2', output: 'áⁿ', description: 'Hokkien Pe̍h-ōe-jī áⁿ' }, + { input: 'ann/', output: 'áⁿ', description: 'Hokkien Pe̍h-ōe-jī áⁿ' }, + { input: 'a2nn', output: 'áⁿ', description: 'Hokkien Pe̍h-ōe-jī áⁿ' }, + { input: 'a/nn', output: 'áⁿ', description: 'Hokkien Pe̍h-ōe-jī áⁿ' }, + { input: 'ann3', output: 'àⁿ', description: 'Hokkien Pe̍h-ōe-jī àⁿ' }, + { input: 'ann\\', output: 'àⁿ', description: 'Hokkien Pe̍h-ōe-jī àⁿ' }, + { input: 'ap4', output: 'ap', description: 'Hokkien Pe̍h-ōe-jī ap' }, + { input: 'ann5', output: 'âⁿ', description: 'Hokkien Pe̍h-ōe-jī âⁿ' }, + { input: 'ann^', output: 'âⁿ', description: 'Hokkien Pe̍h-ōe-jī âⁿ' }, + { input: 'ann6', output: 'ãⁿ', description: 'Hokkien Pe̍h-ōe-jī ãⁿ' }, + { input: 'ann~', output: 'ãⁿ', description: 'Hokkien Pe̍h-ōe-jī ãⁿ' }, + { input: 'ann7', output: 'āⁿ', description: 'Hokkien Pe̍h-ōe-jī āⁿ' }, + { input: 'ann_', output: 'āⁿ', description: 'Hokkien Pe̍h-ōe-jī āⁿ' }, + { input: 'ap8', output: 'a̍p', description: 'Hokkien Pe̍h-ōe-jī a̍p' }, + { input: 'ap\'', output: 'a̍p', description: 'Hokkien Pe̍h-ōe-jī a̍p' }, + { input: 'khoann3', output: 'khòaⁿ', description: 'Hokkien Pe̍h-ōe-jī khòaⁿ' }, + { input: 'khoai3', output: 'khoài', description: 'Hokkien Pe̍h-ōe-jī khoài' } + ] + }, { description: 'Nepali Romanized test', inputmethod: 'ne-rom',