Localization of UILabel with an assigned string from the storyboard

I have a UILabel with the text set as β€œattributed” in the storyboard. When I create a Main.strings file for translation into another language, the text for this label is not displayed.

I tried to manually add an entry to the Main.strings file by copying the object identifier. I tried to set the "text" property and the "attributedText" property, but when I started the application, the translated string is not used.

So, how can I localize the UILabel set as "attributed" on the storyboard?

+4
source share
1 answer

, .

, , , 1,5 , , .

UILabel , Attributed 1,5 .

setupUI UILabel.

@interface MyClass ()
@property (weak, nonatomic) IBOutlet UILabel *aLabel;
@end

@implementation MyClass
- (void)setupUI {
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:self.aLabel.attributedText];
    [attributedString.mutableString setString:NSLocalizedString(@"This is the label text which should be localisable.", "")];
    self.aLabel.attributedText = attributedString;
}
@end

attribitedString , , , , . , , Localizable.strings, " ".

, writringString . ( rtf, , Jelly).

+4

All Articles