lemmy/ui/src/i18next.ts
Dessalines 134a21158e Squashed commit of the following:
commit 3008b45a89
Author: Dessalines <happydooby@gmail.com>
Date:   Thu Aug 15 14:11:02 2019 -0700

    Adding moment translation, and to i18next.ts file.

commit 620be4ecd8
Author: Autom <40275136+AutomCoding@users.noreply.github.com>
Date:   Thu Aug 15 19:08:57 2019 +0200

    Minor tweaks

    Line 74: Change grammatical gender to neutrum for undefined target.
    Line 126: Possibly a more accurate translation.

commit e053040c58
Author: Autom <40275136+AutomCoding@users.noreply.github.com>
Date:   Thu Aug 15 18:55:32 2019 +0200

    Translate remaining Swedish

commit b126b59e15
Author: Autom <40275136+AutomCoding@users.noreply.github.com>
Date:   Thu Aug 15 18:38:20 2019 +0200

    Typo (missing apostrophe in contraction)

commit 50a0c6b590
Author: Autom <40275136+AutomCoding@users.noreply.github.com>
Date:   Thu Aug 15 18:36:22 2019 +0200

    Create sv.ts

    First half translated
2019-08-15 14:11:22 -07:00

39 lines
816 B
TypeScript

import * as i18n from 'i18next';
import { getLanguage } from './utils';
import { en } from './translations/en';
import { de } from './translations/de';
import { zh } from './translations/zh';
import { fr } from './translations/fr';
import { sv } from './translations/sv';
// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
// TODO don't forget to add moment locales for new languages.
const resources = {
en,
de,
zh,
fr,
sv,
}
function format(value: any, format: any, lng: any) {
if (format === 'uppercase') return value.toUpperCase();
return value;
}
i18n
.init({
debug: true,
// load: 'languageOnly',
// initImmediate: false,
lng: getLanguage(),
fallbackLng: 'en',
resources,
interpolation: {
format: format
}
});
export { i18n, resources };