* Based on: https://hg.mozilla.org/mozilla-central/file/a1f74e8c8fb72390d22054d6b00c28b1a32f6c43/intl/l10n/L10nRegistry.jsm#l425
( map: PseudoLocaleTransformMap, elongate = false, msg: string )
| 100 | * Based on: https://hg.mozilla.org/mozilla-central/file/a1f74e8c8fb72390d22054d6b00c28b1a32f6c43/intl/l10n/L10nRegistry.jsm#l425 |
| 101 | */ |
| 102 | function transformString( |
| 103 | map: PseudoLocaleTransformMap, |
| 104 | elongate = false, |
| 105 | msg: string |
| 106 | ) { |
| 107 | return msg.replace(/[a-z]/gi, ch => { |
| 108 | const cc = ch.charCodeAt(0) |
| 109 | if (cc >= 97 && cc <= 122) { |
| 110 | const newChar = String.fromCodePoint(map.small[cc - 97]) |
| 111 | // duplicate "a", "e", "o" and "u" to emulate ~30% longer text |
| 112 | if (elongate && (cc === 97 || cc === 101 || cc === 111 || cc === 117)) { |
| 113 | return newChar + newChar |
| 114 | } |
| 115 | return newChar |
| 116 | } |
| 117 | if (cc >= 65 && cc <= 90) { |
| 118 | return String.fromCodePoint(map.caps[cc - 65]) |
| 119 | } |
| 120 | return ch |
| 121 | }) |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * accented - Ȧȧƈƈḗḗƞŧḗḗḓ Ḗḗƞɠŀīīşħ |
no outgoing calls
no test coverage detected