ios - Flip layout on iPhone for RTL languages -
here issue :
i've localized application in arabic. (it's different regular localization, have different targets, 1 each language).
on simulator, view flipped, auto-layout , leading / trailing part of constraints, can't seem same result on device. autolayout + rtl + uilabel text alignment shows example of flipped view on simulator.
i've found indication supported in auto-layout guide : « the attributes leading , trailing same left , right left-to-right languages such english, in right-to-left environment such hebrew or arabic, leading , trailing same right , left ». lets me think supposed flip view, on simulator.
i use -applelanguages (ar_sa)
in scheme on simulator, flips view, fail find proper setting in device same thing. setting language , region format arabic doesn't seem much. on iphone 4s, ios 7.0.4
tldr: setting should change on actual iphone device in « arabic environment » , have flipped view, or missing flips in simulator not on device ?
ended adding following :
int main(int argc, char *argv[]) { @autoreleasepool { #if target == target_ar nsuserdefaults * defaults = [nsuserdefaults standarduserdefaults]; [defaults setobject:[nsarray arraywithobject:@"ar-sa"] forkey:@"applelanguages"]; [defaults synchronize]; #endif return uiapplicationmain(argc, argv, nsstringfromclass([snfidledetectorapplication class]), nsstringfromclass([snfappdelegate class])); } }
though find kind of ugly.
edit : may interesting note when set arabic, device shows @"ar"
applelanguages first value, , not @"ar-sa"
. guess flipping view doesn't work @"ar"
locale, although i'm unsure whether that's bug, or if arabic countries write ltr, making sense not systematically flip view.
Comments
Post a Comment