Is it possible to exclude sample text from Storyboard localization strings?

We are currently going through the process of localizing our app and are attempting to stick as close to Apple's recommendations as possible.


When we turn on localization for our storyboards, it creates an underlying strings file per language. Every control that has text gets represented as expected. However, in some cases we have used placeholder text to help visualize our design. When the app runs, that text would be replaced with dynamic content.


For example, we have a centralized notification system within our platform, where a notification can be sent out to all users. Notifications have a title, sender, date sent and the notification text itself. On the storyboard layout for that view we use a sample subject line, user name, date and notificaiton message. None of that needs to be translated and those fields will always have content based on the notification being viewed.


I know it is possible to add a comment for the Localizer that will show up as a note in the Strings file. But is it possible to exclude those strings from the strings files all together so that they are never part of the export/localization/import flow?


Thanks,

Jason

Post not yet marked as solved Up vote post of jay1234 Down vote post of jay1234
1.8k views

Replies

In the Identity inspector, in the Document part for the textField, above the comment for localizer, you have a lock button, with a selection :

"Non-localizable properties".

Isn't it what you're looking for ?


Anyway, what is the problem to have these strings in the localization files, if they never appear ? And if the translator knows with the comment they don't need to be localized.

My understanding of that Lock dropdown is meant to lock the control while translation is in progress. So you can Lock "Localizable Properties" to ensure they are not changed while you are waiting on translations to come back. Locking "Non-localizable properties" ensures you cannot edit other properties of the control.


The problem with just using comments is that they appear as part of the larger note generated for that item. Its already a note full of technical details a translator is just going to ignore. For example here is the exported XLIFF output of a UILabel with placeholder text and a Do Not Translate comment added in storyboard:


<trans-unit id="1cv-zx-pu2.text">

<source>Today 3:31pm</source>

<note>Class = "UILabel"; text = "Today 3:31pm"; ObjectID = "1cv-zx-pu2"; Note = "Do Not Translate";</note>

</trans-unit>


It requires extra manual work to determine if it should be translated or not. It is not a standardized way to skip translations, and has a negative impact on any effort to automate the process. Where as the XLIFF format supports the "translate=no" parameter as part of the trans-unit tag. Because thats part of XLIFF, the tools used to perform the translations are much more likely to know how to interpret it instead of some comment buried in the xcode output.


Our goal is to make this as simple as possible for the translator doing the work and I was just hoping I might have missed something in xcode, like a "Do Not Translate" check box.

If you work with tools as xLiffTool, you get a much more readable format, better than raw XML.


I have not seen such a Do not localize chackbox. Localization is a bit boring anyway.


You could of course edit the XML file and delete when you see "do not translate", but that's error prone and may be worse than leaving it in.


You could submit a bug report to ask for enhancement.