Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Feature/french translation #23

Merged
merged 5 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions webapp/src/constants/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const PRUNE_BLOCK_STORAGE = 'pruneBlockStorage';
export const ENGLISH = 'en';
export const SCRIPT_VERIFICATION = 'scriptVerification';
export const GERMAN = 'de';
export const FRENCH = 'fr';
export const LIGHT_DISPLAY = 'LIGHT';
export const DARK_DISPLAY = 'DARK';
export const SAME_AS_SYSTEM_DISPLAY = 'SAME_AS_SYSTEM';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ exports[`SettingsRowDropDownComponent should check for snapshot 1`] = `
"label": "containers.settings.german",
"value": "de",
},
Object {
"label": "containers.settings.french",
"value": "fr",
},
]
}
field="en-GB"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Settings page service', () => {
it('should check for get language', () => {
const data = service.getLanguage();
expect(data).toBeInstanceOf(Array);
expect(data.length).toBe(2);
expect(data.length).toBe(3);
});
});

Expand Down
6 changes: 4 additions & 2 deletions webapp/src/containers/SettingsPage/__test__/testData.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"settingsRowDropDown": {
"languages": [
{ "label": "containers.settings.english", "value": "en" },
{ "label": "containers.settings.german", "value": "de" }
{ "label": "containers.settings.german", "value": "de" },
{ "label": "containers.settings.french", "value": "fr" }
],
"amountUnits": [
{ "label": "DFI", "value": "DFI" },
Expand Down Expand Up @@ -54,7 +55,8 @@
"getSettingsOptions": {
"languages": [
{ "label": "containers.settings.english", "value": "en" },
{ "label": "containers.settings.german", "value": "de" }
{ "label": "containers.settings.german", "value": "de" },
{ "label": "containers.settings.french", "value": "fr" }
],
"amountUnits": [
{ "label": "DFI", "value": "DFI" },
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/containers/SettingsPage/service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
DATABASE_CACHE,
ENGLISH,
GERMAN,
FRENCH,
SAME_AS_SYSTEM_DISPLAY,
LIGHT_DISPLAY,
DARK_DISPLAY,
Expand All @@ -32,6 +33,7 @@ export const getLanguage = () => {
return [
{ label: 'containers.settings.english', value: ENGLISH },
{ label: 'containers.settings.german', value: GERMAN },
{ label: 'containers.settings.french', value: FRENCH },
];
};

Expand Down
8 changes: 6 additions & 2 deletions webapp/src/translations/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
} from 'react-redux-i18n';
import enTranslationMessages from './languages/en.json';
import deTranslationMessages from './languages/de.json';
import { LANG_VARIABLE, ENGLISH, GERMAN } from '../constants';
import frTranslationMessages from './languages/fr.json';
import { LANG_VARIABLE, ENGLISH, GERMAN, FRENCH } from '../constants';
import PersistentStore from '../utils/persistentStore';

const formatTranslationMessages = (locale, messages) => {
Expand All @@ -19,9 +20,10 @@ const formatTranslationMessages = (locale, messages) => {
const translationsObject = {
[ENGLISH]: formatTranslationMessages(ENGLISH, enTranslationMessages),
[GERMAN]: formatTranslationMessages(GERMAN, deTranslationMessages),
[FRENCH]: formatTranslationMessages(FRENCH, frTranslationMessages),
};

export const setupI18n = store => {
export const setupI18n = (store) => {
syncTranslationWithStore(store);
store.dispatch(loadTranslations(translationsObject));
const storageLang = PersistentStore.get(LANG_VARIABLE);
Expand All @@ -46,6 +48,8 @@ export const getLocales = (lang: string) => {
return ENGLISH;
case 'de':
return GERMAN;
case 'fr':
return FRENCH;
default:
return ENGLISH;
}
Expand Down
4 changes: 1 addition & 3 deletions webapp/src/translations/languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"keyValueLi": {
"copied": "Kopiert!"
},
"searchBar": [],
"spinner": [],
"statCard": [],
"syncStatus": {
"synchronized": "Synchronisiert",
"syncing": "Synchronisieren",
Expand Down Expand Up @@ -177,6 +174,7 @@
"appLanguage": "App Sprache",
"english": "Englisch",
"german": "Deutsch",
"french": "French",
"displayAmount": "Anzeige Beträge in Einheit",
"dFI": "DFI",
"fi": "fi",
Expand Down
4 changes: 1 addition & 3 deletions webapp/src/translations/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"keyValueLi": {
"copied": "Copied!"
},
"searchBar": {},
"spinner": {},
"statCard": {},
"syncStatus": {
"synchronized": "Synchronized",
"syncing": "Synchronizing",
Expand Down Expand Up @@ -177,6 +174,7 @@
"appLanguage": "App language",
"english": "English",
"german": "German",
"french": "French",
"displayAmount": "Display amounts in unit",
"dFI": "DFI",
"fi": "fi",
Expand Down
Loading