feat: setup i18next
All checks were successful
Deploy to VPS (dist) / deploy (push) Successful in 1m27s
All checks were successful
Deploy to VPS (dist) / deploy (push) Successful in 1m27s
This commit is contained in:
21
i18next.config.ts
Normal file
21
i18next.config.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { readdirSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
export const LOCALES_PATH = join("locales");
|
||||
export const LOCAL_LOCALES_PATH = join("public", LOCALES_PATH);
|
||||
export const DEFAULT_LANGUAGE = "en";
|
||||
|
||||
export default {
|
||||
locales: readdirSync(LOCAL_LOCALES_PATH)
|
||||
.filter((file) => file.endsWith(".json"))
|
||||
.map((locale) => locale.replace(".json", "")),
|
||||
defaultLocale: DEFAULT_LANGUAGE,
|
||||
fallbackLng: DEFAULT_LANGUAGE,
|
||||
react: {
|
||||
useSuspense: false,
|
||||
},
|
||||
extract: {
|
||||
input: "src/**/*.{js,jsx,ts,tsx}",
|
||||
output: join(LOCAL_LOCALES_PATH, "{{language}}.json"),
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user