I am trying to localize Swift framework and added a file Localizable.Strings and that file is included in the target but the app that consumes this framework is showing the key not the actual string.
NSLocalizedString("string_key", comment: "Actual String")
I think issue is related to bundle. Do I need to add bundle parameter to NSLocalizedString? If so what is the bundle parameter value? If bundle is not required then what must be the issue
Bundle was the problem. Default bundle is Bundle.main which is App's bundle not the framework bundle. Passing the frameworks bundle fixed the issue.
I used Bundle(identifier:) to get the framework's bundle. So the method will look like below.
NSLocalizedString("string_key", bundle: Bundle(identifier: "com.framework.bundle") ?? Bundle.main, comment: "Actual String")