Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Local en_CA provides empty strings for fromNow() #60

Open
nsainaney opened this issue Jul 1, 2016 · 1 comment
Open

Local en_CA provides empty strings for fromNow() #60

nsainaney opened this issue Jul 1, 2016 · 1 comment

Comments

@nsainaney
Copy link
Contributor

If your Region is Canada, the system should use the base en strings because en_CA is not provided. Instead, we see empty strings.

@twairball
Copy link

twairball commented Jul 19, 2016

this is an ios9 change; region is now tacked onto the end of locales (it's even more troublesome for chinese languages e.g. zh-Hant_CN, etc)

some discussion here re: locale
http://stackoverflow.com/questions/32976486/nslocale-preferredlanguages-contains-us-since-ios-9

I think while user region and language settings may be diverse, we may or may not want to enforce locale settings according to languages supported by the app. (i.e. my app supports english and chinese version only, so maybe I would only want to ensure those 2 language for strings?)

Question: Is there a way to set "global" locale for SwiftMoment? Would like to avoid passing locale during init.

        let availableLanguages = ["ar", "bg", "cs", "da", "de", "en_US", "en", "es", "fi", "fr", "gre", "he", "hu", "is", "it", "ja", "ko", "lv", "ms", "nb", "pl", "pt-PT", "ro", "ru", "sk", "sq", "sv", "th", "tr", "uk", "vi", "zh-Hans", "zh-Hant"]

      let localeIdentifier = NSBundle.preferredLocalizationsFromArray(availableLanguages).first ?? self.locale.localeIdentifier

        print ("best matched lang: \(localeIdentifier)")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants