MoathOthman / MOLH

Localization helper for iOS apps mainly focusing on the LTR/RTL issue
MIT License
117 stars 36 forks source link

currentAppleLanguage(): read up to a hyphen (if exists) to handle language ids longer than 2 chars (e.g. fil for Filipino) #36

Closed ahmedk92 closed 5 years ago

ahmedk92 commented 5 years ago

The current implementation of currentAppleLanguage() takes the first two characters of the first language identifier returned by the APPLE_LANGUAGE_KEY key. However, this may not work with locales with three-lettered identifiers (e.g. fil for Filipino). So, it seemed to me that that logic was there to handle hyphenated locale identifiers (e.g. en-US). So, I suggest reading up to that hyphen is a better solution. Thoughts?

MoathOthman commented 5 years ago

@ahmedk92 Good point!!!, thank you for the PR 👍