I followed various tutorials on "How To Localize an iOS(iPhone) App". All of them were suggesting to perform following steps,
But my iOS application xcode 7.2 project does not include any storyboard, so I am not able to enable “Use Base Internationalization” in my iOS application.
Please help me out how to enable “Use Base Internationalization” without storyboard selection and what should I do to perform various alert messages to be localized using "Localizable.strings" file.
Use it in custom SwiftUI views to make them ready for localization. Enable the "Use Compiler to Extract Swift Strings" build setting to extract LocalizedStringKeys from code when exporting for localization in Xcode. Format your strings to internationalize your code, and style them with Markdown.
Go to project->New Files->Resource-> String File-> Save it as Localizable.string
now
Now again go to project setting... then choose project instead of target in setting... Where you have only two options... Go in info section where you find localization... add your language here for localization.
created file is already in base Internationalization mode... now go to file and in side bar of right side check localize button... click on it and chooose language which you added in your project.
Base File-> "Enter a keyword to search" = "Enter a keyword to search"; Localize file -> "Enter a keyword to search" = "Localized String";
now to use this localized string you can fetch strings like this
label.text = NSLocalizedString("your String",nil);
Note:- string file should have name "Localizable"... if you not save it with this name... this will not work.. and you have to provide path every time you use localized string
Thanks to Divyanshu Sharma.
Here is steps for Xcode 8 (Swift 3).
Now you should have default localizations without Storyboards.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With