When I try to localize a string it returns previous value. I found in this post that you actually have to invalidate the cache.
More or less this is the code I tried. Inside localizableStringsPath
the file actually shows the translations I downloaded from inet, but bundle returns the previous value. I have to close the app, and then bundle return the previous value from localizableStringsPath
.
func translateFromInet(key: String) -> String {
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? ""
let localizableStringsPath = documentsPath + "/Localizable.strings" // This file is downloaded from the inet with custom translations
let bundle = Bundle(path: documentsPath)
return bundle!.localizedString(forKey: key, value: nil, table: nil)
}