Merge pull request #16 in BPHVB/mvm_core from feature/spanish_strings_mvmcore to develop

* commit 'a2968520def2c82c14a527a56c9398fff8148756':
  Spanish Localistion changes
This commit is contained in:
Sommer, Patrick 2018-04-17 12:45:26 -04:00
commit 14b06a4588
5 changed files with 51 additions and 1 deletions

View File

@ -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 = "<group>"; };
0A11030C20864F9A008ADD90 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = "<group>"; };
30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreSessionTimeHandler.h; sourceTree = "<group>"; };
30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreSessionTimeHandler.m; sourceTree = "<group>"; };
881D268F1FCC9D180079C521 /* MVMCoreErrorObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreErrorObject.m; sourceTree = "<group>"; };
@ -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 = "<group>";
@ -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";

View File

@ -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.";

View File

@ -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.";

View File

@ -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

View File

@ -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