-
Notifications
You must be signed in to change notification settings - Fork 79
/
i18n.js
39 lines (35 loc) · 1.46 KB
/
i18n.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
/** @type {import('next-translate').I18nConfig} */
module.exports = {
//-----------------------------------------------------------------------------
// THIS MUST MATCH DEFAULT_LOCALE CONST
defaultLocale: 'en-UK',
//-----------------------------------------------------------------------------
// THIS MUST MATCH SUPPORTED_LANGUAGES CONST + 'en-US' for development Also,
//
// Please also ensure 'docker/deploy/web/run.sh' reflects the new language
// set. A different set of pages will need to be flushed from the ISR cache on
// production boot.
locales: ['en-US', 'en-UK', 'es-ES', 'fr-FR'],
pages: {
'*': ['auth', 'collection', 'common', 'forms', 'home', 'release'],
'rgx:/drops': ['drops', 'nft'],
'rgx:/marketplace': ['drops', 'nft'],
'rgx:/asset': ['asset'],
'rgx:/my/profile': ['profile', 'nft'],
'rgx:/nft': ['nft'],
'rgx:/checkout': ['nft'],
},
// Needed to dynamically load languages within APIs using `getT()`
// https://github.com/vinissimus/next-translate/issues/484#issuecomment-899593712
loadLocaleFrom: async (lang, ns) => {
// NOTE: To support dev being in 'en-US', manually switch the language code
if (process.env.NODE_ENV !== 'production' && lang === 'en-UK') {
lang = 'en-US'
}
if (process.env.NODE_ENV === 'production' && lang === 'en-US') {
lang = 'en-UK'
}
/// Note: still a bug with using `import(...).then(...)`
return require(`./languages/${lang}/${ns}.json`)
},
}