iOS Localization (Localizable.strings) not working

前端 未结 5 498
慢半拍i
慢半拍i 2021-01-05 12:12

I have an app with an \"Error\" message. I want to translate this error message.

OK, first I created a file named \"Localizable.strings\". In the file I wrote:

5条回答
  •  悲哀的现实
    2021-01-05 12:47

    The below mentioned steps might help you :

    1. Select "New File" by right click on files in left-pane of Xcode
    2. A window appears as show in screenshot 1
    3. Select "String" file
    4. Rename file as "Localizable.strings" as show in screenshot 2
    5. Add required text into file in following format : "newStringItem" = "This is new String item";

    6. Now the file contents can be used as NSLocalizedString(@"newStringItem", @"") which returns corresponding string.

    Vola! Done with Localization!

    Screenshot 1

    Screenshot 2

提交回复
热议问题