From 36f5c0f880b11d1eb81ca2ccaebb29c0470680fe Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 17 Mar 2021 15:08:56 -0400 Subject: [PATCH] refactoring --- MVMCoreUI/Utility/MVMCoreUIUtility.m | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Utility/MVMCoreUIUtility.m b/MVMCoreUI/Utility/MVMCoreUIUtility.m index fad2378c..9e1070d4 100644 --- a/MVMCoreUI/Utility/MVMCoreUIUtility.m +++ b/MVMCoreUI/Utility/MVMCoreUIUtility.m @@ -11,6 +11,7 @@ #import "MVMCoreUISession.h" #import "MVMCoreUISplitViewController.h" #import +#import @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];