Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from "react";
import ReactDOM from "react-dom";
import theme from "@instructure/ui-themes/lib/canvas";
import highContrastTheme from "@instructure/ui-themes/lib/canvas/high-contrast";
import "./index.css";
import App from "./App";
import registerServiceWorker from "./registerServiceWorker";
import { setupI18n } from "@lingui/core";
import { I18nProvider } from "@lingui/react";
import { AVAILABLE_LOCALES } from "./constants";
const queryString = require("query-string"); // has issue with module import
const parsedQueryString = queryString.parse(window.location.search);
export const i18n = setupI18n({});
const rawLocale = parsedQueryString["locale"];
const locale = AVAILABLE_LOCALES[rawLocale] ? rawLocale : "en";
i18n.activate(locale);
AVAILABLE_LOCALES[locale]().then(messages => {
const catalogs = {};
catalogs[locale] = messages;
i18n.load(catalogs);
});
const highContrastEnabled =
typeof parsedQueryString["high-contrast"] !== "undefined";
if (highContrastEnabled) {
highContrastTheme.use();
import("./high-contrast.css");
export async function activate(locale) {
const catalog = await import(
/* webpackChunkName: "i18n-[index]" */ `@lingui/loader!./locales/${locale}.po`
)
i18n.load(locale, catalog)
i18n.activate(locale)
}
export async function activate(locale) {
/* webpackMode: "lazy", webpackChunkName: "i18n-[index]" */
const catalog = await import(`@lingui/loader!./locales/${locale}.po`)
i18n.load(locale, catalog)
i18n.activate(locale)
}
export async function activate(locale) {
const catalog = await import(
/* webpackChunkName: "i18n-[index]" */ `@lingui/loader!./locales/${locale}.po`
)
i18n.load(locale, catalog)
i18n.activate(locale)
}
export async function activate(locale) {
/* webpackMode: "lazy", webpackChunkName: "i18n-[index]" */
const catalog = await import(`@lingui/loader!./locales/${locale}.po`)
i18n.load(locale, catalog)
i18n.activate(locale)
}
messages: {
age(a) {
return [a('age'), 'años de edad'];
}
}
};
function missingFn(language: string, id: string) {
return id;
}
const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });
const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);
const mark: string = i18nMark('mark');
});
const catalog: Catalog = {
messages: {
age(a) {
return [a('age'), 'años de edad'];
}
}
};
function missingFn(language: string, id: string) {
return id;
}
const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });
const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);
const mark: string = i18nMark('mark');
const catalog: Catalog = {
messages: {
age(a) {
return [a('age'), 'años de edad'];
}
}
};
function missingFn(language: string, id: string) {
return id;
}
const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });
const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);
const mark: string = i18nMark('mark');
age(a) {
return [a('age'), 'años de edad'];
}
}
};
function missingFn(language: string, id: string) {
return id;
}
const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });
const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);
const mark: string = i18nMark('mark');
function missingFn(language: string, id: string) {
return id;
}
const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });
const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);
const mark: string = i18nMark('mark');