refactoring
This commit is contained in:
parent
78c4d160bf
commit
36f5c0f880
@ -11,6 +11,7 @@
|
|||||||
#import "MVMCoreUISession.h"
|
#import "MVMCoreUISession.h"
|
||||||
#import "MVMCoreUISplitViewController.h"
|
#import "MVMCoreUISplitViewController.h"
|
||||||
#import <MVMCoreUI/MVMCoreUI-Swift.h>
|
#import <MVMCoreUI/MVMCoreUI-Swift.h>
|
||||||
|
#import <MVMCore/MVMCoreGetterUtility.h>
|
||||||
@import MVMCore.MVMCoreNavigationHandler;
|
@import MVMCore.MVMCoreNavigationHandler;
|
||||||
@import MVMCore.MVMCoreGetterUtility;
|
@import MVMCore.MVMCoreGetterUtility;
|
||||||
|
|
||||||
@ -23,15 +24,9 @@
|
|||||||
return [NSBundle bundleWithIdentifier:@"com.vzw.MVMCoreUI"];
|
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 {
|
+ (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.
|
||||||
if ([MVMCoreUIUtility userPrefersSpanish]) {
|
if ([MVMCoreGetterUtility userPrefersSpanish]) {
|
||||||
return [[NSBundle bundleWithPath:[[MVMCoreUIUtility bundleForMVMCoreUI] pathForResource:@"es" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil];
|
return [[NSBundle bundleWithPath:[[MVMCoreUIUtility bundleForMVMCoreUI] pathForResource:@"es" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil];
|
||||||
} else {
|
} else {
|
||||||
return [[NSBundle bundleWithPath:[[MVMCoreUIUtility bundleForMVMCoreUI] pathForResource:@"en" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil];
|
return [[NSBundle bundleWithPath:[[MVMCoreUIUtility bundleForMVMCoreUI] pathForResource:@"en" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil];
|
||||||
@ -40,7 +35,7 @@
|
|||||||
|
|
||||||
+ (nullable NSString *)localizedImageName:(nullable NSString *)imageName {
|
+ (nullable NSString *)localizedImageName:(nullable NSString *)imageName {
|
||||||
if (imageName.length > 0) {
|
if (imageName.length > 0) {
|
||||||
if ([MVMCoreUIUtility userPrefersSpanish]) {
|
if ([MVMCoreGetterUtility userPrefersSpanish]) {
|
||||||
imageName = [NSString stringWithFormat:@"%@_es", imageName];
|
imageName = [NSString stringWithFormat:@"%@_es", imageName];
|
||||||
} else {
|
} else {
|
||||||
imageName = [NSString stringWithFormat:@"%@_en", imageName];
|
imageName = [NSString stringWithFormat:@"%@_en", imageName];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user