var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import i18next from 'i18next';
/**
 **Disclaimer
 * These commentaries are for the custom user translation that currently is not being used because of the 404 console
 * error that the fetch head shows.
 */
// import { fileExists, getRoute } from '../services/requests'
// import state from 'src/state'
function changeLanguage(language) {
    return __awaiter(this, void 0, void 0, function* () {
        // const customerNS = state.customer.slug
        // const route = getRoute()
        // const nsFileExists = await fileExists(
        //   `${route}/locales/${language}/${customerNS}.json`
        // )
        const nsFileExists = false;
        return new Promise((resolve, reject) => {
            if (!nsFileExists)
                i18next.setDefaultNamespace('translation');
            i18next.changeLanguage(language, (err) => {
                if (err)
                    reject(new Error('R2U - Change language failed'));
                resolve();
            });
        });
    });
}
export default {
    changeLanguage,
};
//# sourceMappingURL=config.js.map