Files
grafana/packages/grafana-prometheus/src/loadResources.ts
T
Ashley HarrisonandGitHub 0879479c15 Internationalisation: Mark up @grafana/prometheus package (#105861)
* scaffolding for grafana-prometheus i18n

* markup

* extract translations

* fix tests

* add loadResources + fix object properties

* fix typo + prettier

* remove useTranslate

* update workflow to trigger on changes to grafana-sql/grafana-prometheus packages
2025-06-12 11:29:33 +01:00

12 lines
471 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-prometheus.json`);
return acc;
}, {});
export const loadResources: ResourceLoader = async (resolvedLanguage: string) => {
const translation = await resources[resolvedLanguage]();
return translation.default;
};