我正在设计一个将内容存储在数据库中的web服务,我希望确保该设计符合RFC2616。然而,我有点不清楚正确的方式来匹配内容。
如果我将行为指定为用户故事:
Given I request content in 'en_GB'
When the server has content in 'en_US'
and the server has content in 'en_CA'
and the server does not have content in 'en'
Then the server should return content in '???'问题:服务器应该以什么语言返回内容?
Update:基于pawel的回答,我认为这些故事应该如下所示:
Given I request content in 'en_GB'
When the server has content in 'en_US'
and the server has content in 'en_CA'
and the server has content in 'en'
Then the server should return content in 'en'
Given I request content in 'en_GB'
When the server has content in 'en_US'
and the server has content in 'en_CA'
and the server does not have content in 'en'
Then the server should return content in the server default language发布于 2014-06-07 15:36:21
你想要的是一个地方的退路。对于HTTP语言报头,I18n最佳实践规则是:
例如,假设应用程序包含德语翻译(de)和HTTP接受语言标题,如下所示:
接受-语言: fr-FR,de-AT;q=0.7
返回的语言应该是德语。
回到您的问题上,您应该返回的是默认的区域设置。显然,对于给定的语言有共同的资源是很好的(在本例中是en)。
https://stackoverflow.com/questions/24097467
复制相似问题