Localization in iOS, sometime we want out app to change its UI/Language according to the location i.e Hindi in India, English in US. For doing this we have to put a little extra effort and our app is good to go. We will continue Localization we must know whats the difference between these 2 terms.
Localization is merely translating the app’s user interface and resources into different languages.
Internationalization is the process of designing your app for international compatibility. For example.
Handle text input, output processing in the user’s native language.
Handle different date, time and number formats.
Utilize the appropriate calendar and time zone for processing data.
Initiating the process : separating texts from the code
Create the String file Go to File > New > File. Choose Strings File under the Resource subsection.
Name the file Localizable.strings, its standard. In this file you have to define the text with respect to key like key content pair, you have to hardcode it all for all languages :
<span style="color: #ff6600;">"KEY"="CONTENT";
// Define all the text used in your app like above. //
Add different language support by selecting clicking on your project Name the click on Project in the next pane not Target. Click in the + icon below Localization section and select your required language.
Select the files you want to make localize.
#Note : Localize your string file too, click on your string file and on your right hand side in your Xcode in attribute inspector there is a button name Localize.
Showing the Localized text on UI elements.
// Showing the text on UI elements is just a single line of code.