How to localize an UILabel with attributed text using Storyboard and strings files?

My UILabels using attributed strings are not translated when using the Storyboard/Xib - strings localization approach.

I know I can use code to set the attributed text at runtime but I would like to use the default mechanism like for all other controls which don't use attributed strings.

I found this thread which had a similar problem but for UITextViews: https://developer.apple.com/forums/thread/27475

The "problem" is that when I select my Xib file and localize it for another language the UILabel with the attributed text (the whole text has the same attributes) does not get into the localized strings file.

Why is this and how can I make this work?

I also asked this question on Stackoverflow: https://stackoverflow.com/q/64062535

I hope to get an official answer here in case it's not supported.

Accepted Answer
This is not currently supported in Storyboard/XIB. I would encourage you to make a request on Feedback Assistant.
An attributed string can be instantiated from an RTF document, so while it's not automatic, you could localize an RTF document and fill your label with the contents of the RTF available in the current locale during early initialization.
Thank you for your responses.

@garywade
Thanks for the hint with the RTL document. I follow the approach to setup the attributes in Storyboard/Xib and fill the text with text from a localized string. This is sufficient in my case and I don't need to "localize" the attributes.

@AppleStaff
Thanks for the "official" confirmation that it's not supported. I haven't found any online other documentation which would tell me that. Maybe you can point me to one if it's written somewhere.
I also would like to understand the reasons for that, if you could led some light here.
As I wrote in my StackOverflow answer I used this approach:
Code Block
- (void)localizeAttributedLabel:(UILabel*)label withText:(NSString*)text
{
NSMutableAttributedString* attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:label.attributedText];
[attributedString.mutableString setString:text];
label.attributedText = attributedString;
}
/* Usage */
[self localizeAttributedLabel:myLabel withText:NSLocalizedString(@"MyLabelTextKey", nil)];

How to localize an UILabel with attributed text using Storyboard and strings files?
 
 
Q