Updated translation support
This commit is contained in:
parent
b1e8cd68cd
commit
d25565b6f8
114 changed files with 42095 additions and 1902 deletions
26
lib/fakelang.js
Normal file
26
lib/fakelang.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
/* lloyd|2012|http://wtfpl.org */
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
module.exports = str => {
|
||||
let from = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+\\|`~[{]};:'\",<.>/?";
|
||||
let to = "ɐqɔpǝɟƃɥıɾʞʅɯuodbɹsʇnʌʍxʎz∀ԐↃᗡƎℲ⅁HIſӼ⅂WNOԀÒᴚS⊥∩ɅMX⅄Z0123456789¡@#$%ᵥ⅋⁎()-_=+\\|,~[{]};:,„´<.>/¿";
|
||||
|
||||
return str.replace(/(\{\{[^\}]+\}\}|%s)/g, '\x00\x04$1\x00').split('\x00').map(c => {
|
||||
if (c.charAt(0) === '\x04') {
|
||||
return c;
|
||||
}
|
||||
let r = '';
|
||||
for (let i = 0, len = c.length; i < len; i++) {
|
||||
let pos = from.indexOf(c.charAt(i));
|
||||
if (pos < 0) {
|
||||
r += c.charAt(i);
|
||||
} else {
|
||||
r += to.charAt(pos);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}).join('\x00').replace(/[\x00\x04]/g, '');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue