2

I want to add comments in my storyboard.strings files, so that translators have some idea what they're translating.

When I use NSLocalizedString in code, I can use the second argument like so:

NSLocalizedString(@"OK", @"the button you click when things are OK");

to get a comment that looks like

/* the button you click when things are OK */ "OK" = "OK";

That really helps people translate things. It's much harder to know the context when the string looks like:

/* Class = "IBUIButton"; normalTitle = "Sign in"; ObjectID = "3R1-1d-v0R"; */ "3R1-1d-v0R.normalTitle" = "OK";

What should I do? Ideally, I'd like to have some sort of comment in the storyboard that gets output to the strings file. Is there some way to do that?

Diogenes Creosote
  • 1,922
  • 2
  • 17
  • 22

1 Answers1

1

Under the identity inspector for any object inside storyboard, you can set the accessibility for Label and Hint. You can type in your comments there. After you internationalise the storyboard, the comment will be there for your translator.

enter image description here

enter image description here

Ricky
  • 10,485
  • 6
  • 36
  • 49
  • This will render Accessibility (i.e. Voice Over) pretty much unusable. Visually impaired users of your app won't like misuse of the accessibility attributes. – Matthias Bauch May 08 '14 at 02:30
  • Yes, it can only be used if the app is not targeted for Visually impaired users. Or may be the comments can be described in a smart way which is good for translator and also for Visually impaired users. – Ricky May 08 '14 at 02:50
  • Good idea, but this doesn't really work for me. I'm using an online translation service that parses the `.strings` files and translates each block individually without reference to the adjacent ones. – Diogenes Creosote Sep 26 '14 at 23:31
  • Yes, The translation using XCode 6 is much easier right now compare with XCode 5 and below. – Ricky Sep 29 '14 at 13:01