I am working on reducing memory footprint (RAM) of an app. One potential area is to reduce the number of languages supported by our app.
I have dug deeper into NSLocalizedString and looks like only current locale localised string is loaded into the memory.
If I have 100s of localised strings files, then only current locale localised strings file will be loaded. And they are loaded into heap segment of the memory.
Am I right in that respect?
However, if I explicitly calls the following, then the requested localised string files will be loaded into NSMutuableDictionary:
let path = Bundle.main.path(forResource: lang, ofType: "lproj")
let bundle = Bundle(path: path!)
let str = NSLocalizedString("abhi", tableName: nil, bundle: bundle!, value: "", comment: "")
display(str)
Is my understanding correct? So I don't have to be worried about too many languages supported (localised strings files) as only current localised string file is loaded into RAM?
Let's say I do explicitly call NSLocalizedString() for specific language, then old NSMutuableDictionary won't be deallocated?