-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
i18n lang should ignore uppercase/lowercase #820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…guage without country to match language with country
Fixes playframework#820 - matching country should be case insensitive Fixes playframework#1229 - q value sorting should be stable on order in request header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a lazy val? Lazy vals are expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. If it is called in a request, it is called many times, and so it should definitely by memoised (once calculated, a lazy val costs a volatile read). I'm not sure though how often Lang is instantiated in a request, and code not called. If that happens most requests, then lazy val seems to be the right thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could "lazy" be a premature optimisation then? We shouldn't start with something being lazy right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends. We use a lot of lazy vals on RequestHeader for example, since many of those fields are never touched by the average request, but they are expensive because they parse headers. This might be in a similar category.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok - still seems a bit lazy though... :-)
|
play2-master-PRs #279 SUCCESS |
i18n lang should ignore uppercase/lowercase
I use Mac with locale zh_CN
In application.conf
application.langs="en,zh-CN"
and I add messages.zh-CN right.
Message of Chinese show right for Chrome, but wrong for Safari and Mozilla(show english words).
and if I change all zh-CN to zh-cn, Mozilla and Safari becomes right and Chrome becomes wrong.
and I check with
curl --header "Accept-Language:zh-CN" http://localhost:9000/products
curl --header "Accept-Language:zh-cn" http://localhost:9000/products
Best Regards!