From 554d61ff21dc0d7b14c63908cd70a00fd90d380d Mon Sep 17 00:00:00 2001 From: Mario Andres Villamizar Palacio Date: Sat, 7 Apr 2018 12:27:48 -0500 Subject: [PATCH 1/7] Supporting Storyboards refresh --- Localize_Swift.xcodeproj/project.pbxproj | 20 ++++++++-- Sources/Localize.swift | 21 ++++++++-- Sources/Localize_Swift.h | 3 +- Sources/NSBundle+Language.h | 15 +++++++ Sources/NSBundle+Language.m | 50 ++++++++++++++++++++++++ 5 files changed, 101 insertions(+), 8 deletions(-) create mode 100755 Sources/NSBundle+Language.h create mode 100755 Sources/NSBundle+Language.m diff --git a/Localize_Swift.xcodeproj/project.pbxproj b/Localize_Swift.xcodeproj/project.pbxproj index c04e11c..48c809d 100644 --- a/Localize_Swift.xcodeproj/project.pbxproj +++ b/Localize_Swift.xcodeproj/project.pbxproj @@ -33,6 +33,11 @@ 68A520051DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */; }; 68A520061DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */; }; 68A520071DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */; }; + A93287AB2079320500CFADC0 /* NSBundle+Language.m in Sources */ = {isa = PBXBuildFile; fileRef = A93287A92079320400CFADC0 /* NSBundle+Language.m */; }; + A93287AC2079320500CFADC0 /* NSBundle+Language.h in Headers */ = {isa = PBXBuildFile; fileRef = A93287AA2079320400CFADC0 /* NSBundle+Language.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A93287AD2079327500CFADC0 /* NSBundle+Language.h in Headers */ = {isa = PBXBuildFile; fileRef = A93287AA2079320400CFADC0 /* NSBundle+Language.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A93287AE2079327600CFADC0 /* NSBundle+Language.h in Headers */ = {isa = PBXBuildFile; fileRef = A93287AA2079320400CFADC0 /* NSBundle+Language.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A93287AF2079327600CFADC0 /* NSBundle+Language.h in Headers */ = {isa = PBXBuildFile; fileRef = A93287AA2079320400CFADC0 /* NSBundle+Language.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -60,6 +65,8 @@ 68973D651DA7AA200076F08A /* String+LocalizeBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+LocalizeBundle.swift"; path = "Sources/String+LocalizeBundle.swift"; sourceTree = SOURCE_ROOT; }; 68973D6A1DA7AB140076F08A /* String+LocalizedBundleTableName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+LocalizedBundleTableName.swift"; path = "Sources/String+LocalizedBundleTableName.swift"; sourceTree = SOURCE_ROOT; }; 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; name = "String+LocalizeTableName.swift"; path = "Sources/String+LocalizeTableName.swift"; sourceTree = SOURCE_ROOT; tabWidth = 4; usesTabs = 0; }; + A93287A92079320400CFADC0 /* NSBundle+Language.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSBundle+Language.m"; path = "Sources/NSBundle+Language.m"; sourceTree = SOURCE_ROOT; }; + A93287AA2079320400CFADC0 /* NSBundle+Language.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSBundle+Language.h"; path = "Sources/NSBundle+Language.h"; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -135,6 +142,8 @@ 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */, 68973D651DA7AA200076F08A /* String+LocalizeBundle.swift */, 68973D6A1DA7AB140076F08A /* String+LocalizedBundleTableName.swift */, + A93287AA2079320400CFADC0 /* NSBundle+Language.h */, + A93287A92079320400CFADC0 /* NSBundle+Language.m */, 3433F23B1C518AF7003AE34D /* Info.plist */, 344169461C67539300B93D28 /* Foundation.framework */, ); @@ -158,6 +167,7 @@ buildActionMask = 2147483647; files = ( 3433F2521C518B38003AE34D /* Localize_Swift.h in Headers */, + A93287AC2079320500CFADC0 /* NSBundle+Language.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -166,6 +176,7 @@ buildActionMask = 2147483647; files = ( 343A6DD61D1529560081AA37 /* Localize_Swift.h in Headers */, + A93287AD2079327500CFADC0 /* NSBundle+Language.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -174,6 +185,7 @@ buildActionMask = 2147483647; files = ( 343A6DE31D152B1B0081AA37 /* Localize_Swift.h in Headers */, + A93287AE2079327600CFADC0 /* NSBundle+Language.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -182,6 +194,7 @@ buildActionMask = 2147483647; files = ( 343A6DF01D152E5A0081AA37 /* Localize_Swift.h in Headers */, + A93287AF2079327600CFADC0 /* NSBundle+Language.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -290,7 +303,7 @@ TargetAttributes = { 3433F2351C518AF7003AE34D = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 0920; }; 3433F23F1C518AF7003AE34D = { CreatedOnToolsVersion = 7.2; @@ -366,6 +379,7 @@ buildActionMask = 2147483647; files = ( 68973D6B1DA7AB140076F08A /* String+LocalizedBundleTableName.swift in Sources */, + A93287AB2079320500CFADC0 /* NSBundle+Language.m in Sources */, 68973D661DA7AA200076F08A /* String+LocalizeBundle.swift in Sources */, 3433F2531C518B38003AE34D /* Localize.swift in Sources */, 68A520041DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */, @@ -535,7 +549,7 @@ 3433F24B1C518AF7003AE34D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; + APPLICATION_EXTENSION_API_ONLY = NO; CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; @@ -558,7 +572,7 @@ 3433F24C1C518AF7003AE34D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; + APPLICATION_EXTENSION_API_ONLY = NO; CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; diff --git a/Sources/Localize.swift b/Sources/Localize.swift index 278240f..e4f9b3e 100644 --- a/Sources/Localize.swift +++ b/Sources/Localize.swift @@ -7,9 +7,11 @@ // import Foundation +import UIKit /// Internal current language key let LCLCurrentLanguageKey = "LCLCurrentLanguageKey" +let AppleLanguagesKey = "AppleLanguages" /// Default language. English. If English is unavailable defaults to base localization. let LCLDefaultLanguage = "en" @@ -118,20 +120,32 @@ open class Localize: NSObject { */ open class func setCurrentLanguage(_ language: String) { let selectedLanguage = availableLanguages().contains(language) ? language : defaultLanguage() - if (selectedLanguage != currentLanguage()){ + if (selectedLanguage != currentLanguage()) { UserDefaults.standard.set(selectedLanguage, forKey: LCLCurrentLanguageKey) + UserDefaults.standard.set([selectedLanguage], forKey: AppleLanguagesKey) UserDefaults.standard.synchronize() - NotificationCenter.default.post(name: Notification.Name(rawValue: LCLLanguageChangeNotification), object: nil) + NotificationCenter.default.post(name: Notification.Name(rawValue: LCLLanguageChangeNotification), + object: nil) + Bundle.setLanguage(language) } } + /** + Change the current language and Restart from the Root View Controller + - Parameter language: Desired language. + */ + open class func setCurrentLanguage(_ language: String, restartFromRoot rootViewController: UIViewController) { + self.setCurrentLanguage(language) + UIApplication.shared.keyWindow?.rootViewController = rootViewController + } + /** Default language - Returns: The app's default language. String. */ open class func defaultLanguage() -> String { var defaultLanguage: String = String() - guard let preferredLanguage = Bundle.main.preferredLocalizations.first else { + guard let preferredLanguage = Locale.current.languageCode else { return LCLDefaultLanguage } let availableLanguages: [String] = self.availableLanguages() @@ -164,4 +178,3 @@ open class Localize: NSObject { return String() } } - diff --git a/Sources/Localize_Swift.h b/Sources/Localize_Swift.h index be5dbc9..077afa3 100644 --- a/Sources/Localize_Swift.h +++ b/Sources/Localize_Swift.h @@ -6,7 +6,8 @@ // Copyright © 2016 Roy Marmelstein. All rights reserved. // -@import Foundation; +#import +#import "NSBundle+Language.h" //! Project version number for Localize_Swift. FOUNDATION_EXPORT double Localize_SwiftVersionNumber; diff --git a/Sources/NSBundle+Language.h b/Sources/NSBundle+Language.h new file mode 100755 index 0000000..6c5376e --- /dev/null +++ b/Sources/NSBundle+Language.h @@ -0,0 +1,15 @@ +// +// NSBundle+Language.h +// Localize +// +// Created by Mario Villamizar on 04/07/2018. +// Copyright © 2018 Mario Villamizar. All rights reserved. +// + +#import + +@interface NSBundle (Language) + ++ (void)setLanguage:(NSString *)language; + +@end diff --git a/Sources/NSBundle+Language.m b/Sources/NSBundle+Language.m new file mode 100755 index 0000000..8ac704e --- /dev/null +++ b/Sources/NSBundle+Language.m @@ -0,0 +1,50 @@ +// +// NSBundle+Language.m +// Localize +// +// Created by Mario Villamizar on 04/07/2018. +// Copyright © 2018 Mario Villamizar. All rights reserved. +// + +#import "NSBundle+Language.h" +#import +#import + +static const char kBundleKey = 0; + +@interface BundleEx : NSBundle + +@end + +@implementation BundleEx + +- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName +{ + NSBundle *bundle = objc_getAssociatedObject(self, &kBundleKey); + if (bundle) { + return [bundle localizedStringForKey:key value:value table:tableName]; + } + else { + return [super localizedStringForKey:key value:value table:tableName]; + } +} + +@end + +@implementation NSBundle (Language) + ++ (void)setLanguage:(NSString *)language +{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + object_setClass([NSBundle mainBundle], [BundleEx class]); + }); + [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + [[UITableView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + [[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + + id value = language ? [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:language ofType:@"lproj"]] : nil; + objc_setAssociatedObject([NSBundle mainBundle], &kBundleKey, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end From e628f9f8154ced7f7e235dd7e6e633a584e01f99 Mon Sep 17 00:00:00 2001 From: Mario Andres Villamizar Palacio Date: Mon, 23 Apr 2018 10:00:23 -0500 Subject: [PATCH 2/7] Updating example --- examples/LanguageSwitch/Podfile | 4 +- .../Sample.xcodeproj/project.pbxproj | 283 ++++++++++++++---- .../{en.lproj => Base.lproj}/LaunchScreen.xib | 13 +- .../Sample/Base.lproj/Main.storyboard | 223 ++++++++++++++ ...troller.swift => CodeViewController.swift} | 9 +- .../de.lproj/ButtonTitles.strings | 0 .../de.lproj/Localizable.strings | 0 .../Resources/en.lproj/ButtonTitles.strings | 9 + .../Resources/en.lproj/Localizable.strings | 9 + .../Resources/es.lproj/ButtonTitles.strings | 1 + .../Resources/es.lproj/Localizable.strings | 3 + .../Resources/fr.lproj/ButtonTitles.strings | 1 + .../Resources/fr.lproj/Localizable.strings | 3 + .../he.lproj/ButtonTitles.strings | 0 .../he.lproj/Localizable.strings | 0 .../it.lproj/ButtonTitles.strings | 0 .../it.lproj/Localizable.strings | 0 .../ja.lproj/ButtonTitles.strings | 0 .../ja.lproj/Localizable.strings | 0 .../zh-Hans.lproj/ButtonTitles.strings | 0 .../zh-Hans.lproj/Localizable.strings | 0 .../zh-Hant.lproj/ButtonTitles.strings | 9 + .../zh-Hant.lproj/Localizable.strings | 0 .../Sample/StoryboardViewController.swift | 73 +++++ .../Sample/de.lproj/Main.strings | 27 ++ .../Sample/en.lproj/ButtonTitles.strings | 11 - .../Sample/en.lproj/Localizable.strings | 9 - .../Sample/en.lproj/Main.storyboard | 81 ----- .../Sample/en.lproj/Main.strings | 27 ++ .../Sample/es.lproj/ButtonTitles.strings | 11 - .../Sample/es.lproj/InfoPlist.strings | 1 + .../Sample/es.lproj/LaunchScreen.strings | 1 + .../Sample/es.lproj/Localizable.strings | 9 - .../Sample/es.lproj/Main.strings | 27 ++ .../Sample/fr.lproj/ButtonTitles.strings | 11 - .../Sample/fr.lproj/InfoPlist.strings | 1 + .../Sample/fr.lproj/LaunchScreen.strings | 1 + .../Sample/fr.lproj/Localizable.strings | 9 - .../Sample/fr.lproj/Main.strings | 27 ++ .../Sample/he.lproj/Main.strings | 27 ++ .../Sample/it.lproj/Main.strings | 27 ++ .../Sample/ja.lproj/Main.strings | 27 ++ .../Sample/zh-Hans.lproj/Main.strings | 27 ++ .../Sample/zh-Hant.lproj/Main.strings | 27 ++ 44 files changed, 824 insertions(+), 204 deletions(-) rename examples/LanguageSwitch/Sample/{en.lproj => Base.lproj}/LaunchScreen.xib (57%) create mode 100644 examples/LanguageSwitch/Sample/Base.lproj/Main.storyboard rename examples/LanguageSwitch/Sample/{ViewController.swift => CodeViewController.swift} (93%) rename examples/LanguageSwitch/Sample/{ => Resources}/de.lproj/ButtonTitles.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/de.lproj/Localizable.strings (100%) mode change 100644 => 100755 create mode 100644 examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings create mode 100644 examples/LanguageSwitch/Sample/Resources/en.lproj/Localizable.strings create mode 100755 examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings create mode 100755 examples/LanguageSwitch/Sample/Resources/es.lproj/Localizable.strings create mode 100755 examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings create mode 100755 examples/LanguageSwitch/Sample/Resources/fr.lproj/Localizable.strings rename examples/LanguageSwitch/Sample/{ => Resources}/he.lproj/ButtonTitles.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/he.lproj/Localizable.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/it.lproj/ButtonTitles.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/it.lproj/Localizable.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/ja.lproj/ButtonTitles.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/ja.lproj/Localizable.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/zh-Hans.lproj/ButtonTitles.strings (100%) mode change 100644 => 100755 rename examples/LanguageSwitch/Sample/{ => Resources}/zh-Hans.lproj/Localizable.strings (100%) mode change 100644 => 100755 create mode 100644 examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings rename examples/LanguageSwitch/Sample/{ => Resources}/zh-Hant.lproj/Localizable.strings (100%) mode change 100644 => 100755 create mode 100644 examples/LanguageSwitch/Sample/StoryboardViewController.swift create mode 100644 examples/LanguageSwitch/Sample/de.lproj/Main.strings delete mode 100644 examples/LanguageSwitch/Sample/en.lproj/ButtonTitles.strings delete mode 100644 examples/LanguageSwitch/Sample/en.lproj/Localizable.strings delete mode 100644 examples/LanguageSwitch/Sample/en.lproj/Main.storyboard create mode 100644 examples/LanguageSwitch/Sample/en.lproj/Main.strings delete mode 100644 examples/LanguageSwitch/Sample/es.lproj/ButtonTitles.strings create mode 100644 examples/LanguageSwitch/Sample/es.lproj/InfoPlist.strings create mode 100644 examples/LanguageSwitch/Sample/es.lproj/LaunchScreen.strings delete mode 100644 examples/LanguageSwitch/Sample/es.lproj/Localizable.strings create mode 100644 examples/LanguageSwitch/Sample/es.lproj/Main.strings delete mode 100644 examples/LanguageSwitch/Sample/fr.lproj/ButtonTitles.strings create mode 100644 examples/LanguageSwitch/Sample/fr.lproj/InfoPlist.strings create mode 100644 examples/LanguageSwitch/Sample/fr.lproj/LaunchScreen.strings delete mode 100644 examples/LanguageSwitch/Sample/fr.lproj/Localizable.strings create mode 100644 examples/LanguageSwitch/Sample/fr.lproj/Main.strings create mode 100644 examples/LanguageSwitch/Sample/he.lproj/Main.strings create mode 100644 examples/LanguageSwitch/Sample/it.lproj/Main.strings create mode 100644 examples/LanguageSwitch/Sample/ja.lproj/Main.strings create mode 100644 examples/LanguageSwitch/Sample/zh-Hans.lproj/Main.strings create mode 100644 examples/LanguageSwitch/Sample/zh-Hant.lproj/Main.strings diff --git a/examples/LanguageSwitch/Podfile b/examples/LanguageSwitch/Podfile index 987c9a8..ff29d74 100644 --- a/examples/LanguageSwitch/Podfile +++ b/examples/LanguageSwitch/Podfile @@ -6,7 +6,9 @@ target 'Sample' do use_frameworks! # Pods for Sample - pod 'Localize-Swift', :path => '../..' + #pod 'Localize-Swift', :path => '../..' + + pod 'Localize-Swift', :git => 'https://github.com/mariovillamizar/Localize-Swift.git', :commit => '554d61ff21dc0d7b14c63908cd70a00fd90d380d' target 'SampleTests' do inherit! :search_paths diff --git a/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj b/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj index 1af5f47..bfdbdd3 100644 --- a/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj +++ b/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj @@ -8,17 +8,19 @@ /* Begin PBXBuildFile section */ 3426FF931BB6AEE200E8E1BB /* SampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3426FF921BB6AEE200E8E1BB /* SampleTests.swift */; }; - 3426FF9B1BB6AF5D00E8E1BB /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 34346D2F1B72983C0063FED4 /* Localizable.strings */; }; 342B3BE21DDAEA4600F6D25D /* Localize_Swift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 342B3BD31DDAEA2D00F6D25D /* Localize_Swift.framework */; }; 342B3BE31DDAEA4600F6D25D /* Localize_Swift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 342B3BD31DDAEA2D00F6D25D /* Localize_Swift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 34346D031B7294470063FED4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34346D021B7294470063FED4 /* AppDelegate.swift */; }; - 34346D051B7294470063FED4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34346D041B7294470063FED4 /* ViewController.swift */; }; + 34346D051B7294470063FED4 /* CodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34346D041B7294470063FED4 /* CodeViewController.swift */; }; 34346D081B7294470063FED4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 34346D061B7294470063FED4 /* Main.storyboard */; }; 34346D0A1B7294470063FED4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 34346D091B7294470063FED4 /* Images.xcassets */; }; 34346D0D1B7294470063FED4 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34346D0B1B7294470063FED4 /* LaunchScreen.xib */; }; - 34346D2C1B72983C0063FED4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 34346D2F1B72983C0063FED4 /* Localizable.strings */; }; - 68A5200A1DA6D98000F43D9E /* ButtonTitles.strings in Resources */ = {isa = PBXBuildFile; fileRef = 68A5200C1DA6D98000F43D9E /* ButtonTitles.strings */; }; - 68A520181DA6DC0200F43D9E /* ButtonTitles.strings in Resources */ = {isa = PBXBuildFile; fileRef = 68A5200C1DA6D98000F43D9E /* ButtonTitles.strings */; }; + A917517D208E228100558E26 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A917517F208E228100558E26 /* Localizable.strings */; }; + A917518A208E235000558E26 /* ButtonTitles.strings in Resources */ = {isa = PBXBuildFile; fileRef = A917518C208E235000558E26 /* ButtonTitles.strings */; }; + A9175198208E25F100558E26 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A917519A208E25F100558E26 /* InfoPlist.strings */; }; + A984EBAB208E175B0087AACF /* StoryboardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A984EBAA208E175B0087AACF /* StoryboardViewController.swift */; }; + A99ECADD1DB672F1BAAABC1C /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 333B3261F84DF59D1EBBD7A4 /* Pods_Sample.framework */; }; + D2D5AB93620D669ACF88BCDE /* Pods_SampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B823A35026E31B4C36949480 /* Pods_SampleTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -88,7 +90,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 20D57BE01DC0AF00001BA2F9 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; + 0604FD5C52D8813E62E331CB /* Pods-SampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.debug.xcconfig"; sourceTree = ""; }; 333B3261F84DF59D1EBBD7A4 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3426FF901BB6AEE200E8E1BB /* SampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3426FF921BB6AEE200E8E1BB /* SampleTests.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = SampleTests.swift; sourceTree = ""; tabWidth = 4; usesTabs = 0; }; @@ -97,26 +99,45 @@ 34346CFD1B7294470063FED4 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34346D011B7294470063FED4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34346D021B7294470063FED4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 34346D041B7294470063FED4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 34346D041B7294470063FED4 /* CodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeViewController.swift; sourceTree = ""; }; 34346D091B7294470063FED4 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 34346D261B72976A0063FED4 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/Main.storyboard; sourceTree = ""; }; - 34346D271B72976A0063FED4 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/LaunchScreen.xib; sourceTree = ""; }; - 34346D2E1B72983C0063FED4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; - 34346D301B7298A80063FED4 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; - 34346D311B7298AF0063FED4 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; - 34346D321B7298B70063FED4 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; - 34346D331B7298BD0063FED4 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = ""; }; - 34346D341B7298C60063FED4 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; - 34346D351B7298DD0063FED4 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; - 34346D361B7298E80063FED4 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = ""; }; - 68A5200B1DA6D98000F43D9E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/ButtonTitles.strings; sourceTree = ""; }; - 68A520111DA6DA3400F43D9E /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/ButtonTitles.strings; sourceTree = ""; }; - 68A520121DA6DA4100F43D9E /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/ButtonTitles.strings; sourceTree = ""; }; - 68A520131DA6DA5A00F43D9E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/ButtonTitles.strings; sourceTree = ""; }; - 68A520141DA6DA6C00F43D9E /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/ButtonTitles.strings; sourceTree = ""; }; - 68A520151DA6DA7A00F43D9E /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/ButtonTitles.strings; sourceTree = ""; }; - 68A520161DA6DA8900F43D9E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ButtonTitles.strings"; sourceTree = ""; }; - 68A520171DA6DA9600F43D9E /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/ButtonTitles.strings; sourceTree = ""; }; + 37C5CE99C917C3C7BB6E47F1 /* Pods-SampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.release.xcconfig"; sourceTree = ""; }; + 6B8271ABAC2C24C45F1D7C68 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; + A917516F208E213A00558E26 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + A9175170208E213B00558E26 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + A9175172208E214100558E26 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; + A9175173208E214600558E26 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Main.strings; sourceTree = ""; }; + A9175174208E214A00558E26 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = ""; }; + A9175175208E214E00558E26 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Main.strings; sourceTree = ""; }; + A9175176208E215200558E26 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Main.strings; sourceTree = ""; }; + A9175177208E215700558E26 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = ""; }; + A9175178208E215A00558E26 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Main.strings; sourceTree = ""; }; + A9175179208E215D00558E26 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Main.strings"; sourceTree = ""; }; + A917517A208E216100558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Main.strings; sourceTree = ""; }; + A917517E208E228100558E26 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + A9175180208E228400558E26 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; + A9175181208E228500558E26 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; + A9175182208E228500558E26 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = ""; }; + A9175183208E228600558E26 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; + A9175184208E228700558E26 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; + A9175185208E228A00558E26 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = ""; }; + A9175186208E228C00558E26 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; + A9175187208E228F00558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; + A917518B208E235000558E26 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/ButtonTitles.strings; sourceTree = ""; }; + A917518D208E235100558E26 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/ButtonTitles.strings; sourceTree = ""; }; + A917518E208E235200558E26 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/ButtonTitles.strings; sourceTree = ""; }; + A917518F208E235300558E26 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/ButtonTitles.strings; sourceTree = ""; }; + A9175190208E235300558E26 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/ButtonTitles.strings; sourceTree = ""; }; + A9175191208E235400558E26 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ButtonTitles.strings"; sourceTree = ""; }; + A9175192208E235500558E26 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/ButtonTitles.strings; sourceTree = ""; }; + A9175193208E235600558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/ButtonTitles.strings; sourceTree = ""; }; + A9175194208E235700558E26 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/ButtonTitles.strings"; sourceTree = ""; }; + A9175195208E25F000558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/LaunchScreen.strings; sourceTree = ""; }; + A9175199208E25F100558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; + A917519B208E262B00558E26 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/LaunchScreen.strings; sourceTree = ""; }; + A917519C208E262C00558E26 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + A984EBAA208E175B0087AACF /* StoryboardViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardViewController.swift; sourceTree = ""; }; + B1ED4C7F0F187FEFAB63569F /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; B823A35026E31B4C36949480 /* Pods_SampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -125,6 +146,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D2D5AB93620D669ACF88BCDE /* Pods_SampleTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -133,6 +155,7 @@ buildActionMask = 2147483647; files = ( 342B3BE21DDAEA4600F6D25D /* Localize_Swift.framework in Frameworks */, + A99ECADD1DB672F1BAAABC1C /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -177,6 +200,7 @@ 3426FF911BB6AEE200E8E1BB /* SampleTests */, 34346CFE1B7294470063FED4 /* Products */, 1296D3EDC6FA72EB325EB960 /* Frameworks */, + F1DCDBA333EA3D7DC3EFC390 /* Pods */, ); sourceTree = ""; }; @@ -193,7 +217,8 @@ isa = PBXGroup; children = ( 34346D021B7294470063FED4 /* AppDelegate.swift */, - 34346D041B7294470063FED4 /* ViewController.swift */, + 34346D041B7294470063FED4 /* CodeViewController.swift */, + A984EBAA208E175B0087AACF /* StoryboardViewController.swift */, 34346D061B7294470063FED4 /* Main.storyboard */, 34346D091B7294470063FED4 /* Images.xcassets */, 34346D0B1B7294470063FED4 /* LaunchScreen.xib */, @@ -206,6 +231,7 @@ 34346D001B7294470063FED4 /* Supporting Files */ = { isa = PBXGroup; children = ( + A917519A208E25F100558E26 /* InfoPlist.strings */, 34346D011B7294470063FED4 /* Info.plist */, ); name = "Supporting Files"; @@ -214,12 +240,23 @@ 34346D281B7297820063FED4 /* Resources */ = { isa = PBXGroup; children = ( - 68A5200C1DA6D98000F43D9E /* ButtonTitles.strings */, - 34346D2F1B72983C0063FED4 /* Localizable.strings */, + A917517F208E228100558E26 /* Localizable.strings */, + A917518C208E235000558E26 /* ButtonTitles.strings */, ); name = Resources; sourceTree = ""; }; + F1DCDBA333EA3D7DC3EFC390 /* Pods */ = { + isa = PBXGroup; + children = ( + 6B8271ABAC2C24C45F1D7C68 /* Pods-Sample.debug.xcconfig */, + B1ED4C7F0F187FEFAB63569F /* Pods-Sample.release.xcconfig */, + 0604FD5C52D8813E62E331CB /* Pods-SampleTests.debug.xcconfig */, + 37C5CE99C917C3C7BB6E47F1 /* Pods-SampleTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -227,9 +264,12 @@ isa = PBXNativeTarget; buildConfigurationList = 3426FF971BB6AEE200E8E1BB /* Build configuration list for PBXNativeTarget "SampleTests" */; buildPhases = ( + B39E39046A044707CF2D93B5 /* [CP] Check Pods Manifest.lock */, 3426FF8C1BB6AEE200E8E1BB /* Sources */, 3426FF8D1BB6AEE200E8E1BB /* Frameworks */, 3426FF8E1BB6AEE200E8E1BB /* Resources */, + 2A53D9C419260C483179403D /* [CP] Embed Pods Frameworks */, + 4C92C01CC63E747E3EFA8AF0 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -245,10 +285,13 @@ isa = PBXNativeTarget; buildConfigurationList = 34346D1C1B7294470063FED4 /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( + C0EE0A8A3CCAB2D6E09183F4 /* [CP] Check Pods Manifest.lock */, 34346CF91B7294470063FED4 /* Sources */, 34346CFA1B7294470063FED4 /* Frameworks */, 34346CFB1B7294470063FED4 /* Resources */, 342B3BE61DDAEA4700F6D25D /* Embed Frameworks */, + C95E939543F7E04D81737E79 /* [CP] Embed Pods Frameworks */, + EC9C2342D8170261D7432DB7 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -290,12 +333,13 @@ en, fr, de, - es, it, ja, "zh-Hans", he, "zh-Hant", + es, + Base, ); mainGroup = 34346CF41B7294470063FED4; productRefGroup = 34346CFE1B7294470063FED4 /* Products */; @@ -357,8 +401,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3426FF9B1BB6AF5D00E8E1BB /* Localizable.strings in Resources */, - 68A520181DA6DC0200F43D9E /* ButtonTitles.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -367,8 +409,9 @@ buildActionMask = 2147483647; files = ( 34346D081B7294470063FED4 /* Main.storyboard in Resources */, - 34346D2C1B72983C0063FED4 /* Localizable.strings in Resources */, - 68A5200A1DA6D98000F43D9E /* ButtonTitles.strings in Resources */, + A9175198208E25F100558E26 /* InfoPlist.strings in Resources */, + A917517D208E228100558E26 /* Localizable.strings in Resources */, + A917518A208E235000558E26 /* ButtonTitles.strings in Resources */, 34346D0D1B7294470063FED4 /* LaunchScreen.xib in Resources */, 34346D0A1B7294470063FED4 /* Images.xcassets in Resources */, ); @@ -376,6 +419,108 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 2A53D9C419260C483179403D /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 4C92C01CC63E747E3EFA8AF0 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + B39E39046A044707CF2D93B5 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-SampleTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + C0EE0A8A3CCAB2D6E09183F4 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + C95E939543F7E04D81737E79 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Localize-Swift/Localize_Swift.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Localize_Swift.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + EC9C2342D8170261D7432DB7 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 3426FF8C1BB6AEE200E8E1BB /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -389,7 +534,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 34346D051B7294470063FED4 /* ViewController.swift in Sources */, + 34346D051B7294470063FED4 /* CodeViewController.swift in Sources */, + A984EBAB208E175B0087AACF /* StoryboardViewController.swift in Sources */, 34346D031B7294470063FED4 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -413,7 +559,16 @@ 34346D061B7294470063FED4 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - 34346D261B72976A0063FED4 /* en */, + A917516F208E213A00558E26 /* Base */, + A9175172208E214100558E26 /* en */, + A9175173208E214600558E26 /* fr */, + A9175174208E214A00558E26 /* de */, + A9175175208E214E00558E26 /* it */, + A9175176208E215200558E26 /* ja */, + A9175177208E215700558E26 /* zh-Hans */, + A9175178208E215A00558E26 /* he */, + A9175179208E215D00558E26 /* zh-Hant */, + A917517A208E216100558E26 /* es */, ); name = Main.storyboard; sourceTree = ""; @@ -421,40 +576,54 @@ 34346D0B1B7294470063FED4 /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( - 34346D271B72976A0063FED4 /* en */, + A9175170208E213B00558E26 /* Base */, + A9175195208E25F000558E26 /* es */, + A917519B208E262B00558E26 /* fr */, ); name = LaunchScreen.xib; sourceTree = ""; }; - 34346D2F1B72983C0063FED4 /* Localizable.strings */ = { + A917517F208E228100558E26 /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( - 34346D2E1B72983C0063FED4 /* en */, - 34346D301B7298A80063FED4 /* fr */, - 34346D311B7298AF0063FED4 /* de */, - 34346D321B7298B70063FED4 /* es */, - 34346D331B7298BD0063FED4 /* it */, - 34346D341B7298C60063FED4 /* ja */, - 34346D351B7298DD0063FED4 /* zh-Hans */, - 34346D361B7298E80063FED4 /* he */, - 20D57BE01DC0AF00001BA2F9 /* zh-Hant */, + A917517E208E228100558E26 /* en */, + A9175180208E228400558E26 /* fr */, + A9175181208E228500558E26 /* de */, + A9175182208E228500558E26 /* it */, + A9175183208E228600558E26 /* ja */, + A9175184208E228700558E26 /* zh-Hans */, + A9175185208E228A00558E26 /* he */, + A9175186208E228C00558E26 /* zh-Hant */, + A9175187208E228F00558E26 /* es */, ); name = Localizable.strings; + path = Resources; sourceTree = ""; }; - 68A5200C1DA6D98000F43D9E /* ButtonTitles.strings */ = { + A917518C208E235000558E26 /* ButtonTitles.strings */ = { isa = PBXVariantGroup; children = ( - 68A5200B1DA6D98000F43D9E /* en */, - 68A520111DA6DA3400F43D9E /* fr */, - 68A520121DA6DA4100F43D9E /* de */, - 68A520131DA6DA5A00F43D9E /* es */, - 68A520141DA6DA6C00F43D9E /* it */, - 68A520151DA6DA7A00F43D9E /* ja */, - 68A520161DA6DA8900F43D9E /* zh-Hans */, - 68A520171DA6DA9600F43D9E /* he */, + A917518B208E235000558E26 /* en */, + A917518D208E235100558E26 /* fr */, + A917518E208E235200558E26 /* de */, + A917518F208E235300558E26 /* it */, + A9175190208E235300558E26 /* ja */, + A9175191208E235400558E26 /* zh-Hans */, + A9175192208E235500558E26 /* he */, + A9175193208E235600558E26 /* es */, + A9175194208E235700558E26 /* zh-Hant */, ); name = ButtonTitles.strings; + path = Resources; + sourceTree = ""; + }; + A917519A208E25F100558E26 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + A9175199208E25F100558E26 /* es */, + A917519C208E262C00558E26 /* fr */, + ); + name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ @@ -462,6 +631,7 @@ /* Begin XCBuildConfiguration section */ 3426FF981BB6AEE200E8E1BB /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 0604FD5C52D8813E62E331CB /* Pods-SampleTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; DEBUG_INFORMATION_FORMAT = dwarf; @@ -477,6 +647,7 @@ }; 3426FF991BB6AEE200E8E1BB /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 37C5CE99C917C3C7BB6E47F1 /* Pods-SampleTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -594,6 +765,7 @@ }; 34346D1D1B7294470063FED4 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 6B8271ABAC2C24C45F1D7C68 /* Pods-Sample.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -607,6 +779,7 @@ }; 34346D1E1B7294470063FED4 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B1ED4C7F0F187FEFAB63569F /* Pods-Sample.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; diff --git a/examples/LanguageSwitch/Sample/en.lproj/LaunchScreen.xib b/examples/LanguageSwitch/Sample/Base.lproj/LaunchScreen.xib similarity index 57% rename from examples/LanguageSwitch/Sample/en.lproj/LaunchScreen.xib rename to examples/LanguageSwitch/Sample/Base.lproj/LaunchScreen.xib index cf8936e..8b30891 100644 --- a/examples/LanguageSwitch/Sample/en.lproj/LaunchScreen.xib +++ b/examples/LanguageSwitch/Sample/Base.lproj/LaunchScreen.xib @@ -1,7 +1,12 @@ - - + + + + + - + + + @@ -9,7 +14,7 @@ - + diff --git a/examples/LanguageSwitch/Sample/Base.lproj/Main.storyboard b/examples/LanguageSwitch/Sample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..884a4db --- /dev/null +++ b/examples/LanguageSwitch/Sample/Base.lproj/Main.storyboard @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/LanguageSwitch/Sample/ViewController.swift b/examples/LanguageSwitch/Sample/CodeViewController.swift similarity index 93% rename from examples/LanguageSwitch/Sample/ViewController.swift rename to examples/LanguageSwitch/Sample/CodeViewController.swift index e765a40..da968e5 100644 --- a/examples/LanguageSwitch/Sample/ViewController.swift +++ b/examples/LanguageSwitch/Sample/CodeViewController.swift @@ -1,5 +1,5 @@ // -// ViewController.swift +// CodeViewController.swift // Sample // // Created by Roy Marmelstein on 05/08/2015. @@ -9,7 +9,7 @@ import UIKit import Localize_Swift -class ViewController: UIViewController { +class CodeViewController: UIViewController { @IBOutlet weak var textLabel: UILabel! @IBOutlet weak var changeButton: UIButton! @@ -17,12 +17,15 @@ class ViewController: UIViewController { var actionSheet: UIAlertController! - let availableLanguages = Localize.availableLanguages() + let availableLanguages = Localize.availableLanguages(true) // MARK: UIViewController override func viewDidLoad() { super.viewDidLoad() + + print(availableLanguages) + self.setText() } diff --git a/examples/LanguageSwitch/Sample/de.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/de.lproj/ButtonTitles.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/de.lproj/ButtonTitles.strings rename to examples/LanguageSwitch/Sample/Resources/de.lproj/ButtonTitles.strings diff --git a/examples/LanguageSwitch/Sample/de.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/de.lproj/Localizable.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/de.lproj/Localizable.strings rename to examples/LanguageSwitch/Sample/Resources/de.lproj/Localizable.strings diff --git a/examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings new file mode 100644 index 0000000..5537d9a --- /dev/null +++ b/examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings @@ -0,0 +1,9 @@ +/* + Localizable.strings + Sample + + Created by Mario Andres Villamizar Palacio on 4/23/18. + Copyright © 2018 Roy Marmelstein. All rights reserved. +*/ + +"Hello world" = "Hello world"; diff --git a/examples/LanguageSwitch/Sample/Resources/en.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/en.lproj/Localizable.strings new file mode 100644 index 0000000..5537d9a --- /dev/null +++ b/examples/LanguageSwitch/Sample/Resources/en.lproj/Localizable.strings @@ -0,0 +1,9 @@ +/* + Localizable.strings + Sample + + Created by Mario Andres Villamizar Palacio on 4/23/18. + Copyright © 2018 Roy Marmelstein. All rights reserved. +*/ + +"Hello world" = "Hello world"; diff --git a/examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings new file mode 100755 index 0000000..874e8a4 --- /dev/null +++ b/examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings @@ -0,0 +1 @@ +/* No Localized Strings */ diff --git a/examples/LanguageSwitch/Sample/Resources/es.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/es.lproj/Localizable.strings new file mode 100755 index 0000000..a2c3584 --- /dev/null +++ b/examples/LanguageSwitch/Sample/Resources/es.lproj/Localizable.strings @@ -0,0 +1,3 @@ +/* (No Comment) */ +"Hello world" = "Hola mundo"; + diff --git a/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings new file mode 100755 index 0000000..874e8a4 --- /dev/null +++ b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings @@ -0,0 +1 @@ +/* No Localized Strings */ diff --git a/examples/LanguageSwitch/Sample/Resources/fr.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/fr.lproj/Localizable.strings new file mode 100755 index 0000000..43a5ded --- /dev/null +++ b/examples/LanguageSwitch/Sample/Resources/fr.lproj/Localizable.strings @@ -0,0 +1,3 @@ +/* (No Comment) */ +"Hello world" = "Bonjour le monde"; + diff --git a/examples/LanguageSwitch/Sample/he.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/he.lproj/ButtonTitles.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/he.lproj/ButtonTitles.strings rename to examples/LanguageSwitch/Sample/Resources/he.lproj/ButtonTitles.strings diff --git a/examples/LanguageSwitch/Sample/he.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/he.lproj/Localizable.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/he.lproj/Localizable.strings rename to examples/LanguageSwitch/Sample/Resources/he.lproj/Localizable.strings diff --git a/examples/LanguageSwitch/Sample/it.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/it.lproj/ButtonTitles.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/it.lproj/ButtonTitles.strings rename to examples/LanguageSwitch/Sample/Resources/it.lproj/ButtonTitles.strings diff --git a/examples/LanguageSwitch/Sample/it.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/it.lproj/Localizable.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/it.lproj/Localizable.strings rename to examples/LanguageSwitch/Sample/Resources/it.lproj/Localizable.strings diff --git a/examples/LanguageSwitch/Sample/ja.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/ja.lproj/ButtonTitles.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/ja.lproj/ButtonTitles.strings rename to examples/LanguageSwitch/Sample/Resources/ja.lproj/ButtonTitles.strings diff --git a/examples/LanguageSwitch/Sample/ja.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/ja.lproj/Localizable.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/ja.lproj/Localizable.strings rename to examples/LanguageSwitch/Sample/Resources/ja.lproj/Localizable.strings diff --git a/examples/LanguageSwitch/Sample/zh-Hans.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/zh-Hans.lproj/ButtonTitles.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/zh-Hans.lproj/ButtonTitles.strings rename to examples/LanguageSwitch/Sample/Resources/zh-Hans.lproj/ButtonTitles.strings diff --git a/examples/LanguageSwitch/Sample/zh-Hans.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/zh-Hans.lproj/Localizable.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/zh-Hans.lproj/Localizable.strings rename to examples/LanguageSwitch/Sample/Resources/zh-Hans.lproj/Localizable.strings diff --git a/examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings new file mode 100644 index 0000000..5537d9a --- /dev/null +++ b/examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings @@ -0,0 +1,9 @@ +/* + Localizable.strings + Sample + + Created by Mario Andres Villamizar Palacio on 4/23/18. + Copyright © 2018 Roy Marmelstein. All rights reserved. +*/ + +"Hello world" = "Hello world"; diff --git a/examples/LanguageSwitch/Sample/zh-Hant.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/Localizable.strings old mode 100644 new mode 100755 similarity index 100% rename from examples/LanguageSwitch/Sample/zh-Hant.lproj/Localizable.strings rename to examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/Localizable.strings diff --git a/examples/LanguageSwitch/Sample/StoryboardViewController.swift b/examples/LanguageSwitch/Sample/StoryboardViewController.swift new file mode 100644 index 0000000..d6f426a --- /dev/null +++ b/examples/LanguageSwitch/Sample/StoryboardViewController.swift @@ -0,0 +1,73 @@ +// +// CodeViewController.swift +// Sample +// +// Created by Roy Marmelstein on 05/08/2015. +// Copyright (c) 2015 Roy Marmelstein. All rights reserved. +// + +import UIKit +import Localize_Swift + +class StoryboardViewController: UIViewController { + + @IBOutlet weak var textLabel: UILabel! + @IBOutlet weak var changeButton: UIButton! + @IBOutlet weak var resetButton: UIButton! + + var actionSheet: UIAlertController! + + let availableLanguages = Localize.availableLanguages(true) + + // MARK: UIViewController + + override func viewDidLoad() { + super.viewDidLoad() + } + + // MARK: IBActions + + @IBAction func doChangeLanguage(_ sender: AnyObject) { + actionSheet = UIAlertController(title: nil, message: "Switch Language", preferredStyle: UIAlertControllerStyle.actionSheet) + for language in availableLanguages { + let displayName = Localize.displayNameForLanguage(language) + let languageAction = UIAlertAction(title: displayName, style: .default, handler: { + (alert: UIAlertAction!) -> Void in + + Localize.setCurrentLanguage(language) + + let storyboard = UIStoryboard(name: "Main", bundle: nil) + + // Option 1: + /*let rootViewController = storyboard.instantiateInitialViewController()! + Localize.setCurrentLanguage(language, restartFromRoot: rootViewController)*/ + + // Option 2: + let chooseViewController = storyboard.instantiateViewController(withIdentifier: "chooseViewController") + self.navigationController?.setViewControllers([chooseViewController], animated: true) + + }) + actionSheet.addAction(languageAction) + } + let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: { + (alert: UIAlertAction) -> Void in + }) + actionSheet.addAction(cancelAction) + self.present(actionSheet, animated: true, completion: nil) + } + + @IBAction func doResetLanguage(_ sender: AnyObject) { + Localize.resetCurrentLanguageToDefault() + + let storyboard = UIStoryboard(name: "Main", bundle: nil) + + // Option 1: + /*let rootViewController = storyboard.instantiateInitialViewController()! + Localize.setCurrentLanguage(language, restartFromRoot: rootViewController)*/ + + // Option 2: + let chooseViewController = storyboard.instantiateViewController(withIdentifier: "chooseViewController") + self.navigationController?.setViewControllers([chooseViewController], animated: true) + } +} + diff --git a/examples/LanguageSwitch/Sample/de.lproj/Main.strings b/examples/LanguageSwitch/Sample/de.lproj/Main.strings new file mode 100644 index 0000000..15eccb4 --- /dev/null +++ b/examples/LanguageSwitch/Sample/de.lproj/Main.strings @@ -0,0 +1,27 @@ + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "Ändern"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "Ändern"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "Wähle eine Option"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "Nach Code"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "Nach Storyboard"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "Umkehren"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "Hallo Welt"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "Umkehren"; diff --git a/examples/LanguageSwitch/Sample/en.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/en.lproj/ButtonTitles.strings deleted file mode 100644 index b94a3bc..0000000 --- a/examples/LanguageSwitch/Sample/en.lproj/ButtonTitles.strings +++ /dev/null @@ -1,11 +0,0 @@ -/* - ButtonTitles.strings - Sample - - Created by Vitalii Budnik on 10/6/16. - Copyright © 2016 Roy Marmelstein. All rights reserved. -*/ - -"Change" = "Change"; - -"Reset" = "Reset"; diff --git a/examples/LanguageSwitch/Sample/en.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/en.lproj/Localizable.strings deleted file mode 100644 index 2768803..0000000 --- a/examples/LanguageSwitch/Sample/en.lproj/Localizable.strings +++ /dev/null @@ -1,9 +0,0 @@ -/* - Localizable.strings - Sample - - Created by Roy Marmelstein on 05/08/2015. - Copyright (c) 2015 Roy Marmelstein. All rights reserved. -*/ - -"Hello world" = "Hello world"; diff --git a/examples/LanguageSwitch/Sample/en.lproj/Main.storyboard b/examples/LanguageSwitch/Sample/en.lproj/Main.storyboard deleted file mode 100644 index d3cf271..0000000 --- a/examples/LanguageSwitch/Sample/en.lproj/Main.storyboard +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/LanguageSwitch/Sample/en.lproj/Main.strings b/examples/LanguageSwitch/Sample/en.lproj/Main.strings new file mode 100644 index 0000000..011077e --- /dev/null +++ b/examples/LanguageSwitch/Sample/en.lproj/Main.strings @@ -0,0 +1,27 @@ + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "Change"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "Change"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "Choose an option"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "Via Code"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "Via Storyboard"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "Reset"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "Hello world"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "Reset"; diff --git a/examples/LanguageSwitch/Sample/es.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/es.lproj/ButtonTitles.strings deleted file mode 100644 index def6199..0000000 --- a/examples/LanguageSwitch/Sample/es.lproj/ButtonTitles.strings +++ /dev/null @@ -1,11 +0,0 @@ -/* - Localizable.strings - Sample - - Created by Roy Marmelstein on 05/08/2015. - Copyright (c) 2015 Roy Marmelstein. All rights reserved. -*/ - -"Change" = "Cambiar"; - -"Reset" = "Reiniciar"; diff --git a/examples/LanguageSwitch/Sample/es.lproj/InfoPlist.strings b/examples/LanguageSwitch/Sample/es.lproj/InfoPlist.strings new file mode 100644 index 0000000..874e8a4 --- /dev/null +++ b/examples/LanguageSwitch/Sample/es.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ diff --git a/examples/LanguageSwitch/Sample/es.lproj/LaunchScreen.strings b/examples/LanguageSwitch/Sample/es.lproj/LaunchScreen.strings new file mode 100644 index 0000000..874e8a4 --- /dev/null +++ b/examples/LanguageSwitch/Sample/es.lproj/LaunchScreen.strings @@ -0,0 +1 @@ +/* No Localized Strings */ diff --git a/examples/LanguageSwitch/Sample/es.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/es.lproj/Localizable.strings deleted file mode 100644 index 95ab69b..0000000 --- a/examples/LanguageSwitch/Sample/es.lproj/Localizable.strings +++ /dev/null @@ -1,9 +0,0 @@ -/* - Localizable.strings - Sample - - Created by Roy Marmelstein on 05/08/2015. - Copyright (c) 2015 Roy Marmelstein. All rights reserved. -*/ - -"Hello world" = "Hola mundo"; diff --git a/examples/LanguageSwitch/Sample/es.lproj/Main.strings b/examples/LanguageSwitch/Sample/es.lproj/Main.strings new file mode 100644 index 0000000..0293d6f --- /dev/null +++ b/examples/LanguageSwitch/Sample/es.lproj/Main.strings @@ -0,0 +1,27 @@ +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "Cambiar"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "Cambiar"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "Escoge una opción"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "Por código"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "Por guión gráfico"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "Reiniciar"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "Hola mundo"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "Reiniciar"; + diff --git a/examples/LanguageSwitch/Sample/fr.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/fr.lproj/ButtonTitles.strings deleted file mode 100644 index fb94c75..0000000 --- a/examples/LanguageSwitch/Sample/fr.lproj/ButtonTitles.strings +++ /dev/null @@ -1,11 +0,0 @@ -/* - ButtonTitles.strings - Sample - - Created by Vitalii Budnik on 10/6/16. - Copyright © 2016 Roy Marmelstein. All rights reserved. -*/ - -"Change" = "Modifier"; - -"Reset" = "Réinitialiser"; diff --git a/examples/LanguageSwitch/Sample/fr.lproj/InfoPlist.strings b/examples/LanguageSwitch/Sample/fr.lproj/InfoPlist.strings new file mode 100644 index 0000000..874e8a4 --- /dev/null +++ b/examples/LanguageSwitch/Sample/fr.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ diff --git a/examples/LanguageSwitch/Sample/fr.lproj/LaunchScreen.strings b/examples/LanguageSwitch/Sample/fr.lproj/LaunchScreen.strings new file mode 100644 index 0000000..874e8a4 --- /dev/null +++ b/examples/LanguageSwitch/Sample/fr.lproj/LaunchScreen.strings @@ -0,0 +1 @@ +/* No Localized Strings */ diff --git a/examples/LanguageSwitch/Sample/fr.lproj/Localizable.strings b/examples/LanguageSwitch/Sample/fr.lproj/Localizable.strings deleted file mode 100644 index a69a2c4..0000000 --- a/examples/LanguageSwitch/Sample/fr.lproj/Localizable.strings +++ /dev/null @@ -1,9 +0,0 @@ -/* - Localizable.strings - Sample - - Created by Roy Marmelstein on 05/08/2015. - Copyright (c) 2015 Roy Marmelstein. All rights reserved. -*/ - -"Hello world" = "Bonjour le monde"; diff --git a/examples/LanguageSwitch/Sample/fr.lproj/Main.strings b/examples/LanguageSwitch/Sample/fr.lproj/Main.strings new file mode 100644 index 0000000..1ef4278 --- /dev/null +++ b/examples/LanguageSwitch/Sample/fr.lproj/Main.strings @@ -0,0 +1,27 @@ +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "Modifier"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "Modifier"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "Choisis une option"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "Par code"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "Par Storyboard"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "Réinitialiser"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "Bonjour le monde"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "Réinitialiser"; + diff --git a/examples/LanguageSwitch/Sample/he.lproj/Main.strings b/examples/LanguageSwitch/Sample/he.lproj/Main.strings new file mode 100644 index 0000000..7eb6f99 --- /dev/null +++ b/examples/LanguageSwitch/Sample/he.lproj/Main.strings @@ -0,0 +1,27 @@ + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "שינוי"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "שינוי"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "בחר באפשרות"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "לפי קוד"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "לפי לוח התכנון"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "אתחל"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "שלום עולם"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "אתחל"; diff --git a/examples/LanguageSwitch/Sample/it.lproj/Main.strings b/examples/LanguageSwitch/Sample/it.lproj/Main.strings new file mode 100644 index 0000000..2b185fe --- /dev/null +++ b/examples/LanguageSwitch/Sample/it.lproj/Main.strings @@ -0,0 +1,27 @@ + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "Cambia"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "Cambia"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "Scegliere un'opzione"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "Per codice"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "Per storyboard"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "Ripristinare"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "Ciao mondo"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "Ripristinare"; diff --git a/examples/LanguageSwitch/Sample/ja.lproj/Main.strings b/examples/LanguageSwitch/Sample/ja.lproj/Main.strings new file mode 100644 index 0000000..b163220 --- /dev/null +++ b/examples/LanguageSwitch/Sample/ja.lproj/Main.strings @@ -0,0 +1,27 @@ + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "変更します"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "変更します"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "選択とオプション"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "コード別"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "ストーリーボード"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "リセットします"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "こんにちは世界"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "リセットします"; diff --git a/examples/LanguageSwitch/Sample/zh-Hans.lproj/Main.strings b/examples/LanguageSwitch/Sample/zh-Hans.lproj/Main.strings new file mode 100644 index 0000000..cdd7e28 --- /dev/null +++ b/examples/LanguageSwitch/Sample/zh-Hans.lproj/Main.strings @@ -0,0 +1,27 @@ + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "改变"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "改变"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "选择和选项"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "通过代码"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "通过故事板"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "重置"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "你好世界"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "重置"; diff --git a/examples/LanguageSwitch/Sample/zh-Hant.lproj/Main.strings b/examples/LanguageSwitch/Sample/zh-Hant.lproj/Main.strings new file mode 100644 index 0000000..c115d36 --- /dev/null +++ b/examples/LanguageSwitch/Sample/zh-Hant.lproj/Main.strings @@ -0,0 +1,27 @@ + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "3TV-mT-Vwu"; */ +"3TV-mT-Vwu.normalTitle" = "改變"; + +/* Class = "UIButton"; normalTitle = "Change"; ObjectID = "PPW-2d-udp"; */ +"PPW-2d-udp.normalTitle" = "改變"; + +/* Class = "UILabel"; text = "Choose an option"; ObjectID = "XgW-dZ-J8l"; */ +"XgW-dZ-J8l.text" = "選擇和選項"; + +/* Class = "UIButton"; normalTitle = "Via Code"; ObjectID = "cd7-Vb-QDa"; */ +"cd7-Vb-QDa.normalTitle" = "通過代碼"; + +/* Class = "UIButton"; normalTitle = "Via Storyboard"; ObjectID = "ebF-Vi-h4D"; */ +"ebF-Vi-h4D.normalTitle" = "通過故事板"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "pYA-Tt-i1b"; */ +"pYA-Tt-i1b.text" = "Label"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "s5q-wp-dud"; */ +"s5q-wp-dud.normalTitle" = "重置"; + +/* Class = "UILabel"; text = "Hello world"; ObjectID = "sVF-PC-7lS"; */ +"sVF-PC-7lS.text" = "你好世界"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "wKL-If-xit"; */ +"wKL-If-xit.normalTitle" = "重置"; From dbc58da6f9d5e0a2217b865900ca34171bfd3ebb Mon Sep 17 00:00:00 2001 From: Mario Andres Villamizar Palacio Date: Mon, 23 Apr 2018 10:39:20 -0500 Subject: [PATCH 3/7] Updating example to support storyboards based translations --- .../Sample/Resources/en.lproj/ButtonTitles.strings | 10 ++++++---- .../Sample/Resources/fr.lproj/ButtonTitles.strings | 12 +++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) mode change 100644 => 100755 examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings diff --git a/examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings old mode 100644 new mode 100755 index 5537d9a..b94a3bc --- a/examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings +++ b/examples/LanguageSwitch/Sample/Resources/en.lproj/ButtonTitles.strings @@ -1,9 +1,11 @@ /* - Localizable.strings + ButtonTitles.strings Sample - Created by Mario Andres Villamizar Palacio on 4/23/18. - Copyright © 2018 Roy Marmelstein. All rights reserved. + Created by Vitalii Budnik on 10/6/16. + Copyright © 2016 Roy Marmelstein. All rights reserved. */ -"Hello world" = "Hello world"; +"Change" = "Change"; + +"Reset" = "Reset"; diff --git a/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings index 874e8a4..fb94c75 100755 --- a/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings +++ b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings @@ -1 +1,11 @@ -/* No Localized Strings */ +/* + ButtonTitles.strings + Sample + + Created by Vitalii Budnik on 10/6/16. + Copyright © 2016 Roy Marmelstein. All rights reserved. +*/ + +"Change" = "Modifier"; + +"Reset" = "Réinitialiser"; From 63f70dcbf877ff90cdf1b393b59cf77139774fce Mon Sep 17 00:00:00 2001 From: Mario Andres Villamizar Palacio Date: Mon, 23 Apr 2018 10:50:36 -0500 Subject: [PATCH 4/7] Updating example to support storyboards based translations --- .../Sample.xcodeproj/project.pbxproj | 2 -- .../Resources/es.lproj/ButtonTitles.strings | 12 +++++++++++- .../Resources/fr.lproj/ButtonTitles.strings | 18 +++++++++--------- .../zh-Hant.lproj/ButtonTitles.strings | 9 --------- 4 files changed, 20 insertions(+), 21 deletions(-) delete mode 100644 examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings diff --git a/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj b/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj index bfdbdd3..92d9ca4 100644 --- a/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj +++ b/examples/LanguageSwitch/Sample.xcodeproj/project.pbxproj @@ -131,7 +131,6 @@ A9175191208E235400558E26 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ButtonTitles.strings"; sourceTree = ""; }; A9175192208E235500558E26 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/ButtonTitles.strings; sourceTree = ""; }; A9175193208E235600558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/ButtonTitles.strings; sourceTree = ""; }; - A9175194208E235700558E26 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/ButtonTitles.strings"; sourceTree = ""; }; A9175195208E25F000558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/LaunchScreen.strings; sourceTree = ""; }; A9175199208E25F100558E26 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; A917519B208E262B00558E26 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/LaunchScreen.strings; sourceTree = ""; }; @@ -611,7 +610,6 @@ A9175191208E235400558E26 /* zh-Hans */, A9175192208E235500558E26 /* he */, A9175193208E235600558E26 /* es */, - A9175194208E235700558E26 /* zh-Hant */, ); name = ButtonTitles.strings; path = Resources; diff --git a/examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings index 874e8a4..def6199 100755 --- a/examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings +++ b/examples/LanguageSwitch/Sample/Resources/es.lproj/ButtonTitles.strings @@ -1 +1,11 @@ -/* No Localized Strings */ +/* + Localizable.strings + Sample + + Created by Roy Marmelstein on 05/08/2015. + Copyright (c) 2015 Roy Marmelstein. All rights reserved. +*/ + +"Change" = "Cambiar"; + +"Reset" = "Reiniciar"; diff --git a/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings index fb94c75..ed20f42 100755 --- a/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings +++ b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings @@ -1,11 +1,11 @@ -/* - ButtonTitles.strings - Sample +/* + Localizable.strings + Sample + + Created by Roy Marmelstein on 05/08/2015. + Copyright (c) 2015 Roy Marmelstein. All rights reserved. + */ - Created by Vitalii Budnik on 10/6/16. - Copyright © 2016 Roy Marmelstein. All rights reserved. -*/ +"Change" = "Cambia"; -"Change" = "Modifier"; - -"Reset" = "Réinitialiser"; +"Reset" = "Ripristinare"; diff --git a/examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings deleted file mode 100644 index 5537d9a..0000000 --- a/examples/LanguageSwitch/Sample/Resources/zh-Hant.lproj/ButtonTitles.strings +++ /dev/null @@ -1,9 +0,0 @@ -/* - Localizable.strings - Sample - - Created by Mario Andres Villamizar Palacio on 4/23/18. - Copyright © 2018 Roy Marmelstein. All rights reserved. -*/ - -"Hello world" = "Hello world"; From 0c6aad5cf1d59e9275a353637a02a61da54c8e18 Mon Sep 17 00:00:00 2001 From: Mario Andres Villamizar Palacio Date: Mon, 23 Apr 2018 11:06:34 -0500 Subject: [PATCH 5/7] Updating example to support storyboards based translations --- .../Sample/Resources/fr.lproj/ButtonTitles.strings | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings index ed20f42..7292fc8 100755 --- a/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings +++ b/examples/LanguageSwitch/Sample/Resources/fr.lproj/ButtonTitles.strings @@ -6,6 +6,6 @@ Copyright (c) 2015 Roy Marmelstein. All rights reserved. */ -"Change" = "Cambia"; +"Change" = "Modifier"; -"Reset" = "Ripristinare"; +"Reset" = "Réinitialiser"; From ae441355428d4d78a7af83d83e75938790129c5e Mon Sep 17 00:00:00 2001 From: Mario Andres Villamizar Palacio Date: Mon, 7 May 2018 18:41:50 -0500 Subject: [PATCH 6/7] - Fixing bugs with arabic language - Adding animation to restart from root view controller --- Localize_Swift.xcodeproj/project.pbxproj | 4 ++ Sources/Localize.swift | 92 ++++++++++++++++++++---- Sources/NSBundle+Language.h | 4 +- Sources/NSBundle+Language.m | 12 ++-- 4 files changed, 92 insertions(+), 20 deletions(-) diff --git a/Localize_Swift.xcodeproj/project.pbxproj b/Localize_Swift.xcodeproj/project.pbxproj index 48c809d..2a74b21 100644 --- a/Localize_Swift.xcodeproj/project.pbxproj +++ b/Localize_Swift.xcodeproj/project.pbxproj @@ -33,6 +33,7 @@ 68A520051DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */; }; 68A520061DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */; }; 68A520071DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */; }; + A92704AD20A0A3BB00122600 /* Bundle+Localize.swift in Sources */ = {isa = PBXBuildFile; fileRef = A92704AC20A0A3BB00122600 /* Bundle+Localize.swift */; }; A93287AB2079320500CFADC0 /* NSBundle+Language.m in Sources */ = {isa = PBXBuildFile; fileRef = A93287A92079320400CFADC0 /* NSBundle+Language.m */; }; A93287AC2079320500CFADC0 /* NSBundle+Language.h in Headers */ = {isa = PBXBuildFile; fileRef = A93287AA2079320400CFADC0 /* NSBundle+Language.h */; settings = {ATTRIBUTES = (Public, ); }; }; A93287AD2079327500CFADC0 /* NSBundle+Language.h in Headers */ = {isa = PBXBuildFile; fileRef = A93287AA2079320400CFADC0 /* NSBundle+Language.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -65,6 +66,7 @@ 68973D651DA7AA200076F08A /* String+LocalizeBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+LocalizeBundle.swift"; path = "Sources/String+LocalizeBundle.swift"; sourceTree = SOURCE_ROOT; }; 68973D6A1DA7AB140076F08A /* String+LocalizedBundleTableName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+LocalizedBundleTableName.swift"; path = "Sources/String+LocalizedBundleTableName.swift"; sourceTree = SOURCE_ROOT; }; 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; name = "String+LocalizeTableName.swift"; path = "Sources/String+LocalizeTableName.swift"; sourceTree = SOURCE_ROOT; tabWidth = 4; usesTabs = 0; }; + A92704AC20A0A3BB00122600 /* Bundle+Localize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Bundle+Localize.swift"; path = "Sources/Bundle+Localize.swift"; sourceTree = SOURCE_ROOT; }; A93287A92079320400CFADC0 /* NSBundle+Language.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSBundle+Language.m"; path = "Sources/NSBundle+Language.m"; sourceTree = SOURCE_ROOT; }; A93287AA2079320400CFADC0 /* NSBundle+Language.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSBundle+Language.h"; path = "Sources/NSBundle+Language.h"; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -142,6 +144,7 @@ 68A520031DA6D5FD00F43D9E /* String+LocalizeTableName.swift */, 68973D651DA7AA200076F08A /* String+LocalizeBundle.swift */, 68973D6A1DA7AB140076F08A /* String+LocalizedBundleTableName.swift */, + A92704AC20A0A3BB00122600 /* Bundle+Localize.swift */, A93287AA2079320400CFADC0 /* NSBundle+Language.h */, A93287A92079320400CFADC0 /* NSBundle+Language.m */, 3433F23B1C518AF7003AE34D /* Info.plist */, @@ -380,6 +383,7 @@ files = ( 68973D6B1DA7AB140076F08A /* String+LocalizedBundleTableName.swift in Sources */, A93287AB2079320500CFADC0 /* NSBundle+Language.m in Sources */, + A92704AD20A0A3BB00122600 /* Bundle+Localize.swift in Sources */, 68973D661DA7AA200076F08A /* String+LocalizeBundle.swift in Sources */, 3433F2531C518B38003AE34D /* Localize.swift in Sources */, 68A520041DA6D5FD00F43D9E /* String+LocalizeTableName.swift in Sources */, diff --git a/Sources/Localize.swift b/Sources/Localize.swift index e4f9b3e..1ea568f 100644 --- a/Sources/Localize.swift +++ b/Sources/Localize.swift @@ -118,25 +118,30 @@ open class Localize: NSObject { Change the current language - Parameter language: Desired language. */ - open class func setCurrentLanguage(_ language: String) { + open class func setCurrentLanguage(_ language: String, forcingRTL flag: Bool = false) { let selectedLanguage = availableLanguages().contains(language) ? language : defaultLanguage() - if (selectedLanguage != currentLanguage()) { - UserDefaults.standard.set(selectedLanguage, forKey: LCLCurrentLanguageKey) - UserDefaults.standard.set([selectedLanguage], forKey: AppleLanguagesKey) - UserDefaults.standard.synchronize() - NotificationCenter.default.post(name: Notification.Name(rawValue: LCLLanguageChangeNotification), - object: nil) - Bundle.setLanguage(language) - } + UserDefaults.standard.set(selectedLanguage, forKey: LCLCurrentLanguageKey) + UserDefaults.standard.set([selectedLanguage], forKey: AppleLanguagesKey) + UserDefaults.standard.synchronize() + NotificationCenter.default.post(name: Notification.Name(rawValue: LCLLanguageChangeNotification), + object: nil) + Bundle.setLanguage(language, forcingRTL: flag) } /** Change the current language and Restart from the Root View Controller - Parameter language: Desired language. */ - open class func setCurrentLanguage(_ language: String, restartFromRoot rootViewController: UIViewController) { - self.setCurrentLanguage(language) + open class func setCurrentLanguage(_ language: String, forcingRTL flag: Bool = false, restartingFromRoot rootViewController: UIViewController, animated: Bool = false) { + self.setCurrentLanguage(language, forcingRTL: flag) UIApplication.shared.keyWindow?.rootViewController = rootViewController + + if animated { + let mainwindow = (UIApplication.shared.delegate?.window!)! + mainwindow.backgroundColor = UIColor(hue: 0.6477, saturation: 0.6314, brightness: 0.6077, alpha: 0.8) + UIView.transition(with: mainwindow, duration: 0.5, options: .transitionFlipFromLeft, + animations: nil, completion: nil) + } } /** @@ -161,8 +166,8 @@ open class Localize: NSObject { /** Resets the current language to the default */ - open class func resetCurrentLanguageToDefault() { - setCurrentLanguage(self.defaultLanguage()) + open class func resetCurrentLanguageToDefault(forcingRTL flag: Bool = false) { + self.setCurrentLanguage(self.defaultLanguage(), forcingRTL: flag) } /** @@ -171,10 +176,69 @@ open class Localize: NSObject { - Returns: The localized string. */ open class func displayNameForLanguage(_ language: String) -> String { - let locale : NSLocale = NSLocale(localeIdentifier: currentLanguage()) + let locale : NSLocale = NSLocale(localeIdentifier: self.currentLanguage()) if let displayName = locale.displayName(forKey: NSLocale.Key.identifier, value: language) { return displayName } return String() } } + + +extension UILabel { + + var originalAligment: NSTextAlignment { + get { + switch self.tag { + case 989796: + return .center + case 232425: + return .justified + case 757677: + return .left + case 343332: + return .right + case 616365: + return .natural + default: + return .justified + } + } + set { + switch newValue { + case .center: + self.tag = 989796 + case .justified: + self.tag = 232425 + case .left: + self.tag = 757677 + case .right: + self.tag = 343332 + case .natural: + self.tag = 616365 + } + } + } + + open override func awakeFromNib() { + super.awakeFromNib() + + self.originalAligment = self.textAlignment + } + + open override func layoutSubviews() { + super.layoutSubviews() + if self.isKind(of: NSClassFromString("UITextFieldLabel")!) { + return // handle special case with uitextfields + } + if Localize.currentLanguage() == "ar" { + if self.originalAligment != .center { + self.textAlignment = self.originalAligment == .right ? .left : .right + } + } else { + if self.originalAligment != .center || self.originalAligment != .justified { + self.textAlignment = self.originalAligment + } + } + } +} diff --git a/Sources/NSBundle+Language.h b/Sources/NSBundle+Language.h index 6c5376e..4c0dca4 100755 --- a/Sources/NSBundle+Language.h +++ b/Sources/NSBundle+Language.h @@ -10,6 +10,6 @@ @interface NSBundle (Language) -+ (void)setLanguage:(NSString *)language; - ++ (void)setLanguage:(NSString *)language forcingRTL:(BOOL) flag; + @end diff --git a/Sources/NSBundle+Language.m b/Sources/NSBundle+Language.m index 8ac704e..28ec3ed 100755 --- a/Sources/NSBundle+Language.m +++ b/Sources/NSBundle+Language.m @@ -33,15 +33,19 @@ - (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value tabl @implementation NSBundle (Language) -+ (void)setLanguage:(NSString *)language ++ (void)setLanguage:(NSString *)language forcingRTL:(BOOL) flag { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ object_setClass([NSBundle mainBundle], [BundleEx class]); }); - [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; - [[UITableView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; - [[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + + + if (@available(iOS 9.0, *)) { + [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + } else { + // Fallback on earlier versions + } id value = language ? [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:language ofType:@"lproj"]] : nil; objc_setAssociatedObject([NSBundle mainBundle], &kBundleKey, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); From 6d63c06d6878b6dcbfcedf8a95f07789e42863c6 Mon Sep 17 00:00:00 2001 From: Mario Andres Villamizar Palacio Date: Mon, 7 May 2018 18:42:35 -0500 Subject: [PATCH 7/7] - Fixing bugs with arabic language - Adding animation to restart from root view controller --- Sources/NSBundle+Language.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/NSBundle+Language.m b/Sources/NSBundle+Language.m index 28ec3ed..3104a0c 100755 --- a/Sources/NSBundle+Language.m +++ b/Sources/NSBundle+Language.m @@ -40,11 +40,18 @@ + (void)setLanguage:(NSString *)language forcingRTL:(BOOL) flag object_setClass([NSBundle mainBundle], [BundleEx class]); }); - - if (@available(iOS 9.0, *)) { - [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + if (flag == true) { + if (@available(iOS 9.0, *)) { + [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; + [[UITableView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; + [[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; + } } else { - // Fallback on earlier versions + if (@available(iOS 9.0, *)) { + [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + [[UITableView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + [[UINavigationBar appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; + } } id value = language ? [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:language ofType:@"lproj"]] : nil;