Skip to content

Commit d53350a

Browse files
author
Guillermo Machado
committed
chore: remove arabic translation
1 parent b42dfb9 commit d53350a

File tree

6 files changed

+11
-91
lines changed

6 files changed

+11
-91
lines changed

src/app/login.tsx

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/components/settings/language-item.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback, useMemo } from 'react';
22

3-
import { translate,useSelectedLanguage } from '@/core';
3+
import { translate, useSelectedLanguage } from '@/core';
44
import type { Language } from '@/core/i18n/resources';
55
import type { OptionType } from '@/ui';
66
import { Options, useModal } from '@/ui';
@@ -15,20 +15,17 @@ export const LanguageItem = () => {
1515
setLanguage(option.value as Language);
1616
modal.dismiss();
1717
},
18-
[setLanguage, modal]
18+
[setLanguage, modal],
1919
);
2020

2121
const langs = useMemo(
22-
() => [
23-
{ label: translate('settings.english'), value: 'en' },
24-
{ label: translate('settings.arabic'), value: 'ar' },
25-
],
26-
[]
22+
() => [{ label: translate('settings.english'), value: 'en' }],
23+
[],
2724
);
2825

2926
const selectedLanguage = useMemo(
3027
() => langs.find((lang) => lang.value === language),
31-
[language, langs]
28+
[language, langs],
3229
);
3330

3431
return (

src/core/i18n/resources.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import ar from '@/translations/ar.json';
21
import en from '@/translations/en.json';
32

43
export const resources = {
54
en: {
65
translation: en,
76
},
8-
ar: {
9-
translation: ar,
10-
},
117
};
128

139
export type Language = keyof typeof resources;

src/core/i18n/utils.test.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import i18n from 'i18next';
22
import { initReactI18next } from 'react-i18next';
33

4-
import ar from '../../translations/ar.json';
54
import en from '../../translations/en.json';
65
import { storage } from '../storage';
76
import type { TxKeyPath } from './utils';
8-
import { changeLanguage, getLanguage, translate } from './utils';
7+
import { getLanguage, translate } from './utils';
98

109
jest.mock('../storage', () => ({
1110
storage: {
@@ -26,7 +25,7 @@ i18n.use(initReactI18next).init({
2625
escapeValue: false,
2726
},
2827

29-
resources: { en: { translationsNS: en }, ar: { translationsNS: ar } },
28+
resources: { en: { translationsNS: en } },
3029
});
3130

3231
describe('getLanguage', () => {
@@ -40,12 +39,8 @@ describe('getLanguage', () => {
4039
describe('translate', () => {
4140
it('should return translated string', () => {
4241
const key: TxKeyPath = 'onboarding.message';
43-
let options = { lang: 'en' };
42+
const options = { lang: 'en' };
4443
const translatedString = translate(key, options);
4544
expect(translatedString).toBe('Welcome to rootstrap app site');
46-
changeLanguage('ar');
47-
options = { lang: 'ar' };
48-
const translatedStringArab = translate(key, options);
49-
expect(translatedStringArab).toBe('مرحبا بكم في موقع تطبيق rootstrap');
5045
});
5146
});

src/core/i18n/utils.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type TranslateOptions from 'i18next';
22
import i18n from 'i18next';
33
import memoize from 'lodash.memoize';
44
import { useCallback } from 'react';
5-
import { I18nManager, NativeModules, Platform } from 'react-native';
5+
import { NativeModules, Platform } from 'react-native';
66
import { useMMKVString } from 'react-native-mmkv';
77
import RNRestart from 'react-native-restart';
88

@@ -21,16 +21,11 @@ export const translate = memoize(
2121
(key: TxKeyPath, options = undefined) =>
2222
i18n.t(key, options) as unknown as string,
2323
(key: TxKeyPath, options: typeof TranslateOptions) =>
24-
options ? key + JSON.stringify(options) : key
24+
options ? key + JSON.stringify(options) : key,
2525
);
2626

2727
export const changeLanguage = (lang: Language) => {
2828
i18n.changeLanguage(lang);
29-
if (lang === 'ar') {
30-
I18nManager.forceRTL(true);
31-
} else {
32-
I18nManager.forceRTL(false);
33-
}
3429
if (Platform.OS === 'ios' || Platform.OS === 'android') {
3530
if (__DEV__) {
3631
NativeModules.DevSettings.reload();
@@ -54,7 +49,7 @@ export const useSelectedLanguage = () => {
5449
changeLanguage(lang);
5550
}
5651
},
57-
[setLang]
52+
[setLang],
5853
);
5954

6055
return { language, setLanguage };

src/translations/ar.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)