Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(frontend): setting next-i18next

이강준96ebe3e3d24f
diff --git a/frontend/next-i18next.config.js b/frontend/next-i18next.config.js
new file mode 100644
index 0000000000..d6812e5b3f
--- /dev/null
+++ b/frontend/next-i18next.config.js
@@ -0,0 +1,34 @@
+// @ts-check
+
+/**
+ * @type {import('next-i18next').UserConfig}
+ */
+module.exports = {
+ // https://www.i18next.com/overview/configuration-options#logging
+ debug: process.env.NODE_ENV === "development",
+ i18n: {
+ defaultLocale: "en",
+ locales: ["en", "de"],
+ },
+ /** To avoid issues when deploying to some paas (vercel...) */
+ // localePath:
+ // typeof window === "undefined"
+ // ? require("path").resolve("./public/locales")
+ // : "/locales",
+ localePath: (locale, namespace, missing) => {
+ const data = JSON.parse(
+ require("path").resolve(`./public/locales/${locale}.json`)
+ );
+ return data.default[namespace];
+ },
+
+ reloadOnPrerender: process.env.NODE_ENV === "development",
+
+ /**
+ * @link https://github.com/i18next/next-i18next#6-advanced-configuration
+ */
+ // saveMissing: false,
+ // strictMode: true,
+ // serializeConfig: false,
+ // react: { useSuspense: false }
+};
diff --git a/frontend/next.config.js b/frontend/next.config.js
index 905aa8c8a3..cb44c4ac55 100644
--- a/frontend/next.config.js
+++ b/frontend/next.config.js
@@ -1,4 +1,4 @@
-// next.config.js
+const { i18n } = require("./next-i18next.config.js");
const nextTranslate = require("next-translate");
const ContentSecurityPolicy = `
@@ -50,7 +50,7 @@ const securityHeaders = [
},
];
-module.exports = nextTranslate({
+module.exports = {
output: "standalone",
async headers() {
return [
@@ -64,4 +64,5 @@ module.exports = nextTranslate({
webpack: (config, { isServer, webpack }) => {
return config;
},
-});
+ i18n,
+};