Marking some XIB/Storyboard strings as not localizable
I am using Base Internationalization for XIB/Storyboard files and the “Export for Localization” method using XLIFF files for translators.
I have some labels, buttons, etc. that have text that should be translated, but I also have labels where we use some placeholder text (like a full-name) so you can see what the view would look like when populated with data, but those labels always have their text come from an outlet programmatically.
Is there some way to mark this label’s .text property that is set in the XIB as non-localizable so that it doesn’t end up in the XLIFF (or resulting .strings) files.
I know that I can remove the text — I also thought about having a prefix (like @”!DNL!”) to mean that the translator shouldn’t localize, but I am hoping that there is just a standard way to do this.
2 Solutions Collect From Internet About “Marking some XIB/Storyboard strings as not localizable”
This is now possible using the BartyCrouch command line utility which I recently wrote to solve this problem (see installation instructions in my answer on that thread).
ibtool for you and does additional processing on top of its resulting
.strings file. It will exclude views from translation if you include
#bc-ignore! into your value within your base internationalized Storyboard/XIB file.
Please checkout out the related section within the README on GitHub for detailed information.
It turns out the localization export from Xcode ignores attributed strings in the storyboard.
So just set the type of text for every label/button you want to exclude to
Attributed in the Attributes Inspector.
This will give you an attributed string rather than a plain string, which as far as I know has no implications, apart from the (empty) list of attributes that has to be kept in memory now.
- Interface Builder degrades storyboards, resizes and repositions views in small increments
- Make a custom back button for UINavigationController
- how to get the absolute position of a section header in tableview？
- “FBConnect/FBConnect.h” no such file or directory error
- Ambiguous use of 'sd_setImage(with:placeholderImage:completed:)' with Swift 3
- Best way to performselectoronmainthread in objective c?
- How to find max value for Double and Float in Swift
- Save original image data with modified metadata (no re-encoding) on iOS
- if we click on Custom Section Header in UITableView, then move that section to top
- How to rotate an object around a arbitrary point?
- Core Data bindings with subviews and multiple NIBs
- Where can I get the magnifying glass icon used in UISearchBar?
- how to set table cell height dynamically depending on text label length?
- Compiling custom SQLite for an iPhone app
- Swift 3 first parameter names