2

How can I change my app language as I am using xibs in my project.

/* Class = "UILabel"; text = "Clients"; ObjectID = "22E-Bc-4Af"; */
"22E-Bc-4Af.text" = "Klienci";

/* Class = "UILabel"; text = "Messages"; ObjectID = "5y0-E0-aXx"; */
"5y0-E0-aXx.text" = "Wiadomości";

/* Class = "UILabel"; text = "Calendar"; ObjectID = "H9g-zr-B2l"; */
"H9g-zr-B2l.text" = "Kalendarz";

/* Class = "UILabel"; text = "Settings"; ObjectID = "Hxq-Ij-R8l"; */
"Hxq-Ij-R8l.text" = "Ustawienia";

/* Class = "UILabel"; text = "Recommend"; ObjectID = "ka7-JK-tWz"; */
"ka7-JK-tWz.text" = "Poleć";

/* Class = "UILabel"; text = "Label"; ObjectID = "pYM-Zf-LI7"; */
"pYM-Zf-LI7.text" = "Label";

/* Class = "UILabel"; text = "Shop"; ObjectID = "zhW-HV-pnE"; */
"zhW-HV-pnE.text" = " Zakupy";

The xib is not changing when I change the app language, only the changes from the .string file.

TwoStraws
  • 12,862
  • 3
  • 57
  • 71
PAn Kaj Khatri
  • 539
  • 1
  • 6
  • 22

1 Answers1

0

You can't internationalize one xib directly. There are possibilities if you add a category for each component.

Sample:

@implementation UILabel (i18n)

- (void)localizeFromNib {
    if (self.text.length > 0) {
        self.text = [[NSBundle mainBundle] localizedStringForKey:self.text value:@"" table:nil];
    }
}

@end

But manually implement this is very hard work and may contain errors. I recommend you use AGi18n Pod, it already makes internationalization of each component.

Haroldo Gondim
  • 7,725
  • 9
  • 43
  • 62