Search code examples
iosxcodelocalizable.strings

How to create multiple .strings file in Xcode other than Localizable.strings


Sometimes, the app contains a lot of texts and the Localizable.strings seems to be flooding with too much strings that makes me hard to find the right string to edit(even if I added comments for the strings).

I would like to create multiple .strings and set each .strings file to corresponding features or set of storyboards for the app.

I tried changing the file name of Localizable.strings to other names like TestOnly.strings but Xcode doesn't seem to read every .strings file available and I can't find the a single setting under build settings that tells Xcode to read strings under Localizable.strings. Is this default and unchangeable?

Please take note that I am not asking on how to localize strings to support different languages. What I want is like for example my Localizable.strings contains

"test_string" = "This is a test"; "test_string2" = "Another test";

then I want "test_string2" to be placed in another .strings file like OtherLocalizable.strings which can still be recognized by Xcode.

I hope you guys get my point.


Solution

  • In Xcode, File -> New -> File... , scroll to Resource group, select String File

    Create Strings File

    Localize

    Strings File in project

    Read your string by NSLocalizedStringFromTable(@"yourString", @"File", nil)