Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Can't extract string from a non default strings file

I've got two .strings files, Localizable.strings contains this:

"key" = "stuff x";

Which I can access as below, with s being assigned "stuff x":

let s = NSLocalizedString("key", value: "value", comment: "Comment")

Then I also have LocalizableLabels.strings, which contains this:

"key2" = "stuff";

I am attempting to access this as below:

let s2 = NSLocalizedString("key2", tableName:"LocalizableLabels.strings", value: "value", comment:"comment")

However s2 is being assigned "value" and not "stuff".

I have confirmed LocalizableLabels.strings is in the Copy Bundle Resources build section.

Why is NSLocalizedString not picking up and applying the filename when supplied as the tabelName?

Comments