-import * as i18next from 'i18next';
+import i18next from 'i18next';
+import { getLanguage } from './utils';
+import { en } from './translations/en';
+import { el } from './translations/el';
+import { eu } from './translations/eu';
+import { eo } from './translations/eo';
+import { es } from './translations/es';
+import { de } from './translations/de';
+import { fr } from './translations/fr';
+import { sv } from './translations/sv';
+import { ru } from './translations/ru';
+import { zh } from './translations/zh';
+import { nl } from './translations/nl';
+import { it } from './translations/it';
+import { fi } from './translations/fi';
+import { ca } from './translations/ca';
+import { fa } from './translations/fa';
+import { hi } from './translations/hi';
+import { pl } from './translations/pl';
+import { pt_BR } from './translations/pt_BR';
+import { ja } from './translations/ja';
+import { ka } from './translations/ka';
+import { gl } from './translations/gl';
+import { tr } from './translations/tr';
+import { hu } from './translations/hu';
+import { uk } from './translations/uk';
+import { sq } from './translations/sq';
+import { km } from './translations/km';
+import { ga } from './translations/ga';
+import { sr_Latn } from './translations/sr_Latn';
+import { ko } from './translations/ko';
// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
const resources = {
- en: {
- translation: {
- subscribed_to_communities:'Subscribed to <1>communities</1>',
- create_a_community: 'Create a community',
- trending_communities:'Trending <1>communities</1>',
- edit: 'edit',
- number_of_users:'{{count}} Users',
- number_of_posts:'{{count}} Posts',
- number_of_comments:'{{count}} Comments',
- modlog: 'Modlog',
- admins: 'admins',
- powered_by: 'Powered by',
- landing_0: 'Lemmy is a <1>link aggregator</1> / reddit alternative, intended to work in the <2>fediverse</2>.<3></3>Its self-hostable, has live-updating comment threads, and is tiny (<4>~80kB</4>). Federation into the ActivityPub network is on the roadmap. <5></5>This is a <6>very early beta version</6>, and a lot of features are currently broken or missing. <7></7>Suggest new features or report bugs <8>here.</8><9></9>Made with <10>Rust</10>, <11>Actix</11>, <12>Inferno</12>, <13>Typescript</13>.',
-
-
- foo: 'foo',
- bar: '<1>bar</1>',
- baz: '<1>{{count}}</1>',
- qux: 'qux<1></1>',
- qux_plural: 'quxes<1></1>',
- quux: '<1>{{name, uppercase}}</1>',
- userMessagesUnread: 'Hello <1>{{name}}</1>, you have {{count}} unread messages. <3>Go to messages</3>.',
- userMessagesUnread_plural: 'Hello <1>{{name}}</1>, you have {{count}} unread messages. <3>Go to messages</3>.'
- },
- },
+ en,
+ el,
+ eu,
+ eo,
+ es,
+ ka,
+ hi,
+ de,
+ zh,
+ fr,
+ sv,
+ ru,
+ nl,
+ it,
+ fi,
+ ca,
+ fa,
+ pl,
+ pt_BR,
+ ja,
+ gl,
+ tr,
+ hu,
+ uk,
+ sq,
+ km,
+ ga,
+ sr_Latn,
+ ko,
};
-function format(value: any, format: any, lng: any) {
- if (format === 'uppercase') return value.toUpperCase();
- return value;
+function format(value: any, format: any, lng: any): any {
+ return format === 'uppercase' ? value.toUpperCase() : value;
}
i18next.init({
- lng: 'en',
- resources,
- interpolation: {
- format: format
- }
+ debug: false,
+ // load: 'languageOnly',
+
+ // initImmediate: false,
+ lng: getLanguage(),
+ fallbackLng: 'en',
+ resources,
+ interpolation: { format },
});
-export { i18next, resources };
+export { i18next as i18n, resources };