Monday, August 15, 2022
HomeiOS Developmentios - Concern with localization XCODE

ios – Concern with localization XCODE

[ad_1]

I’ve some points making an attempt to localize my app. I used the Interface builder to construct my app, and I attempted 2 completely different strategies to attempt to localize it:

The primary technique I attempted is utilizing localizable strings from the storyboard:
The problems with this technique are: the font adjustments from the one I set within the interface builder, and once I change the phrases within the strings, the phrases stay in English

The second technique I attempted is utilizing interface builder storyboard and simply use NSLocalizedString for all the weather:
I’m utilizing UIT extViews, UIButtons, (customized)UIBarButtonItems, and UILabels. To date I can solely handle to localise UIButtons utilizing:

label1.setTitle(NSLocalizedString("button1", remark: ""), for: .regular)

the phrases are translated however the font adjustments once more, and I attempted utilizing:

label1.titleLabel!.font = UIFont(identify: "Helvetica Daring", measurement: 20)

however the font nonetheless stays the identical. And when I attempt to localize the opposite UI components utilizing:

label1.textual content = NSLocalizedString("label1", remark: "")

textview1.textual content = NSLocalizedString(“textview1", remark: "")

backButtonOutlet.title = NSLocalizedString("backButtonOutlet1", remark: "")

I get the next error message for every of them:

Deadly error: Unexpectedly discovered nil whereas implicitly unwrapping an Elective worth

However I did set the textual content for every of them within the interface builder

[ad_2]

RELATED ARTICLES

Most Popular

Recent Comments