Below is what I did...
Added fonts in projects folder (english.ttf & arabic.ttf) as shown here.
In Localizable.strings
added "myFont"="ACS Zomorrod";
(Arabic) & "myFont"="Armalite Rifle";
(English)
and then had those font in condition
NSString *myFont = localize(@"myFont");
NSString *cpFont = @"Armalite Rifle";
if ([myFont isEqualToString:cpFont]) {
self.myLabel.textAlignment = NSTextAlignmentLeft; // this is for English
} else {
self.myLabel.textAlignment = NSTextAlignmentRight; // this is for Arabic
}
Edit 1
Also you could have "myLang"="arabic";
& "myLang"="english";
in Localizable.strings
and then have code as
NSString *myLang = localize(@"myFont");
NSString *myActualLang = @"english";
if ([myLang isEqualToString:myActualLang]) {
self.myLabel.textAlignment = NSTextAlignmentLeft; // this is for English
} else {
self.myLabel.textAlignment = NSTextAlignmentRight; // this is for Arabic
}
I will prefer the second option instead of first as tomorrow if I change the font, I would have to do changes at line NSString *cpFont = @"Armalite Rifle";
in all files.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…