Skip to content

Commit

Permalink
fix(i18n): better types
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexogamer committed Jul 15, 2024
1 parent f654950 commit aadad92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
18 changes: 9 additions & 9 deletions i18n/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,30 @@ export const resources = {
};

// languages object, used for settings
export const languages = {
export const languages: Record<string, Language> = {
be: {
name: 'беларуская',
englishName: 'Belarusian',
emoji: '🇧🇾',
} as Language,
},
de: {
name: 'Deutsch (Deutschland)',
englishName: 'German (Germany)',
emoji: '🇩🇪',
} as Language,
},
en: {
name: 'English (Traditional)',
englishName: 'English (UK)',
emoji: '🇬🇧',
} as Language,
},
hu: {name: 'Magyar', englishName: 'Hungarian', emoji: '🇭🇺'},
id: {
name: 'Bahasa Indonesia',
englishName: 'Indonesian',
emoji: '🇮🇩',
} as Language,
// it: {name: 'Italiano', englishName: 'Italian', emoji: '🇮🇹'} as Language,
mwl: {name: 'Mirandés', englishName: 'Mirandese', emoji: '🇵🇹'} as Language,
ru: {name: 'Русский', englishName: 'Russian', emoji: '🇷🇺'} as Language,
tr: {name: 'Türkçe', englishName: 'Turkish', emoji: '🇹🇷'} as Language,
},
// it: {name: 'Italiano', englishName: 'Italian', emoji: '🇮🇹'},
mwl: {name: 'Mirandés', englishName: 'Mirandese', emoji: '🇵🇹'},
ru: {name: 'Русский', englishName: 'Russian', emoji: '🇷🇺'},
tr: {name: 'Türkçe', englishName: 'Turkish', emoji: '🇹🇷'},
};
5 changes: 1 addition & 4 deletions src/components/common/settings/atoms/StringNumberSetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {useTranslation} from 'react-i18next';

import MaterialIcon from 'react-native-vector-icons/MaterialIcons';

import {languages} from '../../../../../i18n/languages';
import {languages} from '@rvmob-i18n/languages';
import {app} from '../../../../Generic';
import {currentTheme, styles} from '../../../../Theme';
import {Setting} from '../../../../lib/types';
Expand Down Expand Up @@ -66,16 +66,13 @@ export const StringNumberSetting = ({
{sRaw.key === 'app.language' ? (
<View style={{flex: 1, flexDirection: 'row'}}>
<Text style={{alignSelf: 'center', marginEnd: 8}}>
{/* @ts-expect-error this will always exist */}
{languages[o].emoji}
</Text>
<View style={{flexDirection: 'column'}}>
<Text style={{fontWeight: 'bold'}}>
{/* @ts-expect-error this will always exist */}
{languages[o].name}
</Text>
<Text colour={currentTheme.foregroundSecondary}>
{/* @ts-expect-error this will always exist */}
{languages[o].englishName}
</Text>
</View>
Expand Down

0 comments on commit aadad92

Please sign in to comment.