1

Approach I have implemented localization using string file as given below: enter image description here enter image description here

Question

Is this possible to add new language file at runtime?

1
  • @RajeshKumarR this is not I wanted. I want to add new language file as mentioned in above question. Commented Jun 12, 2018 at 6:27

1 Answer 1

1

You can just create the proper bundle directories and strings files yourself and use the longer version of NSLocalizedString.

An approach is described here by Alejandro Martinez:

// The two important new parameters are `tableName` and `bundle`. 
// By default when using NSLocalizedString the system uses the App 
// main bundle and the Localizable table, *table* meaning the name 
// of the strings file. So to hook into the localization system we 
// just need to convert the object structure that we have in memory 
// to the proper file hierarchy that is expected on disk.
NSLocalizedString(_ key: String, tableName: String? = default, 
  bundle: Bundle = default, value: String = default, comment: String)
  -> String
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.