refactoring
This commit is contained in:
parent
78c4d160bf
commit
36f5c0f880
@ -11,6 +11,7 @@
|
||||
#import "MVMCoreUISession.h"
|
||||
#import "MVMCoreUISplitViewController.h"
|
||||
#import <MVMCoreUI/MVMCoreUI-Swift.h>
|
||||
#import <MVMCore/MVMCoreGetterUtility.h>
|
||||
@import MVMCore.MVMCoreNavigationHandler;
|
||||
@import MVMCore.MVMCoreGetterUtility;
|
||||
|
||||
@ -23,15 +24,9 @@
|
||||
return [NSBundle bundleWithIdentifier:@"com.vzw.MVMCoreUI"];
|
||||
}
|
||||
|
||||
+ (BOOL)userPrefersSpanish {
|
||||
// This should be enough for us to look at what the user prefers.
|
||||
NSString *preference = [[[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2] lowercaseString];
|
||||
return [preference isEqualToString:@"es"] || [preference isEqualToString:@"es-mx"];
|
||||
}
|
||||
|
||||
+ (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key {
|
||||
// If the app language is not english... force load from the english file anyway.
|
||||
if ([MVMCoreUIUtility userPrefersSpanish]) {
|
||||
if ([MVMCoreGetterUtility userPrefersSpanish]) {
|
||||
return [[NSBundle bundleWithPath:[[MVMCoreUIUtility bundleForMVMCoreUI] pathForResource:@"es" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil];
|
||||
} else {
|
||||
return [[NSBundle bundleWithPath:[[MVMCoreUIUtility bundleForMVMCoreUI] pathForResource:@"en" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil];
|
||||
@ -40,7 +35,7 @@
|
||||
|
||||
+ (nullable NSString *)localizedImageName:(nullable NSString *)imageName {
|
||||
if (imageName.length > 0) {
|
||||
if ([MVMCoreUIUtility userPrefersSpanish]) {
|
||||
if ([MVMCoreGetterUtility userPrefersSpanish]) {
|
||||
imageName = [NSString stringWithFormat:@"%@_es", imageName];
|
||||
} else {
|
||||
imageName = [NSString stringWithFormat:@"%@_en", imageName];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user