I use Xcode 5 in a project. and the project need to localization. Xcode had help me generated Localizable.strings
it looks like
/* Class = "IBUIButton"; normalTitle = "2013-10-1"; ObjectID = "p5u-h7-pfJ"; */
"p5u-h7-pfJ.normalTitle" = "2013-10-1";
/* Class = "IBUILabel"; text = "Label"; ObjectID = "pBS-eN-YUz"; */
"pBS-eN-YUz.text" = "Label";
/* Class = "IBUITextField"; placeholder = "Input Name Here"; ObjectID = "pE4-WG-fPp"; */
"pE4-WG-fPp.placeholder" = "Input Name Here";
/* Class = "IBUILabel"; text = "Detail"; ObjectID = "qSu-Mo-baT"; */
"qSu-Mo-baT.text" = "Detail";
but how should I do if I want to add new UI in the storyboard. How can I add new key-value?
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. I would recommend this tutorial for step-by-step information (and pretty pictures).
The key used to look up an entry in a strings file or strings dictionary file.
In your storyboard, every single Object has an ID. In the 'Utilities' view, 'Identity Inspector' thumb, 'Document' section, there is a field 'Object ID'
I've never used this, but I guess that, if you have a label with ID 141-wB-KQD
and you want to set its text property, you have to put in your Localizable.strings
:
"141-wB-KQD.text" = "the value you want";
Make backup copies of a storyboard's .strings file for a locale that needs to be updated.
Select storyboard in the Project Navigator (in the left Xcode's pane), open File Inspector (right pane) and unmark checkbox for that locale.
In the 'Do you want to remove...' alert appeared, check 'Delete localized resource files from disk' checkbox and press 'Remove' button.
Mark back the same checkbox; this will generate localized resource file for the locale; it will contain entries for all objects including newly added but its contents will not be localized at all.
Merge this newly generated file with saved backup - this will restore all localizations you've done before.
Localize new objects.
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