Locallized text not loaded/showed only on some device.

Hello.

I have a strange issue with localized text. On some device (iPhone X with iOS 15.2.1 and iPhone 14 Pro with iOS 16.7.2) the localized isn't loaded and the UILabel is empty. In all the others UILabel in the view the localized text is correctly showed.

It works perfectly on iPhone 8 with iOS 16.4.1, iPhone 8 with iOS 16.7 iPhone 12 with iOS 17.3, and also on iPhone 14 Pro 17.2 Simulator.

Below the text from the localizable file: "m_alert_message" = "E' disponibile nello store la nuova App CAME Access. Vuoi iniziare la procedura per trasferire i dati di impianto nella nuova App?";

and how set the text property of the UILabel:

        messageLabel.text = NSLocalizedString("m_alert_message", comment: "")
        messageLabel.lineBreakMode = .byWordWrapping
        messageLabel.textAlignment = .center
        messageLabel.numberOfLines = 0
        messageLabel.font = UIFont(name: XipAppearance.fontName, size: XipAppearance.fontSizeText)
        containerView.addSubview(messageLabel)

Another strange thing is all other texts in all other views are correctly loaded and showed.

Does anyone have any idea what the problem might be?

Could you try a few things, just for testing ?

  • Comment out formatting:
        messageLabel.text = NSLocalizedString("m_alert_message", comment: "")
        // messageLabel.lineBreakMode = .byWordWrapping
        // messageLabel.textAlignment = .center
        // messageLabel.numberOfLines = 0
        // messageLabel.font = UIFont(name: XipAppearance.fontName, size: XipAppearance.fontSizeText)
        containerView.addSubview(messageLabel)

Does it show now ?

  • Replace the text in the localized file, by a shorter one
"m_alert_message" = "disponibile";

Does it show now ?

 

texts in all other views are correctly loaded and showed

And of course, they are localized as well ?

@Claude31 Thanks for the reply and for the suggestion. Of course all the others text are localized as well.

What is the result of the test ?

Locallized text not loaded/showed only on some device.
 
 
Q