feat: language selector (#484)
* feat: language selector * refactor: move user general page * feat: language selector * refactor: move user general page * feat: add language combobox in user general
This commit is contained in:
@@ -5,9 +5,12 @@ import { createI18nClient } from "next-international/client";
|
||||
import { languageMapping } from "./lang";
|
||||
import enTranslation from "./lang/en";
|
||||
|
||||
export const { useI18n, useScopedI18n, I18nProviderClient } = createI18nClient(
|
||||
languageMapping(),
|
||||
{
|
||||
fallbackLocale: enTranslation,
|
||||
},
|
||||
);
|
||||
export const {
|
||||
useI18n,
|
||||
useScopedI18n,
|
||||
useCurrentLocale,
|
||||
useChangeLocale,
|
||||
I18nProviderClient,
|
||||
} = createI18nClient(languageMapping(), {
|
||||
fallbackLocale: enTranslation,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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];
|
||||
|
||||
21
packages/translation/src/locale-attributes.ts
Normal file
21
packages/translation/src/locale-attributes.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { SupportedLanguage } from ".";
|
||||
|
||||
export const localeAttributes: Record<
|
||||
SupportedLanguage,
|
||||
{
|
||||
name: string;
|
||||
translatedName: string;
|
||||
flagIcon: string;
|
||||
}
|
||||
> = {
|
||||
de: {
|
||||
name: "Deutsch",
|
||||
translatedName: "German",
|
||||
flagIcon: "de",
|
||||
},
|
||||
en: {
|
||||
name: "English",
|
||||
translatedName: "English",
|
||||
flagIcon: "us",
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user