Connect the OS language with isRTL
Summary: Create isDeviceLanguageRTL function to connect the OS language with isRTL. Now even if a new app could support RTL language, without setting forceRTL at JS side it won't directly change into RTL layout. Reviewed By: fkgozali Differential Revision: D3473109 fbshipit-source-id: ac1410c910e980d44750bb88cad7615febb9e076
This commit is contained in:
parent
167654248b
commit
fa6022dc1a
|
@ -24,7 +24,9 @@
|
|||
|
||||
- (BOOL)isRTL
|
||||
{
|
||||
if ([self forceRTL]) return YES;
|
||||
if ([self forceRTL] && [self isDevicePreferredLanguageRTL]) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -41,4 +43,10 @@
|
|||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (BOOL)isDevicePreferredLanguageRTL
|
||||
{
|
||||
NSLocaleLanguageDirection direction = [NSLocale characterDirectionForLanguage:[[NSLocale preferredLanguages] objectAtIndex:0]];
|
||||
return direction == NSLocaleLanguageDirectionRightToLeft;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue