Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const sdk = new DesktopAppSdk();
export const Providers = () => {
const { t: tSimple, i18n } = useTranslation();

const t = useTWithReplaces(tSimple);
const t = useTWithReplaces(tSimple, i18n.language);

const translation = useMemo(() => {
const client: I18nContext = {
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const ExtensionGlobalStyle = createGlobalStyle`

export const App: FC<{ isInCustomPopup: boolean }> = ({ isInCustomPopup }) => {
const browserT = useCallback((key: string) => browser.i18n.getMessage(key), []);
const t = useTWithReplaces(browserT);
const t = useTWithReplaces(browserT, browser.i18n.getUILanguage());

sdk.addWalletPage.isInCustomPopup = isInCustomPopup;

Expand Down
20 changes: 13 additions & 7 deletions apps/extension/task/extension-builder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import fs from 'fs-extra';
import { build } from 'vite';
import child_process from 'child_process';
import { BRAND_CONFIG } from '@tonkeeper/core/dist/config/brand';
import {
BRAND_CONFIG,
getBrandCoinName,
getBrandCoinSymbolWithEx
} from '@tonkeeper/core/dist/config/brand';

export const notify = (value: string) => console.log(`----------${value}----------`);

Expand Down Expand Up @@ -103,15 +107,17 @@ export class ExtensionBuilder {
*/
private applyBrandToLocales() {
const localesDir = `${this.buildPath}/_locales`;
const subs: Record<string, string> = {
'%{chainName}': BRAND_CONFIG.chainName,
'%{coinName}': BRAND_CONFIG.coinName,
'%{coinSymbol}': BRAND_CONFIG.coinSymbol,
'%{coinSymbolWithEx}': BRAND_CONFIG.coinSymbolWithEx
};
for (const lang of fs.readdirSync(localesDir)) {
const file = `${localesDir}/${lang}/messages.json`;
if (!fs.existsSync(file)) continue;
// `coinName`/`coinSymbolWithEx` are language-dependent ("prev." in English, "ex-"
// elsewhere), so resolve them per locale folder.
const subs: Record<string, string> = {
'%{chainName}': BRAND_CONFIG.chainName,
'%{coinName}': getBrandCoinName(lang),
'%{coinSymbol}': BRAND_CONFIG.coinSymbol,
'%{coinSymbolWithEx}': getBrandCoinSymbolWithEx(lang)
};
const data = fs.readJsonSync(file) as Record<string, { message?: string }>;
for (const key of Object.keys(data)) {
const msg = data[key]?.message;
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const sdk = new CapacitorAppSdk();
export const Providers = () => {
const { t: tSimple, i18n } = useTranslation();

const t = useTWithReplaces(tSimple);
const t = useTWithReplaces(tSimple, i18n.language);

const translation = useMemo(() => {
const client: I18nContext = {
Expand Down
2 changes: 1 addition & 1 deletion apps/twa/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const getUsePadding = (platform: TwaPlatform): boolean => {
const TwaApp: FC<{ sdk: TwaAppSdk }> = ({ sdk }) => {
const { t: tSimple, i18n } = useTranslation();

const t = useTWithReplaces(tSimple);
const t = useTWithReplaces(tSimple, i18n.language);

const translation = useMemo(() => {
const client: I18nContext = {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const App: FC = () => {
const Providers: FC<PropsWithChildren> = () => {
const { t: tSimple, i18n } = useTranslation();

const t = useTWithReplaces(tSimple);
const t = useTWithReplaces(tSimple, i18n.language);

const translation = useMemo(() => {
const client: I18nContext = {
Expand Down
52 changes: 43 additions & 9 deletions packages/core/src/config/brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,61 @@
* - rate/currency keys sent to backends (e.g. `getRates({ tokens: ['TON'] })`)
* Changing any of those would break balances, asset matching and backend calls.
*
* Naming rules (rebrand to Gram):
* - The PURE ticker {@link BrandConfig.coinSymbol} ("GRAM") is shown EVERYWHERE a ticker appears
* (history, Ton Connect, staking, etc.) — and is language-independent.
* - The transitional ticker-with-old-name ({@link getBrandCoinSymbolWithEx}) is shown in EXACTLY
* ONE place: the native-coin cell on the home page.
* - The full coin name ({@link getBrandCoinName}) replaces every former "Toncoin" display string.
* - Both transitional values are LANGUAGE-DEPENDENT: English uses "(prev. …)", every other
* language uses "(ex-…)". Resolve them via the helpers below given the active UI language.
*/
export interface BrandConfig {
/** Display name of the chain, e.g. used in "... in the TON network". */
chainName: string;
/** Full name of the native coin, e.g. "Toncoin". */
coinName: string;
/** Full name of the native coin in English, e.g. "Gram (prev. Toncoin)". */
coinName_En: string;
/** Full name of the native coin in non-English languages, e.g. "Gram (ex-Toncoin)". */
coinName_notEn: string;
/**
* PURE ticker/symbol of the native coin, e.g. "GRAM". Use this next to amounts and anywhere a
* value might be passed onward (analytics, etc.) — never the transitional {@link coinSymbolWithEx}.
* value might be passed onward (analytics, etc.) — never the transitional with-ex variants.
* Language-independent.
*/
coinSymbol: string;
/**
* Transitional DISPLAY-ONLY ticker with the old name in parentheses, e.g. "GRAM (ex TON)".
* Use only as a standalone label where we want to surface the rename; NEVER send to an API or
* use as an identifier — use {@link coinSymbol} for that.
* Transitional DISPLAY-ONLY ticker with the old name in parentheses, English variant,
* e.g. "GRAM (prev. TON)". Home-page coin cell only; NEVER send to an API or use as an id.
*/
coinSymbolWithEx: string;
coinSymbolWithEx_En: string;
/** Transitional DISPLAY-ONLY ticker with the old name, non-English variant, e.g. "GRAM (ex-TON)". */
coinSymbolWithEx_notEn: string;
/** Native coin icon data URI. */
coinIcon: string;
/** Native chain/network icon data URI. */
chainIcon: string;
}

/** True when the active UI language is English (the only language using the "(prev. …)" wording). */
export const isEnglishLanguage = (language?: string): boolean =>
!language || language.toLowerCase().startsWith('en');

/**
* Resolve the full native-coin name ("Gram (prev. Toncoin)" / "Gram (ex-Toncoin)") for the active
* UI language. Pass the i18n language; defaults to the English variant when unknown.
*/
export const getBrandCoinName = (language?: string): string =>
isEnglishLanguage(language) ? BRAND_CONFIG.coinName_En : BRAND_CONFIG.coinName_notEn;

/**
* Resolve the transitional with-ex ticker ("GRAM (prev. TON)" / "GRAM (ex-TON)") for the active UI
* language. Used ONLY by the home-page coin cell.
*/
export const getBrandCoinSymbolWithEx = (language?: string): string =>
isEnglishLanguage(language)
? BRAND_CONFIG.coinSymbolWithEx_En
: BRAND_CONFIG.coinSymbolWithEx_notEn;

// Native coin icon, inlined so every platform (incl. desktop/iOS, which don't self-host static
// assets) bundles it without a remote request or per-app copies. Edit the SVG markup below to
// rebrand; the data URI is derived from it at load time (core is tsc-compiled and can't import
Expand All @@ -51,9 +83,11 @@ const NATIVE_CHAIN_ICON = `data:image/svg+xml,${encodeURIComponent(NATIVE_CHAIN_

export const BRAND_CONFIG: BrandConfig = {
chainName: 'TON',
coinName: 'Gram (ex\u00A0Toncoin)',
coinName_En: 'Gram (prev.\u00A0Toncoin)',
coinName_notEn: 'Gram (ex-Toncoin)',
coinSymbol: 'GRAM',
coinSymbolWithEx: 'GRAM (ex\u00A0TON)',
coinSymbolWithEx_En: 'GRAM (prev.\u00A0TON)',
coinSymbolWithEx_notEn: 'GRAM (ex-TON)',
coinIcon: NATIVE_COIN_ICON,
chainIcon: NATIVE_CHAIN_ICON
};
4 changes: 3 additions & 1 deletion packages/core/src/entries/crypto/asset/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const TRON_TRX_ASSET: TronAsset = {
export const TON_ASSET: TonAsset = {
id: packAssetId(BLOCKCHAIN_NAME.TON, 'TON'),
symbol: BRAND_CONFIG.coinSymbol,
name: BRAND_CONFIG.coinName,
// `core` has no UI-language context, so the canonical asset name uses the English variant.
// UI surfaces that show the coin name should prefer the language-aware `useBrandCoinName()`.
name: BRAND_CONFIG.coinName_En,
decimals: 9,
// NOTE: `address` and the `id` above are protocol identifiers — keep the literal 'TON'.
address: 'TON',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function formatSendValue(str: string) {

export const getJettonSymbol = (address: string, jettons: JettonsBalances): string => {
if (address === 'TON') {
return BRAND_CONFIG.coinSymbolWithEx;
return BRAND_CONFIG.coinSymbol;
}
const jetton = jettons.balances.find(item => item.jetton.address === address);
return jetton?.jetton.symbol ?? address;
Expand Down
20 changes: 10 additions & 10 deletions packages/locales/src/tonkeeper-web/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"confirm_discard_title": "هل أنت متأكد أنك تريد المغادرة؟",
"confirm_error_insufficient_balance_light": "الرصيد غير كافٍ",
"confirm_error_insufficient_battery_balance": "رصيد بطارية Tonkeeper غير كافٍ",
"confirm_error_insufficient_host_wallet_balance": "رصيد محفظة الموقّع {wallet} المتعدد التوقيعات غير كافٍ لتغطية رسوم البلوكشين. الحد الأدنى للرصيد المطلوب هو 0.5 %{coinSymbolWithEx}.",
"confirm_error_insufficient_host_wallet_balance": "رصيد محفظة الموقّع {wallet} المتعدد التوقيعات غير كافٍ لتغطية رسوم البلوكشين. الحد الأدنى للرصيد المطلوب هو 0.5 %{coinSymbol}.",
"confirm_modal_transfer": "تحويل",
"ConfirmPassword": "اعد ادخال كلمة المرور",
"confirm_sending_sign": "توقيع",
Expand Down Expand Up @@ -169,7 +169,7 @@
"error_keystone_doesnot_support_sign_data": "Keystone لا يدعم توقيع البيانات.",
"error_multisig_doesnot_support_connection": "محفظة Multisig لا تدعم الاتصال بتطبيقات dApps.",
"error_multisig_doesnot_support_sign_data": "محفظة التوقيعات المتعددة لا تدعم توقيع البيانات.",
"error_not_less_ton": "لا يمكن أن يكون مبلغ الاشتراك أقل من 0.1 %{coinSymbolWithEx}!",
"error_not_less_ton": "لا يمكن أن يكون مبلغ الاشتراك أقل من 0.1 %{coinSymbol}!",
"error_occurred": "حدث خطأ",
"error_signer_doesnot_support_connect": "الموقّع المرتبط عبر رمز QR لا يدعم الاتصال بهذا التطبيق اللامركزي.",
"error_signer_doesnot_support_sign_data": "الموقّع المرتبط عبر رمز QR لا يدعم توقيع البيانات.",
Expand Down Expand Up @@ -255,7 +255,7 @@
"import_multisend_table_example": "مثال على الجدول",
"import_multisend_table_heading_address": "EQ أو UQ عنوان / hex عنوان / نطاق .ton",
"import_multisend_table_heading_amount": "المبلغ",
"import_multisend_table_heading_asset": "رمز العملة الورقية / %{coinSymbolWithEx} / hex أو عنوان EQ أو UQ الخاص بـ token-master",
"import_multisend_table_heading_asset": "رمز العملة الورقية / %{coinSymbol} / hex أو عنوان EQ أو UQ الخاص بـ token-master",
"import_multisend_table_heading_comment": "تعليق اختياري",
"import_wallet_12_words": "12 كلمة",
"import_wallet_24_words": "24 كلمة",
Expand Down Expand Up @@ -310,7 +310,7 @@
"multichain": "متعدد السلاسل",
"multi_send_about_w5": "عن معيار W5",
"multi_send_add_more": "إضافة المزيد",
"multisend_confirm_error_insufficient_ton_for_fee": "رصيد المحفظة %balance% غير كافٍ لتغطية رسوم سلسة الكتل. الحد الأدنى للرصيد المطلوب: %required%. سيتم إرجاع %{coinSymbolWithEx} غير المستخدم إلى محفظتك بعد المعاملة.",
"multisend_confirm_error_insufficient_ton_for_fee": "رصيد المحفظة %balance% غير كافٍ لتغطية رسوم سلسة الكتل. الحد الأدنى للرصيد المطلوب: %required%. سيتم إرجاع %{coinSymbol} غير المستخدم إلى محفظتك بعد المعاملة.",
"multi_send_continue-with_pro": "تابع مع تونكيبر برو",
"multi_send_continue_with_pro": "تابع باستخدام Pro",
"multi_send_delete_description": "هذه العملية لا يمكن التراجع عنها، وسيتم فقدان جميع البيانات.",
Expand Down Expand Up @@ -388,7 +388,7 @@
"no_multisig_learn_more": "تعرّف على المزيد حول التوقيع المتعدد (multisig)",
"no_multisig_orders_description": "يتم عرض جميع الطلبات من جميع المشاركين في محفظة التوقيعات المتعددة.",
"no_multisig_orders_heading": "ستظهر طلبات محفظتك متعددة التوقيعات هنا",
"not_enough_balance_reminder": "تذكير: لكي يتم تجديد اشتراكك تلقائيًا بنجاح في {date}، يجب أن يحتوي المحفظة التي استخدمتها لشراء Tonkeeper Pro على كمية كافية من %{coinSymbolWithEx}.",
"not_enough_balance_reminder": "تذكير: لكي يتم تجديد اشتراكك تلقائيًا بنجاح في {date}، يجب أن يحتوي المحفظة التي استخدمتها لشراء Tonkeeper Pro على كمية كافية من %{coinSymbol}.",
"not_enough_funds": "لا توجد أموال كافية",
"ok": "موافق",
"Old_password": "كلمة المرور الحالية",
Expand Down Expand Up @@ -517,7 +517,7 @@
"select_fee_payment_method_refill": "إعادة التعبئة",
"select_networks_modal_subtitle": "قم بتكوين دعم الرموز لجعل إدارة المحفظة أسهل.",
"select_networks_modal_title": "إعداد رموز المحفظة",
"select_networks_modal_ton_description": "%{coinSymbolWithEx}، نوت، دوغز، بي إكس، بانك وغيرهم ",
"select_networks_modal_ton_description": "%{coinSymbol}، نوت، دوغز، بي إكس، بانك وغيرهم ",
"select_networks_modal_ton_title": "أصول %{chainName}",
"select_networks_modal_tron_description": "استخدم USD₮ TRC20 بدون TRX. الرسوم مغطاة بواسطة Tonkeeper Battery.",
"send_change_fee_payment_method": "تغيير طريقة الدفع",
Expand Down Expand Up @@ -632,11 +632,11 @@
"topup_trc20_fee_pro_banner_description": "متاحة شهريًا مع Tonkeeper Pro.",
"topup_trc20_fee_pro_banner_description_used": "تم استخدام تحويل هذا الشهر المجاني. سيكون متاحًا التالي في {date}.",
"topup_trc20_fee_pro_banner_title": "مجانًا تحويل USD₮ TRC20",
"topup_tron_fee_battery_description": "يدعم تحويلات TRC20، والمبادلات، وNFTs، وتحويلات رموز %{coinSymbolWithEx}",
"topup_tron_fee_battery_description": "يدعم تحويلات TRC20، والمبادلات، وNFTs، وتحويلات رموز %{coinSymbol}",
"topup_tron_fee_charges_per_transfer": "~ {charges} رسوم لكل تحويل TRC20",
"topup_tron_fee_disclaimer": "تتغير الرسوم في الوقت الفعلي بناءً على عدة عوامل.",
"topup_tron_fee_price_per_transfer": "~ {fiat} لكل تحويل TRC20",
"topup_tron_fee_subtitle": "تحتاج إلى رسوم صغيرة لإرسال الرموز. غطها بحساب Tonkeeper Battery، %{coinSymbolWithEx} أو TRX.",
"topup_tron_fee_subtitle": "تحتاج إلى رسوم صغيرة لإرسال الرموز. غطها بحساب Tonkeeper Battery، %{coinSymbol} أو TRX.",
"topup_tron_fee_title": "الرسوم على البلوكشين جزء من كل معاملة",
"topup_tron_fee_ton_description": "يدعم تحويلات TRC20 وجميع الإجراءات على شبكة %{chainName}",
"topup_tron_fee_top_up": "شحن الرصيد",
Expand All @@ -654,7 +654,7 @@
"tron_fee_banner_available_label": "متوفر ≈ {transfers} تحويلات TRC20",
"tron_fee_banner_fee_options": "خيارات دفع الرسوم",
"tron_fee_start_banner_button": "إعادة تعبئة",
"tron_fee_start_banner_description": "يمكنك دفع الرسوم باستخدام %{coinSymbolWithEx} أو بطارية Tonkeeper أو TRX، مما يوفر مرونة أكبر ويمنع التأخيرات عند انخفاض رصيد إحدى العملات.",
"tron_fee_start_banner_description": "يمكنك دفع الرسوم باستخدام %{coinSymbol} أو بطارية Tonkeeper أو TRX، مما يوفر مرونة أكبر ويمنع التأخيرات عند انخفاض رصيد إحدى العملات.",
"tron_fee_start_banner_title": "اختر طريقة دفع الرسوم الخاصة بك",
"tron_fee_table_charges_per_one": "{fiat} لكل واحد",
"tron_fee_table_disclaimer": "عدد التحويلات والرسوم يختلفان بناءً على الظروف الحالية.",
Expand Down Expand Up @@ -689,7 +689,7 @@
"two_fa_settings_set_up_tg_connection_modal_heading": "امسح رمز QR أو افتح تيليجرام لربط حساب جديد.",
"two_fa_settings_set_up_tg_connection_modal_open_button": "افتح تيليجرام",
"two_fa_settings_set_up_tg_step_description": "أكد اتصالك في تيليجرام",
"two_fa_settings_warning_balance_required": "مطلوب 0.15 %{coinSymbolWithEx} لتثبيت أو إزالة المصادقة الثنائية (2FA).",
"two_fa_settings_warning_balance_required": "مطلوب 0.15 %{coinSymbol} لتثبيت أو إزالة المصادقة الثنائية (2FA).",
"two_fa_settings_warning_battery_gasless": "وضع البطارية والمعاملات بدون الغاز غير متوافقين مع المصادقة الثنائية (2FA).",
"two_fa_settings_warning_can_not_recover": "لا يمكن للمصادقة الثنائية (2FA) استعادة عبارتك السرية.",
"two_fa_settings_warning_wallet_will_stop": "المحفظة نفسها ستتوقف عن العمل على أجهزتك الأخرى.",
Expand Down
Loading
Loading