I localized a part of my application with creating a base.lproj storyboard and 3 string files for it. It was a month ago and after that I added new view controller to app, b
The easiest and very less risky approach is, just copy the Object ID from the storyboard and add a new key for the key in the localized file as below example:
1: Copy object id as below from storyboard for the component:
2: Add new key in localised file like below:
"DjF-dn-0ay.text" = "Borrar datos y restablecer";
Note: This is very less risky approach if you want to update only few component otherwise you can recreate localised file for the storyboard.
Check out BartyCrouch, it perfectly solves your problem. Also it is open source, actively maintained and can be easily installed and integrated within your project.
Install BartyCrouch via Homebrew:
brew install bartycrouch
Alternatively, install it via Mint:
mint install Flinesoft/BartyCrouch
Incrementally update your Storyboards/XIBs Strings files:
$ bartycrouch update
This will do exactly what you were looking for.
In order to keep your Storyboards/XIBs Strings files updated over time I highly recommend adding a build script (instructions on how to add a build script here):
if which bartycrouch > /dev/null; then
bartycrouch update -x
bartycrouch lint -x
else
echo "warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch"
fi
In addition to incrementally updating your Storyboards/XIBs Strings files this will also make sure your Localizable.strings
files stay updated with newly added keys in code using NSLocalizedString
and show warnings for duplicate keys or empty values.
Make sure to checkout BartyCrouch on GitHub or this detailed article for additional information.
Option 1
Xcode can “reload” the file by converting the file to either an [Interface Builder Cocoa Touch Storyboard]
file type or a [Localizable Strings]
file type.
Select your base storyboard file from the Project Navigator
Find the Localization section in the File Inspector.
If your file is currently a [Localizable Strings]
, change it to [Interface Builder Cocoa Touch Storyboard]
or vice-versa.
Xcode should have converted your storyboard to the current version, while preserving your old localization efforts. Here you can change the file back to the original file type if you would like.
Option 2
Use ibtool
to extract the strings in your storyboard.
Open the Terminal application
Locate your Base.lproj
directory
Use this line to extract the strings:
ibtool MainStoryboard.storyboard --generate-strings-file file_name.strings
After ibtool extracts the strings to file_name.strings
, you can copy and paste it to your original .strings
file.
Xlifftool is available as a Mac app and works well. It shows all the translatable strings and objects from info.plist, localizable strings, and the storyboard.
Get it here for the mac: https://itunes.apple.com/lv/app/xlifftool/id1074282695?mt=12
Step 1: in Xcode, select your project folder in the project navigator. Then select Editor/Export for Localization...
Your translatable strings will be included in an xliff file under the language you selected for localization in Xcode.
Step 2: Open that file with xlifftool and translate or update your translations there were done previously.
Step 3: Then upload back into your project with Editor/Import Localizations...
When you click in your storyboard, Main.storyboard for example... On right side you can see the localization menu (see atached image). If you uncheck and check again a lenguage, the file will be generated again. So I usually copy the content, I generate the file again and then I paste the content that I copied and already been translated.
This is the way that I use to update the dictionary.
This is my easy way to update new text from storyboard or xib to localization string
1- use this script http://tredje.se/dev/trouble/?x=entry:entry150917-204052
2- select your localization string that you want to update and switch your language string from "Localization string" to "interface builder storyboard"
3- switch it back :)
Done.