forked from HHS/simpler-grants-gov
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext-i18next.config.js
52 lines (49 loc) · 1.59 KB
/
next-i18next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// @ts-check
/**
* Next.js i18n routing options
* https://nextjs.org/docs/advanced-features/i18n-routing
* @type {import('next').NextConfig['i18n']}
*/
const i18n = {
defaultLocale: "en",
// Source of truth for the list of languages supported by the application. Other tools (i18next, Storybook, tests) reference this.
// These must be BCP47 language tags: https://en.wikipedia.org/wiki/IETF_language_tag#List_of_common_primary_language_subtags
locales: ["en", "es"],
};
/**
* i18next and react-i18next options
* https://www.i18next.com/overview/configuration-options
* https://react.i18next.com/latest/i18next-instance
* @type {import("i18next").InitOptions}
*/
const i18next = {
// Default namespace to load, typically overridden within components,
// but set here to prevent the system from attempting to load
// translation.json, which is the default, and doesn't exist
// in this codebase
ns: "common",
defaultNS: "common",
fallbackLng: i18n.defaultLocale,
interpolation: {
escapeValue: false, // React already does escaping
},
};
/**
* next-i18next options
* https://github.com/i18next/next-i18next#options
* @type {Partial<import("next-i18next").UserConfig>}
*/
const nextI18next = {
// Locale resources are loaded once when the server is started, which
// is good for production but not ideal for local development. Show
// updates to locale files without having to restart the server:
reloadOnPrerender: process.env.NODE_ENV === "development",
};
/**
* @type {import("next-i18next").UserConfig}
*/
module.exports = {
i18n,
...i18next,
...nextI18next,
};