Skip to content

Commit

Permalink
Add nan-latn-pehoeji-transliteration IME (#814)
Browse files Browse the repository at this point in the history
Bug: #814
Change-Id: I6851b9df495e52bd15ac11ac464cb67d03840e25

Co-authored-by: SrishAkaTux <[email protected]>
  • Loading branch information
winstonsung and srish authored Nov 20, 2024
1 parent e82467e commit 805d7d7
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 0 deletions.
115 changes: 115 additions & 0 deletions rules/nan/nan-latn-pehoeji-transliteration.js
Original file line number Diff line number Diff line change
@@ -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|á|à|â|ã|ā|a̍)[hi]?)nn', '$1ⁿ' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?1', '$1a$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(2|\\\/)', '$1á$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(3|\\\\)', '$1à$2' ],
[ '(^|[^io])a(p|t|k|hⁿ?|uh)4', '$1a$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(5|\\\^)', '$1â$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(6|~)', '$1ã$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(7|_)', '$1ā$2' ],
[ '(^|[^io])a(p|t|k|hⁿ?|uh)(8|\')', '$1a̍$2' ],
[ '(e|é|è|eh|ê|ẽ|ē|e̍h)?nn', '$1$2ⁿ' ],
[ '(^|[^o])e(ⁿ|ng)1', '$1e$2' ],
[ '(^|[^o])e(ⁿ|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|[^i])o(ⁿ|aⁿ?|e|m|ng)?(3|\\\\)', '$1ò$2' ],
[ '(^|[^i])o(hⁿ?|k)4', '$1o$2' ],
[ '(^|[^i])oeh4', '$1oeh' ],
[ '(^|[^i])oa(h|iⁿ?|ng?|t)?(5|\\\^)', '$1oâ$2' ],
[ '(^|[^i])o(ⁿ|aⁿ?|e|m|ng)?(5|\\\^)', '$1ô$2' ],
[ '(^|[^i])oa(h|iⁿ?|ng?|t)?(6|~)', '$1oã$2' ],
[ '(^|[^i])o(ⁿ|aⁿ?|e|m|ng)?(6|~)', '$1õ$2' ],
[ '(^|[^i])oa(h|iⁿ?|ng?|t)?(7|_)', '$1oā$2' ],
[ '(^|[^i])o(ⁿ|aⁿ?|e|m|ng)?(7|_)', '$1ō$2' ],
[ '(^|[^i])o(hⁿ?|k)(8|\')', '$1o̍$2' ],
[ '(^|[^i])oeh8', '$1oe̍h' ],
[ 'o͘1', 'o͘' ],
[ 'o͘(2|\\\/)', 'ó͘' ],
[ 'o͘(3|\\\\)', 'ò͘' ],
[ 'o͘h4', 'o͘h' ],
[ 'o͘(5|\\\^)', 'ô͘' ],
[ 'o͘(6|~)', 'õ͘' ],
[ 'o͘(7|_)', 'ō͘' ],
[ 'o͘h(8|\')', 'o̍͘h' ],
[ '(^|[^ai])u(i|n)?1', '$1u$2' ],
[ '(^|[^ai])u(i|n)?(2|\\\/)', '$1ú$2' ],
[ '(^|[^ai])u(i|n)?(3|\\\\)', '$1ù$2' ],
[ '(^|[^ai])u(h|t)4', '$1u$2' ],
[ '(^|[^ai])u(i|n)?(5|\\\^)', '$1û$2' ],
[ '(^|[^ai])u(i|n)?(6|~)', '$1ũ$2' ],
[ '(^|[^ai])u(i|n)?(7|_)', '$1ū$2' ],
[ '(^|[^ai])u(h|t)(8|\')', '$1u̍$2' ],
]
};

$.ime.register( nanLatnPehoejiTransliteration );
}( jQuery ) );
24 changes: 24 additions & 0 deletions src/jquery.ime.inputmethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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' ]
Expand Down
28 changes: 28 additions & 0 deletions test/jquery.ime.test.fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -5132,6 +5132,34 @@ 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' },
{ input: 'kong3', output: 'kòng', description: 'Hokkien Pe̍h-ōe-jī kòng' }
]
},
{
description: 'Nepali Romanized test',
inputmethod: 'ne-rom',
Expand Down

0 comments on commit 805d7d7

Please sign in to comment.