Reputation: 1204
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?
Upvotes: 1
Views: 3281
Reputation: 10004
Check out JTLocalize - https://github.com/joytunes/JTLocalize A really nice project that aims to help with localization workflow end to end.
Upvotes: 2