diff --git a/MVMCoreUI/Utility/MVMCoreUIUtility.h b/MVMCoreUI/Utility/MVMCoreUIUtility.h index 74b19d0e..6852e936 100644 --- a/MVMCoreUI/Utility/MVMCoreUIUtility.h +++ b/MVMCoreUI/Utility/MVMCoreUIUtility.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Getters -//Returns localized imageName +// Returns localized imageName + (nullable NSString *)localizedImageName:(nullable NSString *)imageName; // The bundle for this framework diff --git a/MVMCoreUI/Utility/MVMCoreUIUtility.m b/MVMCoreUI/Utility/MVMCoreUIUtility.m index fad2378c..dd059fed 100644 --- a/MVMCoreUI/Utility/MVMCoreUIUtility.m +++ b/MVMCoreUI/Utility/MVMCoreUIUtility.m @@ -23,24 +23,14 @@ 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]) { - 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]; - } + // Redirect key with relevant module. + return [MVMCoreGetterUtility hardcodedStringWithKey:key bundle:[MVMCoreUIUtility bundleForMVMCoreUI]]; } + (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];