mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 17:33:30 +08:00

* scaffolding for package * crowdin scaffolding * markup * add translations * fix locale location * fix tsconfig? * undo bundler change * object tranlsations, expose loadResources and call in mssql * prettier * remove useTranslate * extract translations * last couple of fixes * remove deleted files
12 lines
464 B
TypeScript
12 lines
464 B
TypeScript
import { LANGUAGES, ResourceLoader, Resources } from '@grafana/i18n';
|
|
|
|
const resources = LANGUAGES.reduce<Record<string, () => Promise<{ default: Resources }>>>((acc, lang) => {
|
|
acc[lang.code] = async () => await import(`./locales/${lang.code}/grafana-sql.json`);
|
|
return acc;
|
|
}, {});
|
|
|
|
export const loadResources: ResourceLoader = async (resolvedLanguage: string) => {
|
|
const translation = await resources[resolvedLanguage]();
|
|
return translation.default;
|
|
};
|