I use base internationalization in xCode to manage multiple languages in my app.
In a xib file I've got this object :
Xrj-9E-2VK it's an UITextView
In the corresponding strings file :
"Xrj-9E-2VK.text" = "text translated in french"
But my text is still in English.
Any Suggestion ?
strings files from the xib, which make localization pretty straight forward. Right click on the xib file in Xcode, and choose Get Info . Select the General tab and on the bottom click Make File Localizable . Then you will be able to add localizations by clicking Add Localization on that same tab.
A localized string can have different values depending on the language in which the project is being build. There are two categories of localized strings: the strings included in the installation package's UI, common to every MSI 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.
The key used to look up an entry in a strings file or strings dictionary file.
I've found the following workaround until Apple fixes this (serious) bug that still exists in iOS 7 :
You actually need to 'mix' the 'base localisation method' (= preferred method for Xcode 5 & iOS 7) with the 'older' method of using the 'Localizable.strings' file
1) create the file 'Localizable.strings' (File -> New -> iOS -> resource -> .strings file)
2) use Xcode to create localised versions of this file for each language you use (select the file 'Localizable.strings', in File Inspector under 'Localization' click on the selection button next to each language you use).
3) in your viewController create an IBOutlet @property for the UITextField :
@property (weak, nonatomic) IBOutlet UITextView *localizedTextView;
4) under 'viewDidLoad' add the following code :
self.localizedTextView.text = NSLocalizedString(@"textFieldKey", @"comment for the translator");
5) in each 'Localizable.strings' file add :
"textFieldKey" = "the translated text you want to be put in the textField";
That should do it !
Keep in mind that Apple will probably fix this bug somewhere in the near future, in that case the translation will be taken from the 'base localised storyboard' (the one with the object references in, like "a8N-K9-eJb.text" = "some translated text". In that case you can delete the 'Localization.strings' file, and use base localisation again for a UITextField
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