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:
- User A speaks French and lives in UK - Locale is UK, but user prefs say Locale is France
- User B speaks English and lives in USA - Locale is USA, and user prefs default to American English.
That should satisfy most requirements.
精彩评论