How to localize label strings in iOS for a beginner?

前端 未结 2 730
青春惊慌失措
青春惊慌失措 2020-12-10 07:58

Hi I\'m very much stuck on the process of localization on iOS.

Here\'s what I do understand:

  • How to go to the project explorer and set base localizations
2条回答
  •  误落风尘
    2020-12-10 08:40

    For localization, you need to do:

    1. Add different .strings file for each language
    2. Add the Key value for each language file
    3. Use:

    NSLocalizedString(yourKey, nil);

    or

    [[NSBundle mainBundle] localizedStringForKey:(yourKey) value:@"" table:nil]
    

    For getting the localized string of passed key.

    Tutorials:

    1. Localization in iOS apps made simple
    2. iPhone Apps Localization Guide
    3. Preparing your iOS app for localization in Xcode

提交回复
热议问题