lngyeen / MySurveyChallenge

0 stars 0 forks source link

[Question] Localization workflow #30

Closed blyscuit closed 4 months ago

blyscuit commented 4 months ago

Issue

lngyeen commented 4 months ago

To be honest, I haven't paid attention to this topic in a long time :)

The usual way is to add supported languages to the xcode project and use .strings files to store translated text, and use NSLocalizedString to load them into the UI. This is the way that encouraged by Apple, but with this method, the user must change the language in the iOS Settings app.

Another way is switching locale inside the app code. In the project we are working on, we use the library https://github.com/marmelroy/Localize-Swift. Basically it will change the AppleLanguages stored in UserDefaults and notify a notification named LCLLanguageChangeNotification, based on this notification we will re-render the UI. We also use https://app.phrase.com/ to store translated texts and write a small script to fetch localized texts and generate swift code from localized strings files but in a very simple format. In terms of generating swift code, I think we should switch to https://github.com/SwiftGen/SwiftGen to get more support.

No we did not manage localization on CICD.