Skip to content

Commit

Permalink
feat: add english names below native ones + new languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexogamer committed Nov 12, 2023
1 parent 582220a commit d0c1705
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
19 changes: 16 additions & 3 deletions i18n/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,28 @@ import {Language} from '../src/lib/types';

// string files
import {default as en} from './strings/en.json';
import {default as de} from './strings/en.json';
import {default as ru} from './strings/en.json';

// resources object passed to i18next
export const resources = {
en: {translation: en},
de: {translation: de},
ru: {translation: ru},
};

// languages object, used for settings
export const languages = {
en: {name: 'English (Traditional)', emoji: '🇬🇧'} as Language,
de: {name: 'Deutsch (Deutschland)', emoji: '🇩🇪'} as Language,
it: {name: 'Italiano', emoji: '🇮🇹'} as Language,
en: {
name: 'English (Traditional)',
englishName: 'English (UK)',
emoji: '🇬🇧',
} as Language,
de: {
name: 'Deutsch (Deutschland)',
englishName: 'German (Germany)',
emoji: '🇩🇪',
} as Language,
it: {name: 'Italiano', englishName: 'Italian', emoji: '🇮🇹'} as Language,
ru: {name: 'Русский', englishName: 'Russian', emoji: '🇷🇺'} as Language,
};
2 changes: 1 addition & 1 deletion src/Generic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const app = {
list: [
{
key: 'app.language',
name: 'Language',
name: 'Select your language',
category: 'i18n',
default: 'en',
type: 'string',
Expand Down
26 changes: 20 additions & 6 deletions src/components/common/settings/atoms/StringNumberSetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,26 @@ export const StringNumberSetting = ({
rerender(renderCount + 1);
}
}}>
<Text style={{flex: 1}}>
{sRaw.key === 'app.language'
? // @ts-expect-error this will always exist
`${languages[o].emoji} ${languages[o].name}`
: o}
</Text>
{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>
</View>
) : (
<Text style={{flex: 1}}>{o}</Text>
)}
<View style={{...styles.iconContainer, marginRight: 0}}>
<MaterialIcon
name={`radio-button-${value === o ? 'on' : 'off'}`}
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ export type DeletableObject = TypedMessage | TypedServer;

export type Language = {
name: string;
englishName: string;
emoji: string;
};

0 comments on commit d0c1705

Please sign in to comment.