1

I have one question about the best way to resolve a problem.

My project contains many ViewControllers, and this views contain any buttons or labels, right? I need localize all labels, but I think if I need write all texts in respective labels all language, it is a tedious work.

Well, because this scenario I do one Extension to UIViewController, this read all labels or buttons and use the current text like key. E.g.

let myViewController = UIViewController();
let myLabelTitle = UILabel();
let myLabelContent = UILabel();

myLabelTitle.text = "What do you do?";
myLabelContent.text = "Tell me more about you.";

myViewController.view.addSubView(myLabelTitle);
myViewController.view.addSubView(myLabelContent);

myViewController.localizeLabels() // <- This is my Extension, work fine.

The question is about, my Localizable.string will be construct like this

In English

"What do you do?" = "What do you do?"
"Tell me more about you." = "Tell me more about you."

In Portuguese

"What do you do?" = "O que você faz?"
"Tell me more about you." = "Me conte sobre você."

This is my question, Can I use Localizable.string like this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
ViTUu
  • 1,204
  • 11
  • 21

1 Answers1

2

Check out JTLocalize - https://github.com/joytunes/JTLocalize A really nice project that aims to help with localization workflow end to end.

JAR.JAR.beans
  • 9,668
  • 4
  • 45
  • 57
  • This framework look nice, but i don't like much the extension idea. I liked, but my question is if have problem with Localizable.strings with keys like complete text. What do you think? – ViTUu Apr 01 '15 at 10:33
  • 1
    Sorry, I missed your point than.. I can't see any issue with making the key as the full string. – JAR.JAR.beans Apr 01 '15 at 10:46
  • I found this tutorial using full text in key! http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014 – ViTUu Apr 01 '15 at 10:49