Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating Localization Files for iOS

I would like to localize one of my apps. But I just CANNOT seem to figure it out. I have tried to read apple's docs, and I have looked at a bunch of tutorials that I found by searching. I understand how to change all my strings to NSLocalizedStrings, and how to edit those localized files one there created, but my problem is I can't figure out how to create those directories in the first place.

How do you make those folders en.lproj and a spanish one. Also, how do you make the two string files that go inside them.

Step by step help would be greatly appreciated, or a link to a detailed tutorial on this part.

Thanks in advance.

Note: I've made countless attempts and an simply stuck.

like image 672
Andrew Avatar asked Apr 16 '11 14:04

Andrew


People also ask

How do you create a localization file?

Creation of localization files To create a localization file, all pieces of displayable text are replaced with unique IDs in the code files. The text strings are then added to the localization file with their IDs.

What is iOS localization?

Localization is the process of translating and adapting your app into multiple languages and regions. Localize your app to provide access for users who speak a variety of languages, and who download from different App Store territories.

How do you implement localization in iOS Swift?

Click on iOS->App/Single View App->Next. Name your project and select the language as Swift. Select a desired location and click on Create. To start with Localization, click on your Project Name -> go to Info Tab -> Under Localizations, click on the '+' button.

How do I add localization files to Xcode?

Right click your project folder, select 'New File' , then scroll down to find 'Strings', select it and click 'Next'. Then name the file as 'Localizable. strings' and click 'Create'.


2 Answers

you are nearly done with doing NSLocalizedStrings. You open up terminal.app and change the dir to your project by changing dir. Type in cd and drop in your project folder. Then tipe in: genstrings ./Classes/*.mthis will create a file with all strings you entered. Look in your project folder for Localizable.strings and drag it into Xcode project. Uncheck the box that says "copy into destination group..." and change the text encoding to UTF-16! Then open the info window for that file and check "Make file localizable", switch to general tab and enter for ex: fr for the new localization and click add. Now you can change the localization to french, where it says fr (or whatever you have)

like image 90
Silicone Avatar answered Oct 26 '22 13:10

Silicone


When selecting a file, in the Utility sidebar you will see the localization panel. There you can add languages.

like image 39
cweinberger Avatar answered Oct 26 '22 12:10

cweinberger