Question

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.

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top