mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 21:40:51 +02:00
Don't Replace - in Translator
This commit is contained in:
@@ -3,7 +3,7 @@ module.exports.wordTrans = (text, words) => {
|
|||||||
let translation = [];
|
let translation = [];
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
const word = text[i].toLowerCase();
|
const word = text[i].toLowerCase();
|
||||||
const wordPuncStrip = word.replace(/[.,?!-]/g, '');
|
const wordPuncStrip = word.replace(/[.,?!]/g, '');
|
||||||
if (words[wordPuncStrip]) {
|
if (words[wordPuncStrip]) {
|
||||||
const reg = new RegExp(wordPuncStrip, 'gi');
|
const reg = new RegExp(wordPuncStrip, 'gi');
|
||||||
translation.push(word.replace(reg, words[wordPuncStrip]));
|
translation.push(word.replace(reg, words[wordPuncStrip]));
|
||||||
|
|||||||
Reference in New Issue
Block a user