仅当我将所有语言设置为NextI18Next
时,才能用localeSubpaths
初始化localeSubpaths
:
const localeSubpathVariations = {
none: {},
foreign: {
cs: 'cs',
de: 'de'
},
all: {
de: 'de',
en: 'en',
cs: 'cs',
},
}
const NextI18NextInstance = new NextI18Next({
defaultLanguage: 'en',
otherLanguages: ['cs', 'de'],
localeSubpaths: localeSubpathVariations['all'],
logging: true,
fallbackLng: 'en'
} as any)
将localeSubpaths
更改为localeSubpaths: localeSubpathVariations['all']
无效。
将localeSubpaths
设置为外部时,我在/cs
和/de
路径上得到404。
$ curl -I http://commerceowl.haproxy
HTTP/1.1 200 OK
$ curl -I http://commerceowl.haproxy/de
HTTP/1.1 404 Not Found
$ curl -I http://commerceowl.haproxy/cs
HTTP/1.1 404 Not Found
将localeSubpaths
设置为我的所有语言后,它将按预期工作:
$ curl -I http://commerceowl.haproxy
HTTP/1.1 302 Found
Location: /en
$ curl -I http://commerceowl.haproxy/de
HTTP/1.1 200 OK
$ curl -I http://commerceowl.haproxy/cs
HTTP/1.1 200 OK
我想访问我的英文版本而不添加/en
路径,而是使用/cs
和/de
路径访问外部版本。