mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-11-23 02:49:59 +00:00
feat(i18n): replace all hardcoded strings with translation calls
- Add translation keys for dashboard, send, receive, history, swap, pools, staking, lpStaking, fees, tokens, errors, validation, time, and context sections to types.ts and all 6 language files - Replace hardcoded Kurdish/Turkish strings in all wallet components with useTranslation() hook t() calls - Replace hardcoded strings in non-React files (crypto, utils, error-tracking, wallet-storage, contexts) with standalone translate() - Fix Turkish strings incorrectly used in Kurdish codebase
This commit is contained in:
1 parent
71f142b9f4
commit
c4282f5870
23 files changed
+2294
-253
No files matched your search
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import { createContext, useContext, useState, useEffect, useCallback, ReactNode } from 'react';
|
||||
import { translate } from '@/i18n';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { useTelegram } from '@/hooks/useTelegram';
|
||||
import {
|
||||
@@ -53,7 +54,7 @@ export function ReferralProvider({ children }: { children: ReactNode }) {
|
||||
setMyReferrals(fetchedReferrals);
|
||||
} catch (error) {
|
||||
console.error('Error fetching referral stats:', error);
|
||||
showAlert('Referral stats bar nekirin');
|
||||
showAlert(translate('context.referralStatsError'));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -75,7 +76,7 @@ export function ReferralProvider({ children }: { children: ReactNode }) {
|
||||
if (event.referrer === address || event.referred === address) {
|
||||
if (event.type === 'confirmed') {
|
||||
hapticNotification('success');
|
||||
showAlert(`Referral hat pejirandin! Hejmara te: ${event.count}`);
|
||||
showAlert(translate('context.referralApproved', { count: event.count ?? 0 }));
|
||||
}
|
||||
fetchStats();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
import { validatePassword } from '@/lib/crypto';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { useAuth } from './AuthContext';
|
||||
import { translate } from '@/i18n';
|
||||
import {
|
||||
initRPCConnection,
|
||||
subscribeToConnection,
|
||||
@@ -123,7 +124,7 @@ export function WalletProvider({ children }: { children: React.ReactNode }) {
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Wallet init error:', err);
|
||||
setError('Wallet dest pê nekir');
|
||||
setError(translate('context.walletInitFailed'));
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
@@ -138,7 +139,7 @@ export function WalletProvider({ children }: { children: React.ReactNode }) {
|
||||
setError(null);
|
||||
} else if (wasConnected && !connected) {
|
||||
// Only show disconnect error if we were previously connected
|
||||
setError('Têkiliya RPC qut bû. Dîsa girêdan tê kirin...');
|
||||
setError(translate('context.rpcDisconnected'));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -195,7 +196,7 @@ export function WalletProvider({ children }: { children: React.ReactNode }) {
|
||||
async (mnemonic: string, password: string): Promise<void> => {
|
||||
// User must be authenticated first
|
||||
if (!isAuthenticated || !user?.telegram_id) {
|
||||
throw new Error('Ji kerema xwe pêşî têkeve');
|
||||
throw new Error(translate('context.pleaseLoginFirst'));
|
||||
}
|
||||
|
||||
const validation = validatePassword(password);
|
||||
@@ -221,11 +222,11 @@ export function WalletProvider({ children }: { children: React.ReactNode }) {
|
||||
async (mnemonic: string, password: string): Promise<string> => {
|
||||
// User must be authenticated first
|
||||
if (!isAuthenticated || !user?.telegram_id) {
|
||||
throw new Error('Ji kerema xwe pêşî têkeve');
|
||||
throw new Error(translate('context.pleaseLoginFirst'));
|
||||
}
|
||||
|
||||
if (!validateMnemonic(mnemonic)) {
|
||||
throw new Error('Seed phrase ne derbasdar e');
|
||||
throw new Error(translate('context.invalidSeedPhrase'));
|
||||
}
|
||||
|
||||
const validation = validatePassword(password);
|
||||
@@ -258,7 +259,7 @@ export function WalletProvider({ children }: { children: React.ReactNode }) {
|
||||
setKeypair(pair);
|
||||
setIsConnected(true);
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Girêdan neserketî';
|
||||
const message = err instanceof Error ? err.message : translate('context.connectionFailed');
|
||||
setError(message);
|
||||
throw err;
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user