updating func
This commit is contained in:
parent
63abf3d35e
commit
e13530f5b4
@ -19,6 +19,12 @@
|
|||||||
// Returns the hardcoded string from the string file.
|
// Returns the hardcoded string from the string file.
|
||||||
+ (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key;
|
+ (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key;
|
||||||
|
|
||||||
|
// Return current system language
|
||||||
|
+ (nullable NSString *)getSystemLanguage;
|
||||||
|
|
||||||
|
// Return current preferred system language
|
||||||
|
+ (nullable NSString *)getPreferredAvailableLanguage;
|
||||||
|
|
||||||
// Returns true if the user's language is Spanish
|
// Returns true if the user's language is Spanish
|
||||||
+ (BOOL)userPrefersSpanish;
|
+ (BOOL)userPrefersSpanish;
|
||||||
|
|
||||||
|
|||||||
@ -18,15 +18,27 @@
|
|||||||
return [NSBundle bundleWithIdentifier:@"com.vzw.MVMCore"];
|
return [NSBundle bundleWithIdentifier:@"com.vzw.MVMCore"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Confirms that the preferred user language is for spanish users.
|
||||||
+ (BOOL)userPrefersSpanish {
|
+ (BOOL)userPrefersSpanish {
|
||||||
// Gets language code based on what the user prefers and the app provides.
|
|
||||||
NSString *languageCode = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];
|
NSString *languageCode = [MVMCoreGetterUtility getPreferredAvailableLanguage];
|
||||||
if (languageCode && [languageCode length] > 2) {
|
if (languageCode && [languageCode length] > 2) {
|
||||||
return [[[languageCode substringToIndex:2] lowercaseString] isEqualToString:@"es"];
|
return [[[languageCode substringToIndex:2] lowercaseString] isEqualToString:@"es"];
|
||||||
} else {
|
} else {
|
||||||
return [[languageCode lowercaseString] isEqualToString:@"es"];
|
return [[languageCode lowercaseString] isEqualToString:@"es"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets language code based on what the user prefers and the app provides.
|
||||||
|
+ (NSString *)getPreferredAvailableLanguage {
|
||||||
|
|
||||||
|
return [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSString *)getSystemLanguage {
|
||||||
|
|
||||||
|
return [[NSLocale preferredLanguages] objectAtIndex:0];
|
||||||
|
}
|
||||||
|
|
||||||
+ (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key {
|
+ (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key {
|
||||||
// If the app language is not english... force load from the english file anyway.
|
// If the app language is not english... force load from the english file anyway.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user