开发者

language vs locale for date-time formatting on ios

开发者 https://www.devze.com 2023-01-27 04:12 出处:网络
I noted that some apps change date-time formatting with the locale changing and not with the language changing, but also viceversa.

I noted that some apps change date-time formatting with the locale changing and not with the language changing, but also viceversa. What is the suggested way to localize date-time? According locale or language?

Fra开发者_如何学Pythonn


Locale is any combination of 3 things: country, language and a variant. There are well-known combinations of these 3 but you can mix and match these to make your own combination.

Now coming to your question, properly handling the date and time involves Locale, TimeZone and the date format. checkout this great presentation on i18n


In general you assume that the locale defines the presentation.

However, you can provide language specific choices for non-native speakers that essentially set their locale behind the scenes.

For example:

  1. User A speaks French and lives in UK - Locale is UK, but user prefs say Locale is France
  2. User B speaks English and lives in USA - Locale is USA, and user prefs default to American English.

That should satisfy most requirements.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号