1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | module.exports = (localeId) => {
|
9 |
|
10 | if (typeof process.env.KOOT_PWA_PATHNAME !== 'string')
|
11 | return ''
|
12 |
|
13 | const i18nType = JSON.parse(process.env.KOOT_I18N)
|
14 | ? JSON.parse(process.env.KOOT_I18N_TYPE)
|
15 | : undefined
|
16 |
|
17 | const pwaPathname = JSON.parse(process.env.KOOT_PWA_PATHNAME)
|
18 |
|
19 | if (i18nType !== 'default')
|
20 | return pwaPathname
|
21 |
|
22 | if (!localeId)
|
23 | return pwaPathname
|
24 |
|
25 | const chunks = pwaPathname.split('.')
|
26 | chunks.splice(chunks.length - 1, 0, localeId)
|
27 | return chunks.join('.')
|
28 |
|
29 | }
|