improve locae check behavior
This commit is contained in:
parent
1d2e878aa9
commit
86819283c0
@ -7,7 +7,6 @@
|
||||
// Copyright © 2019 myverizon. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ModelRegistry {
|
||||
|
||||
|
||||
@ -19,8 +19,13 @@
|
||||
}
|
||||
|
||||
+ (BOOL)userPrefersSpanish {
|
||||
// This should be enough for us to look at what the user prefers.
|
||||
return [[[[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2] lowercaseString] isEqualToString:@"es"];
|
||||
// Gets preferences based on what the user wants and the app provides.
|
||||
NSString *languageCode = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];
|
||||
if (languageCode && [languageCode length] > 2) {
|
||||
return [[[languageCode substringToIndex:2] lowercaseString] isEqualToString:@"es"];
|
||||
} else {
|
||||
return [[languageCode lowercaseString] isEqualToString:@"es"];
|
||||
}
|
||||
}
|
||||
|
||||
+ (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user