問題描述
假設您要將用戶偏好的語言環境存儲在數據庫中,您將使用哪個值?
Assume you want to store the locale of user preference in database, which value you will use?
en_US 或 en-US
en_US or en-US
它們是兩個標準,但您更喜歡將哪一個用作您自己的應用程序的一部分?
They are two standards, but which one you prefer to use as part of your own application?
更新:似乎很多網站都使用破折號而不是下劃線,例如
Updated: Is seems many web sites use dash instead of underscore, e.g.
http://zh.wikipedia.org/zh-twhttp://www.google.com.hk/search?hl=zh-TW
推薦答案
我很確定-"是標準.如果您看到_"在某個地方,它可能是某些人想出的讓它成為有效標識符的東西.
I'm pretty sure "-" is the standard. If you see "_" somewhere it's probably something some people came up with to make it a valid identifier.
為了正確起見,我個人會選擇-".
Personally I'd go with "-", just to be correct.
http://en.wikipedia.org/wiki/IETF_language_tag
https://datatracker.ietf.org/doc/html/rfc5646
這篇關于en_US 或 en-US,您應該使用哪一個?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!