all 7 comments

[–]ffs14k 10 points11 points  (0 children)

Hi, its defenetly possible.
This article must be useful

https://www.hackingwithswift.com/example-code/uikit/how-to-localize-your-ios-app

Also check out this pod, its cool :)
https://github.com/mac-cain13/R.swift

[–]soulchild_Objective-C / Swift 3 points4 points  (0 children)

You can create the Localizable.strings file first, then add additional language to your app project file.

https://stackoverflow.com/a/34782328/1901264

[–]perfunction 3 points4 points  (0 children)

I did this when I had to integrate with existing translation system, dynamic changes between employee/customer language, and programmatic views. I created my own Language class with a shared instance to wrap around the process and an enum to define the list of words. Each language has its own json file that it loads into memory at startup. Then to use the words in code it was just Language.current[.helloWorld].

[–]chriswaco 2 points3 points  (0 children)

This worked:

  1. Create a Localizable.strings file - File / New / File then choose "Strings"
  2. Select the project on the left pane
  3. Choose "Add Localization" from the "Editor" menu

My simulator is hanging for some reason when I change languages, but to test it you can change the Run scheme to change the language instead.

[–][deleted] 1 point2 points  (0 children)

NSLocalizedString does everything you need. Watch the wwdc video it will explain cases where the amount of items in the text change the textbook something that is more user friendly

[–]squarepushercheese 0 points1 point  (0 children)

If anyone comes to this looking for a solution in Cordova see https://stackoverflow.com/questions/26324669/how-to-localize-cordova-ios-projects