19 lines
574 B
TypeScript
19 lines
574 B
TypeScript
import type { stringOrTranslation, TranslationFunction } from "./type";
|
|
|
|
export * from "./type";
|
|
export * from "./locale-attributes";
|
|
|
|
export const supportedLanguages = ["en", "de"] as const;
|
|
export type SupportedLanguage = (typeof supportedLanguages)[number];
|
|
|
|
export const defaultLocale = "en";
|
|
export { languageMapping } from "./lang";
|
|
export type { TranslationKeys } from "./lang";
|
|
|
|
export const translateIfNecessary = (t: TranslationFunction, value: stringOrTranslation | undefined) => {
|
|
if (typeof value === "function") {
|
|
return value(t);
|
|
}
|
|
return value;
|
|
};
|