Skip to content

Commit

Permalink
fix(HW-665): improve change language functionality (#2098)
Browse files Browse the repository at this point in the history
Co-authored-by: iGroza <[email protected]>
  • Loading branch information
2 people authored and devkudasov committed Sep 17, 2024
1 parent 3c694cb commit b4b9370
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
*/
import '@ethersproject/shims';
import '@walletconnect/react-native-compat';
import {AppRegistry, LogBox} from 'react-native';
import {AppRegistry, I18nManager, LogBox} from 'react-native';
import './global';

import {app} from '@app/contexts';
import {DEBUG_VARS} from '@app/debug-vars';
import {enableBatchedStateUpdates} from '@app/hooks/batched-set-state';
import {Provider} from '@app/models/provider';
import {EventTracker} from '@app/services/event-tracker';
import {MarketingEvents} from '@app/types';
import {IS_IOS} from '@app/variables/common';
import {IS_IOS, RTL_LANGUAGES} from '@app/variables/common';
import {JsonRpcProvider} from '@ethersproject/providers';
import messaging from '@react-native-firebase/messaging';
import * as Sentry from '@sentry/react-native';
Expand All @@ -22,7 +22,7 @@ import {name as appName} from './app.json';
import {App} from './src/app';
import './src/event-actions';
import {Jailbreak} from './src/jailbreak';
import {Provider} from '@app/models/provider';
import {Language} from '@app/models/language';

if (!global.BigInt) {
const BigInt = require('big-integer');
Expand All @@ -32,6 +32,9 @@ if (!global.BigInt) {
});
}

const isRTL = RTL_LANGUAGES.includes(Language.current);
I18nManager.allowRTL(isRTL);

enableScreens();
enableFreeze(true);
enableBatchedStateUpdates();
Expand Down
6 changes: 3 additions & 3 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,19 +1045,19 @@ export function getText(key: I18N, params?: Record<string, string>): string {

// FIXME: Make sure that we have 100% translations
//@ts-ignore
if (!translations[key]) {
if (!Language.keys[key]) {
return `[${key}]`;
}

if (params) {
return translations.formatString(
//@ts-ignore
fixLocalise(translations[key]),
fixLocalise(Language.keys[key]),
params,
) as string;
}
//@ts-ignore
return fixLocalise(translations[key]);
return fixLocalise(Language.keys[key]);
}

export const supportedTranslationsMap: {[key in AppLanguage]: NodeRequire} = {
Expand Down

0 comments on commit b4b9370

Please sign in to comment.