From a2968520def2c82c14a527a56c9398fff8148756 Mon Sep 17 00:00:00 2001 From: Ramya Subramaniam Date: Tue, 17 Apr 2018 22:03:40 +0530 Subject: [PATCH] Spanish Localistion changes --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 8 ++++++++ .../Strings/es-MX.lproj/Localizable.strings | 14 ++++++++++++++ .../MVMCore/Strings/es.lproj/Localizable.strings | 14 ++++++++++++++ .../MVMCore/Utility/Helpers/MVMCoreGetterUtility.h | 2 ++ .../MVMCore/Utility/Helpers/MVMCoreGetterUtility.m | 14 +++++++++++++- 5 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 MVMCore/MVMCore/Strings/es-MX.lproj/Localizable.strings create mode 100644 MVMCore/MVMCore/Strings/es.lproj/Localizable.strings diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index 197bd30..6845002 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -141,6 +141,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 0A11030B20864F94008ADD90 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; + 0A11030C20864F9A008ADD90 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = ""; }; 30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreSessionTimeHandler.h; sourceTree = ""; }; 30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreSessionTimeHandler.m; sourceTree = ""; }; 881D268F1FCC9D180079C521 /* MVMCoreErrorObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreErrorObject.m; sourceTree = ""; }; @@ -705,6 +707,8 @@ hasScannedForEncodings = 0; knownRegions = ( en, + es, + "es-MX", ); mainGroup = 8876D5BF1FB50A9E00EB2E3D; productRefGroup = 8876D5CA1FB50A9E00EB2E3D /* Products */; @@ -809,6 +813,8 @@ isa = PBXVariantGroup; children = ( AF26DDAF1FCE6A37004E8F65 /* en */, + 0A11030B20864F94008ADD90 /* es */, + 0A11030C20864F9A008ADD90 /* es-MX */, ); name = Localizable.strings; sourceTree = ""; @@ -820,6 +826,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -878,6 +885,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; diff --git a/MVMCore/MVMCore/Strings/es-MX.lproj/Localizable.strings b/MVMCore/MVMCore/Strings/es-MX.lproj/Localizable.strings new file mode 100644 index 0000000..39929b7 --- /dev/null +++ b/MVMCore/MVMCore/Strings/es-MX.lproj/Localizable.strings @@ -0,0 +1,14 @@ +/* + Localizable.strings + MVMCore + + Created by Pfeil, Scott Robert on 11/28/17. + Copyright © 2017 myverizon. All rights reserved. +*/ + +"error" = "Error"; +"Restart Key" = "Reiniciar"; +"okCaps" = "OK"; + +"Error Message Critical Key" = "En este momento no podemos procesar tu solicitud. Comunícate con Servicio al Cliente marcando *611. Muchas gracias."; +"Error Message Unable To Process Request Key" = "No podemos procesar tu solicitud. Vuelve a intentarlo más tarde."; diff --git a/MVMCore/MVMCore/Strings/es.lproj/Localizable.strings b/MVMCore/MVMCore/Strings/es.lproj/Localizable.strings new file mode 100644 index 0000000..39929b7 --- /dev/null +++ b/MVMCore/MVMCore/Strings/es.lproj/Localizable.strings @@ -0,0 +1,14 @@ +/* + Localizable.strings + MVMCore + + Created by Pfeil, Scott Robert on 11/28/17. + Copyright © 2017 myverizon. All rights reserved. +*/ + +"error" = "Error"; +"Restart Key" = "Reiniciar"; +"okCaps" = "OK"; + +"Error Message Critical Key" = "En este momento no podemos procesar tu solicitud. Comunícate con Servicio al Cliente marcando *611. Muchas gracias."; +"Error Message Unable To Process Request Key" = "No podemos procesar tu solicitud. Vuelve a intentarlo más tarde."; diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.h b/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.h index 5bf0375..ffd31c6 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.h +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.h @@ -19,4 +19,6 @@ // Returns the hardcoded string from the string file. + (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key; +// Returns true if the user's language is Spanish ++ (BOOL)userPrefersSpanish; @end diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.m b/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.m index 82c2c04..5985fcf 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.m +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreGetterUtility.m @@ -18,9 +18,21 @@ return [NSBundle bundleWithIdentifier:@"com.vzw.MVMCore"]; } ++ (BOOL)userPrefersSpanish { + // This should be enough for us to look at what the user prefers. + return [[[[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2] lowercaseString] isEqualToString:@"es"]; +} + + (nullable NSString *)hardcodedStringWithKey:(nonnull NSString *)key { // If the app language is not english... force load from the english file anyway. - return [[NSBundle bundleWithPath:[[MVMCoreGetterUtility bundleForMVMCore] pathForResource:@"en" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil]; + if ([MVMCoreGetterUtility userPrefersSpanish]) { + return [[NSBundle bundleWithPath:[[MVMCoreGetterUtility bundleForMVMCore] pathForResource:@"es" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil]; + + } else { + return [[NSBundle bundleWithPath:[[MVMCoreGetterUtility bundleForMVMCore] pathForResource:@"en" ofType:@"lproj"]] localizedStringForKey:key value:@"" table:nil]; + + } } + @end