From 3b022c8941b471430dcc04e1a51fe7730e8654eb Mon Sep 17 00:00:00 2001 From: MHA Date: Mon, 20 Jul 2020 15:55:59 +0200 Subject: [PATCH] feat(translations): add es and hu translations --- src/localize/localize.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/localize/localize.ts b/src/localize/localize.ts index 9786705..9b5f039 100644 --- a/src/localize/localize.ts +++ b/src/localize/localize.ts @@ -1,18 +1,22 @@ import * as en from './languages/en.json'; +import * as es from './languages/es.json'; +import * as hu from './languages/hu.json'; import * as nl from './languages/nl.json'; -var languages = { +const languages = { en: en, + es: es, + hu: hu, nl: nl, }; -export function localize(string: string, search: string = '', replace: string = '') { +export function localize(string: string, search: string = '', replace: string = ''): string { const section = string.split('.')[0]; const key = string.split('.')[1]; const lang = (localStorage.getItem('selectedLanguage') || 'en').replace(/['"]+/g, '').replace('-', '_'); - var tranlated: string; + let tranlated: string; try { tranlated = languages[lang][section][key];