3

Does iOS support multiple localization of strings which depends on available width? If it does how it can be done? Or do I have to this manually (by handling applications states)?

For example in Qt you can provide multiple strings, each version is separated by spatial characters and they are provided starting from longest to shorted version.
String version is selected by searching the longest version which fits in current width.

To be more specific: I have some UI element which changes size depending on orientation. In all languages it everything is fine but in Russian locale and portrait orientation text is clipped. I wish to to fix it without a boiler plate code (problem with only one localization), but it seems it unavoidable.

1 Answer 1

2

iOS does not have a similar support. Usually you use autolayout to adjust the layout of your labels depending on the string length (I think you need the opposite).

I would obtain the function you need subclassing UILabel and overriding the setText method, setting the text based on the width of the label (sizeWithAttributes).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks looks like I have to add spatial case string and add some crappy code to handle single localization. I can't do it another way around since I don't have enough room for that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.