akosma / SwiftMoment

A time and calendar manipulation library for iOS 9+, macOS 10.11+, tvOS 9+, watchOS 2+ written in Swift 4.
http://akosma.github.io/SwiftMoment
BSD 2-Clause "Simplified" License
1.61k stars 147 forks source link

Device using Traditional Chinese in Taiwan (zh-Hant-TW) returning empty string #99

Open samwize opened 6 years ago

samwize commented 6 years ago

Detailed Description

getLanguageBundle is returning nil. Strangely, locale.identifier is returning zh-TW, without the "Hant".

The 2nd part of getLanguageBundle therefore only get the language code as zh.

Since now the bundle only has zh-Hant, no localized string is found.

Context

Localization does not work for Taiwan app users.

Possible Implementation

I believe another fallback using Bundle to load will work.

Your Environment

samwize commented 6 years ago

I have fixed in my fork here: https://github.com/samwize/SwiftMoment/commit/41e2b524bceb2281f36ef598a1dcab5e0b58e92e

What do you think?