From ed21bce143e1efee8e6fa5581274f3e23e43676f Mon Sep 17 00:00:00 2001 From: Boonkarit Date: Tue, 19 Aug 2025 18:31:22 +0700 Subject: [PATCH] add lib rabbit-node for encoding mynmar language to zawgyi --- package.json | 1 + src/utils/i18n.js | 10 +++++++++- yarn.lock | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b073197..b01726c 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "moment": "^2.24.0", "native-base": "^2.13.8", "patch-package": "^7.0.0", + "rabbit-node": "^1.0.4", "react": "18.2.0", "react-native": "0.72.6", "react-native-action-sheet": "^2.2.0", diff --git a/src/utils/i18n.js b/src/utils/i18n.js index 9b86596..9bcaf4e 100644 --- a/src/utils/i18n.js +++ b/src/utils/i18n.js @@ -1,5 +1,6 @@ import I18n from 'i18n-js' import moment from 'moment' +import { uni2zg } from 'rabbit-node' import 'moment/locale/th' import 'moment/locale/my' @@ -23,7 +24,14 @@ ReactNative.I18nManager.allowRTL(isRTL) // The method we'll use instead of a regular string export function t (name, params = {}) { - return I18n.t(name, params) + let text = I18n.t(name, params) + + // แปลงเป็น Zawgyi กรณีเป็นภาษาพม่า + if (I18n.locale.startsWith('my')) { + text = uni2zg(text) + } + + return text } export function locale () { diff --git a/yarn.lock b/yarn.lock index dac8ff8..47e5d00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7274,6 +7274,11 @@ queue@6.0.2: dependencies: inherits "~2.0.3" +rabbit-node@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/rabbit-node/-/rabbit-node-1.0.4.tgz#b329b1a25c5ec70371f5da47d7dd26b06b8120e0" + integrity sha512-B+eMJwfnRab47sp5q96TfZVdGEHunA3sAuoXcwRFiM3e4ZT5t7h9U8dl1fCM1aSMqOg9ysGbE8Szpl2Q8w504Q== + raf@^3.1.0: version "3.4.1" resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"