2

I have a ReactNative project and I want to localize permission description usage of Infos.plist. I've read different SO answers but I don't understand how to make it work.

I have created InfosPlist.strings but don't understand what I'm supposed to do after, and I don't see any ability to add/select a language like it is seen in screenshots here: How to localise a string inside the iOS info.plist file?

Actually I don't even understand how am I supposed to add a language on my app, because there is no file to select here, and pressing finish does not add the french language to the list of localization languages.

enter image description here

Can someone tell me how am I supposed to add French support to my ReactNative app? Maybe this issue is specific to ReactNative apps, as most of the translations are done in JS?

Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419

2 Answers2

3

Select your project file in Project Navigator, and select your project in the project and targets list. Open Info tab, and click “+” button under Localizations section. Then choose a language you want to support from the dropdown list shown.

XCode opens a dialog showing resources to be added for the new language. Pressing the Finish button will generate these files under the new language project folder named [New Language].lproj. (In this example I added Japanese support, so ja.lproj folder is created.)

Localizable.strings file is where you add translation data as key-value pairs. Earlier versions of XCode used to generate a Localizable.strings file by default, and we were able to easily duplicate the Localizable.strings file for other languages. Recent versions of XCode doesn’t create Localizable.strings file by default. To add Localizable.strings file, go to File->New->File , choose Strings File under Resource tab of iOS, name it Localizable.strings , and create the file.

We now have two Localizable.strings files — one under the Base.lproj folder and the other one under the ja.lproj folder. Let’s add words and phrases used in the app to the Localizable.strings file of Base. Below is an example where I added “Welcome” = “Welcome”; The left hand side is so called Key which is later used by NSLocalizedString method to pull out the text in the right hand side. This is key-value pair type of data.

example : let alertTitle = NSLocalizedString("Welcome", comment: "")

  • To localize app title or other things defined in Info.plist file, create a InfoPlist.strings file. Go to File->New->File , choose Strings File under Resource tab of iOS , name it InfoPlist.strings. Select the Base.lproj folder as the location of InfoPlist.strings file. (By doing this, this InfoPlist.strings file is recognized as the one for the base language by XCode.) Normally we are interested in localizing these two values in info.plist file. CFBundleDisplayName — App name shown on the home screen NSHumanReadableCopyright – Krishan vir singh Aug 06 '18 at 10:22
  • As shawn in my screenshot, when I press "+" on localizations section to add french, there is no file to select, and pressing finish does actually nothing (the language is not added to the list). I am unable to follow the next instructions because french language folder do not seem to be created anywhere – Sebastien Lorber Aug 06 '18 at 10:31
  • 1
    And I'm not looking to translate swift/objective-c code because my app is translated with javascript already, I'm just looking for translation of Infos.plist permission keys – Sebastien Lorber Aug 06 '18 at 10:33
  • 1
    I'll accept the answer because the link actually was helpful. After le strings file is created, the important part is to click "localize" button on the right. After that, I'm able to add a language to the list and select this file in the popup that was previously empty – Sebastien Lorber Aug 06 '18 at 12:24
1

enter image description here

Please look at this screen shot

  • As said above: I am unablme to add a language to this list because there is no resource file to select in the following popup (displayed in my screenshot). What can I do then??? – Sebastien Lorber Aug 06 '18 at 11:25
  • 1
    Follow this link. https://hackernoon.com/localize-an-application-name-in-react-native-c36c4b2be7c3 – Krishan vir singh Aug 06 '18 at 12:00