wyoskibum
wyoskibum

Reputation: 1859

iOS: Localized UILabel text is missaligned

I'm updating an app to include localization for English (base) and Spanish. On my login screen in Storyboard I have an UILabel and an UISwitch for the user to select if they want to remember the Member Id for login.

enter image description here

I have added a translation for the label text in Main.strings (Spanish) file:

/* Class = "UILabel"; text = "Save Member ID"; ObjectID = "drT-iV-8Z7"; */
"drT-iV-8Z7.text" = "Guardar ID del miembro";

However, when I view in Spanish, the "Save Member ID" text is slightly indented.

enter image description here

I've confirmed that there is not any leading spaces, left justification is on and all of the labels have the same X coordinate. I am not seeing this behavior with any of the other localized strings.

Has anyone experienced this issue before? Thanks in advanced.

Upvotes: 1

Views: 183

Answers (2)

wyoskibum
wyoskibum

Reputation: 1859

I was able to resolve this by deleting the Spanish phrase from my .strings file and then re-create the phrase.

Upvotes: 0

Mundi
Mundi

Reputation: 80265

Such seemingly inexplicable UI glitches can be caused by:

  • Categories of UILabel that your code might contain;
  • Property changes using the appearance protocol

Check for the occurrence of these in your project.

The screenshot seems to indicate that you are modifying the labels with borders, rounded corners, etc. Examine your code doing these modifications. Specifically, you want to check if leftView and/or leftViewMode have been altered in any way.

Another thing to check is a project-wide text search for this phrase. It could be substituted again with the typo.

Upvotes: 1

Related Questions