<commit_before>import i18next from 'i18next';

import {
    TRANSLATION_EN_US,
    TRANSLATION_ES_ES,
    TRANSLATION_FR_FR,
    TRANSLATION_HU_HU,
    TRANSLATION_IT_IT,
    TRANSLATION_JA_JP,
    TRANSLATION_NL_NL,
    TRANSLATION_PT_BR,
    TRANSLATION_ZH_CN
} from '../../locales';

class I18nEngine {
    private static instance: I18nEngine;
    private constructor() {}
    public static getInstance() {
        if (!I18nEngine.instance) {
            I18nEngine.instance = new I18nEngine();
        }
        return I18nEngine.instance;
    }

    private availablesLanguages = {
        'en-US': 'en-US',
        'es-ES': 'es-ES',
        'fr-FR': 'fr-FR',
        'hu-HU': 'hu-HU',
        'it-IT': 'it-IT',
        'ja-JP': 'ja-JP',
        'nl-NL': 'nl-NL',
        'pt-BR': 'pt-BR',
        'zh-CN': 'zh-CN'
    };

    public fallbackLanguage = 'en-US';

    public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }

    public translate(key: string): string {
        return i18next.t(key);
    }

    public supportLanguage(language: string): boolean {
        return typeof this.availablesLanguages[language] !== 'undefined';
    }<commit_msg>Add German translation<commit_after>import i18next from 'i18next';

import {
    TRANSLATION_EN_US,
    TRANSLATION_ES_ES,
    TRANSLATION_DE_DE,
    TRANSLATION_FR_FR,
    TRANSLATION_HU_HU,
    TRANSLATION_IT_IT,
    TRANSLATION_JA_JP,
    TRANSLATION_NL_NL,
    TRANSLATION_PT_BR,
    TRANSLATION_ZH_CN
} from '../../locales';

class I18nEngine {
    private static instance: I18nEngine;
    private constructor() {}
    public static getInstance() {
        if (!I18nEngine.instance) {
            I18nEngine.instance = new I18nEngine();
        }
        return I18nEngine.instance;
    }

    private availablesLanguages = {
        'de-DE': 'de-DE',
        'en-US': 'en-US',
        'es-ES': 'es-ES',
        'fr-FR': 'fr-FR',
        'hu-HU': 'hu-HU',
        'it-IT': 'it-IT',
        'ja-JP': 'ja-JP',
        'nl-NL': 'nl-NL',
        'pt-BR': 'pt-BR',
        'zh-CN': 'zh-CN'
    };

    public fallbackLanguage = 'en-US';

    public init(language: string) {
        i18next.init({
            lng: language,
            fallbackLng: this.fallbackLanguage
        });
        i18next.addResources('de-DE', 'translation', TRANSLATION_DE_DE);
        i18next.addResources('en-US', 'translation', TRANSLATION_EN_US);
        i18next.addResources('es-ES', 'translation', TRANSLATION_ES_ES);
        i18next.addResources('fr-FR', 'translation', TRANSLATION_FR_FR);
        i18next.addResources('hu-HU', 'translation', TRANSLATION_HU_HU);
        i18next.addResources('it-IT', 'translation', TRANSLATION_IT_IT);
        i18next.addResources('ja-JP', 'translation', TRANSLATION_JA_JP);
        i18next.addResources('nl-NL', 'translation', TRANSLATION_NL_NL);
        i18next.addResources('pt-BR', 'translation', TRANSLATION_PT_BR);
        i18next.addResources('zh-CN', 'translation', TRANSLATION_ZH_CN);
    }

    public translate(key: string): string {
        return i18next.t(key);
    }

    public supportLanguage(language: string): boolean {
        return typeof this.availablesLanguages[language] !== 'undefined';
    }
{'fraction_non_alphanumeric': 0.14100938371798125, 'fraction_numerical': 0.019781891960436216, 'mean_word_length': 2.766953199617956, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '496519', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1335, 'n_words': 220}