ztechno_core 0.0.70 → 0.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/translate_service.js +209 -2
- package/package.json +1 -1
package/lib/translate_service.js
CHANGED
|
@@ -246,6 +246,212 @@ class ZTranslateService {
|
|
|
246
246
|
[`♀`]: `♀`,
|
|
247
247
|
[`♂`]: `♂`,
|
|
248
248
|
[`❤`]: `❤`,
|
|
249
|
+
// Arabic characters (U+0600 to U+06FF range)
|
|
250
|
+
[`؀`]: ``,
|
|
251
|
+
[`؁`]: ``,
|
|
252
|
+
[`؂`]: ``,
|
|
253
|
+
[`؃`]: ``,
|
|
254
|
+
[`؄`]: ``,
|
|
255
|
+
[`؅`]: ``,
|
|
256
|
+
[`؆`]: `؆`,
|
|
257
|
+
[`؇`]: `؇`,
|
|
258
|
+
[`؈`]: `؈`,
|
|
259
|
+
[`؉`]: `؉`,
|
|
260
|
+
[`؊`]: `؊`,
|
|
261
|
+
[`؋`]: `؋`,
|
|
262
|
+
[`،`]: `،`,
|
|
263
|
+
[`؍`]: `؍`,
|
|
264
|
+
[`؎`]: `؎`,
|
|
265
|
+
[`؏`]: `؏`,
|
|
266
|
+
[`ؐ`]: `ؐ`,
|
|
267
|
+
[`ؑ`]: `ؑ`,
|
|
268
|
+
[`ؒ`]: `ؒ`,
|
|
269
|
+
[`ؓ`]: `ؓ`,
|
|
270
|
+
[`ؔ`]: `ؔ`,
|
|
271
|
+
[`ؕ`]: `ؕ`,
|
|
272
|
+
[`ؖ`]: `ؖ`,
|
|
273
|
+
[`ؗ`]: `ؗ`,
|
|
274
|
+
[`ؘ`]: `ؘ`,
|
|
275
|
+
[`ؙ`]: `ؙ`,
|
|
276
|
+
[`ؚ`]: `ؚ`,
|
|
277
|
+
[`؛`]: `؛`,
|
|
278
|
+
[`؜`]: ``,
|
|
279
|
+
[`؝`]: `؝`,
|
|
280
|
+
[`؞`]: `؞`,
|
|
281
|
+
[`؟`]: `؟`,
|
|
282
|
+
[`ؠ`]: `ؠ`,
|
|
283
|
+
[`ء`]: `ء`,
|
|
284
|
+
[`آ`]: `آ`,
|
|
285
|
+
[`أ`]: `أ`,
|
|
286
|
+
[`ؤ`]: `ؤ`,
|
|
287
|
+
[`إ`]: `إ`,
|
|
288
|
+
[`ئ`]: `ئ`,
|
|
289
|
+
[`ا`]: `ا`,
|
|
290
|
+
[`ب`]: `ب`,
|
|
291
|
+
[`ة`]: `ة`,
|
|
292
|
+
[`ت`]: `ت`,
|
|
293
|
+
[`ث`]: `ث`,
|
|
294
|
+
[`ج`]: `ج`,
|
|
295
|
+
[`ح`]: `ح`,
|
|
296
|
+
[`خ`]: `خ`,
|
|
297
|
+
[`د`]: `د`,
|
|
298
|
+
[`ذ`]: `ذ`,
|
|
299
|
+
[`ر`]: `ر`,
|
|
300
|
+
[`ز`]: `ز`,
|
|
301
|
+
[`س`]: `س`,
|
|
302
|
+
[`ش`]: `ش`,
|
|
303
|
+
[`ص`]: `ص`,
|
|
304
|
+
[`ض`]: `ض`,
|
|
305
|
+
[`ط`]: `ط`,
|
|
306
|
+
[`ظ`]: `ظ`,
|
|
307
|
+
[`ع`]: `ع`,
|
|
308
|
+
[`غ`]: `غ`,
|
|
309
|
+
[`ػ`]: `ػ`,
|
|
310
|
+
[`ؼ`]: `ؼ`,
|
|
311
|
+
[`ؽ`]: `ؽ`,
|
|
312
|
+
[`ؾ`]: `ؾ`,
|
|
313
|
+
[`ؿ`]: `ؿ`,
|
|
314
|
+
[`ـ`]: `ـ`,
|
|
315
|
+
[`ف`]: `ف`,
|
|
316
|
+
[`ق`]: `ق`,
|
|
317
|
+
[`ك`]: `ك`,
|
|
318
|
+
[`ل`]: `ل`,
|
|
319
|
+
[`م`]: `م`,
|
|
320
|
+
[`ن`]: `ن`,
|
|
321
|
+
[`ه`]: `ه`,
|
|
322
|
+
[`و`]: `و`,
|
|
323
|
+
[`ى`]: `ى`,
|
|
324
|
+
[`ي`]: `ي`,
|
|
325
|
+
// Arabic diacritics (most common ones)
|
|
326
|
+
[`ً`]: `ً`,
|
|
327
|
+
[`ٌ`]: `ٌ`,
|
|
328
|
+
[`ٍ`]: `ٍ`,
|
|
329
|
+
[`َ`]: `َ`,
|
|
330
|
+
[`ُ`]: `ُ`,
|
|
331
|
+
[`ِ`]: `ِ`,
|
|
332
|
+
[`ّ`]: `ّ`,
|
|
333
|
+
[`ْ`]: `ْ`,
|
|
334
|
+
[`ٓ`]: `ٓ`,
|
|
335
|
+
[`ٔ`]: `ٔ`,
|
|
336
|
+
[`ٕ`]: `ٕ`,
|
|
337
|
+
// Arabic-Indic digits
|
|
338
|
+
[`٠`]: `٠`,
|
|
339
|
+
[`١`]: `١`,
|
|
340
|
+
[`٢`]: `٢`,
|
|
341
|
+
[`٣`]: `٣`,
|
|
342
|
+
[`٤`]: `٤`,
|
|
343
|
+
[`٥`]: `٥`,
|
|
344
|
+
[`٦`]: `٦`,
|
|
345
|
+
[`٧`]: `٧`,
|
|
346
|
+
[`٨`]: `٨`,
|
|
347
|
+
[`٩`]: `٩`,
|
|
348
|
+
// Extended Arabic characters (commonly used)
|
|
349
|
+
[`٪`]: `٪`,
|
|
350
|
+
[`٫`]: `٫`,
|
|
351
|
+
[`٬`]: `٬`,
|
|
352
|
+
[`٭`]: `٭`,
|
|
353
|
+
[`ٮ`]: `ٮ`,
|
|
354
|
+
[`ٯ`]: `ٯ`,
|
|
355
|
+
[`ٰ`]: `ٰ`,
|
|
356
|
+
[`ٱ`]: `ٱ`,
|
|
357
|
+
[`ٲ`]: `ٲ`,
|
|
358
|
+
[`ٳ`]: `ٳ`,
|
|
359
|
+
[`ٴ`]: `ٴ`,
|
|
360
|
+
[`ٵ`]: `ٵ`,
|
|
361
|
+
[`ٶ`]: `ٶ`,
|
|
362
|
+
[`ٷ`]: `ٷ`,
|
|
363
|
+
[`ٸ`]: `ٸ`,
|
|
364
|
+
[`ٹ`]: `ٹ`,
|
|
365
|
+
[`ٺ`]: `ٺ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[`ۈ`]: `ۈ`,
|
|
444
|
+
[`ۉ`]: `ۉ`,
|
|
445
|
+
[`ۊ`]: `ۊ`,
|
|
446
|
+
[`ۋ`]: `ۋ`,
|
|
447
|
+
[`ی`]: `ی`,
|
|
448
|
+
[`ۍ`]: `ۍ`,
|
|
449
|
+
[`ێ`]: `ێ`,
|
|
450
|
+
[`ۏ`]: `ۏ`,
|
|
451
|
+
[`ې`]: `ې`,
|
|
452
|
+
[`ۑ`]: `ۑ`,
|
|
453
|
+
[`ے`]: `ے`,
|
|
454
|
+
[`ۓ`]: `ۓ`, // Arabic Letter Yeh Barree with Hamza Above
|
|
249
455
|
};
|
|
250
456
|
if (!opt.googleApiKey) {
|
|
251
457
|
throw new typings_1.ValidationError('googleApiKey', opt.googleApiKey);
|
|
@@ -599,7 +805,7 @@ class ZTranslateService {
|
|
|
599
805
|
}
|
|
600
806
|
const results = await this.retryOperation(async () => {
|
|
601
807
|
return await this.sql.query(
|
|
602
|
-
`SELECT \`value\` FROM translations WHERE \`lang\`=? AND \`key\`=CONVERT(? USING
|
|
808
|
+
`SELECT \`value\` FROM translations WHERE \`lang\`=? AND \`key\`=CONVERT(? USING utf8mb4)`,
|
|
603
809
|
[lang, key],
|
|
604
810
|
);
|
|
605
811
|
}, 'fetch translation');
|
|
@@ -685,7 +891,8 @@ class ZTranslateService {
|
|
|
685
891
|
}
|
|
686
892
|
exports.ZTranslateService = ZTranslateService;
|
|
687
893
|
function strContainsLetters(text) {
|
|
688
|
-
|
|
894
|
+
// Updated regex to include Arabic characters (U+0600-U+06FF) and other scripts
|
|
895
|
+
const regExp = /[a-zA-Z\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/g;
|
|
689
896
|
return regExp.test(text);
|
|
690
897
|
}
|
|
691
898
|
function genSpaces(length) {
|