diff --git a/DGLocalization/.DS_Store b/DGLocalization/.DS_Store index 5008ddf..28f5bc4 100644 Binary files a/DGLocalization/.DS_Store and b/DGLocalization/.DS_Store differ diff --git a/DGLocalization/DGLocalization.swift b/DGLocalization/DGLocalization.swift index ba55339..e38cfe3 100644 --- a/DGLocalization/DGLocalization.swift +++ b/DGLocalization/DGLocalization.swift @@ -1,7 +1,7 @@ // DGLocalization.swift // Created by Dip Kasyap on 5/22/15. // Copyright (c) 2015 Dip Kasyap . All rights reserved. -// DIP: COPYLEFT : Feel Free to Customize & Improve :) +// Feel Free to Customize & Improve :) /* The MIT License (MIT) Copyright (c) 2016 Dip Kasyap (pr0gramm3r8hai). All rights reserved. @@ -76,6 +76,7 @@ class DGLocalization:NSObject { func addLanguage(newLang: Locale) { self.availableLocales.append(newLang) } + func getCurrentLanguage()->Locale { return currentLocale } @@ -110,7 +111,6 @@ class DGLocalization:NSObject { //MARK:- Locale class Locale: NSObject { - var name:NSString? var languageCode:NSString? var countryCode:NSString? @@ -126,7 +126,6 @@ class Locale: NSObject { //MARK:- extension extension String { - var localize:String{ return DGLocalization.sharedInstance.getTranslationForKey(key: self as NSString) as String } diff --git a/InAppLocalize.xcodeproj/project.pbxproj b/InAppLocalize.xcodeproj/project.pbxproj index f1b2d47..8fa0d57 100755 --- a/InAppLocalize.xcodeproj/project.pbxproj +++ b/InAppLocalize.xcodeproj/project.pbxproj @@ -17,20 +17,9 @@ 18EA8B4A1B0EE004003EA593 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18EA8B481B0EE004003EA593 /* Main.storyboard */; }; 18EA8B4C1B0EE004003EA593 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 18EA8B4B1B0EE004003EA593 /* Images.xcassets */; }; 18EA8B4F1B0EE004003EA593 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 18EA8B4D1B0EE004003EA593 /* LaunchScreen.xib */; }; - 18EA8B5B1B0EE004003EA593 /* InAppLocalizeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18EA8B5A1B0EE004003EA593 /* InAppLocalizeTests.swift */; }; 3EEF663A1D9101B3009E989B /* LanguageChooserVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEF66391D9101B3009E989B /* LanguageChooserVC.swift */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 18EA8B551B0EE004003EA593 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 18EA8B341B0EE004003EA593 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 18EA8B3B1B0EE004003EA593; - remoteInfo = InAppLocalize; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ 1842C4D71C3B7EAD00C06E6B /* ne */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ne; path = ne.lproj/Localizable.strings; sourceTree = ""; }; 1842C4E81C3B8B1600C06E6B /* nepal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = nepal.png; sourceTree = ""; }; @@ -45,7 +34,6 @@ 18EA8B491B0EE004003EA593 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 18EA8B4B1B0EE004003EA593 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 18EA8B4E1B0EE004003EA593 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 18EA8B541B0EE004003EA593 /* InAppLocalizeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InAppLocalizeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 18EA8B591B0EE004003EA593 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 18EA8B5A1B0EE004003EA593 /* InAppLocalizeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppLocalizeTests.swift; sourceTree = ""; }; 3EEF66391D9101B3009E989B /* LanguageChooserVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LanguageChooserVC.swift; sourceTree = ""; }; @@ -59,13 +47,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 18EA8B511B0EE004003EA593 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -101,7 +82,6 @@ isa = PBXGroup; children = ( 18EA8B3C1B0EE004003EA593 /* InAppLocalize.app */, - 18EA8B541B0EE004003EA593 /* InAppLocalizeTests.xctest */, ); name = Products; sourceTree = ""; @@ -168,24 +148,6 @@ productReference = 18EA8B3C1B0EE004003EA593 /* InAppLocalize.app */; productType = "com.apple.product-type.application"; }; - 18EA8B531B0EE004003EA593 /* InAppLocalizeTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 18EA8B611B0EE004003EA593 /* Build configuration list for PBXNativeTarget "InAppLocalizeTests" */; - buildPhases = ( - 18EA8B501B0EE004003EA593 /* Sources */, - 18EA8B511B0EE004003EA593 /* Frameworks */, - 18EA8B521B0EE004003EA593 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 18EA8B561B0EE004003EA593 /* PBXTargetDependency */, - ); - name = InAppLocalizeTests; - productName = InAppLocalizeTests; - productReference = 18EA8B541B0EE004003EA593 /* InAppLocalizeTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -193,17 +155,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 1030; + LastUpgradeCheck = 1330; ORGANIZATIONNAME = apple; TargetAttributes = { 18EA8B3B1B0EE004003EA593 = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; - }; - 18EA8B531B0EE004003EA593 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; - TestTargetID = 18EA8B3B1B0EE004003EA593; + LastSwiftMigration = 1330; }; }; }; @@ -222,7 +179,6 @@ projectRoot = ""; targets = ( 18EA8B3B1B0EE004003EA593 /* InAppLocalize */, - 18EA8B531B0EE004003EA593 /* InAppLocalizeTests */, ); }; /* End PBXProject section */ @@ -241,13 +197,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 18EA8B521B0EE004003EA593 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -263,24 +212,8 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 18EA8B501B0EE004003EA593 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 18EA8B5B1B0EE004003EA593 /* InAppLocalizeTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 18EA8B561B0EE004003EA593 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 18EA8B3B1B0EE004003EA593 /* InAppLocalize */; - targetProxy = 18EA8B551B0EE004003EA593 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ 18499AAE1B14912000C816B3 /* Localizable.strings */ = { isa = PBXVariantGroup; @@ -333,6 +266,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -358,7 +292,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -391,6 +325,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -409,7 +344,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -424,10 +359,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = InAppLocalize/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.esignature.www.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -436,49 +372,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = InAppLocalize/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.esignature.www.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; - }; - name = Release; - }; - 18EA8B621B0EE004003EA593 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = InAppLocalizeTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.esignature.www.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/InAppLocalize.app/InAppLocalize"; - }; - name = Debug; - }; - 18EA8B631B0EE004003EA593 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = InAppLocalizeTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.esignature.www.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/InAppLocalize.app/InAppLocalize"; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -503,15 +402,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 18EA8B611B0EE004003EA593 /* Build configuration list for PBXNativeTarget "InAppLocalizeTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 18EA8B621B0EE004003EA593 /* Debug */, - 18EA8B631B0EE004003EA593 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ /* Begin XCVersionGroup section */ diff --git a/InAppLocalize.xcodeproj/project.xcworkspace/xcuserdata/devi.xcuserdatad/UserInterfaceState.xcuserstate b/InAppLocalize.xcodeproj/project.xcworkspace/xcuserdata/devi.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..6a45f2c Binary files /dev/null and b/InAppLocalize.xcodeproj/project.xcworkspace/xcuserdata/devi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/InAppLocalize.xcodeproj/xcuserdata/devi.xcuserdatad/xcschemes/xcschememanagement.plist b/InAppLocalize.xcodeproj/xcuserdata/devi.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..7788005 --- /dev/null +++ b/InAppLocalize.xcodeproj/xcuserdata/devi.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + InAppLocalize.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/InAppLocalize/AppDelegate.swift b/InAppLocalize/AppDelegate.swift index b198dc5..ab4b6f0 100755 --- a/InAppLocalize/AppDelegate.swift +++ b/InAppLocalize/AppDelegate.swift @@ -1,46 +1,31 @@ -// -// AppDelegate.swift -// InAppLocalize -// -// Created by Dip Kasyap on 5/22/15. -// Copyright (c) 2015 Dip Kasyap . All rights reserved. -// DIP: COPYLEFT : Feel Free to Customize & Improve :) +// Created by Dip Kasyap on 5/22/15. +// Copyright (c) 2015 Dip Kasyap . All rights reserved. +// Feel Free to Customize & Improve :) +/* +The MIT License (MIT) +Copyright (c) 2016 Dip Kasyap (pr0gramm3r8hai). All rights reserved. + +email:- dpd.ghimire@gmail.com +github : https://github.com/dipkasyap/DGLocalization + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE DGLocalization +*/ import UIKit import CoreData @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? - - private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { DGLocalization.sharedInstance.startLocalization() - return true - } - - func applicationWillResignActive(_ application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - // Saves changes in the application's managed object context before the application terminates. + return true } + } diff --git a/InAppLocalize/Base.lproj/Main.storyboard b/InAppLocalize/Base.lproj/Main.storyboard index 60d74ef..b984c52 100755 --- a/InAppLocalize/Base.lproj/Main.storyboard +++ b/InAppLocalize/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - - + + @@ -25,7 +23,7 @@ - -