我正在使用react-router,我需要允许链接的国际化;所以这是一个概要;
domain.com/langISO/countryISO2/page
例如,这些都是有效的路由;
domain.com/ -> Home Page
domain.com/en/us -> Home Page
domain.com/fr/fr -> Home Page
domain.com/en/gb/settings -> Settings Page
domain.com/en/gb/account -> Account Page
domain.com/settings -> Settings Page
domain.com/es/us -> Homepage (with spanish and united states localisation)
所以它就像
langISo或CountryISO将始终是一对两个字符串,并且将是有效的国家/地区ISO (它不需要知道countryISO是否正确,只需要知道它是否符合语法)。
发布于 2019-03-14 14:40:56
解决方案似乎是;
<Route path={['/:a([a-zA-Z]{2}\/[a-zA-Z]{2})/about', '/about']} component={AboutPage} />
需要两个区域设置,或者一个也不需要。
https://stackoverflow.com/questions/55163595
复制相似问题