Skip to content

Commit

Permalink
Merge pull request #5 from dipkasyap/Cocoa-pod-integration
Browse files Browse the repository at this point in the history
Cocoa pod integration
  • Loading branch information
dipkasyap authored Dec 6, 2022
2 parents 232971b + c694e6a commit a728e6d
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 214 deletions.
Binary file modified DGLocalization/.DS_Store
Binary file not shown.
5 changes: 2 additions & 3 deletions DGLocalization/DGLocalization.swift
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -76,6 +76,7 @@ class DGLocalization:NSObject {
func addLanguage(newLang: Locale) {
self.availableLocales.append(newLang)
}

func getCurrentLanguage()->Locale {
return currentLocale
}
Expand Down Expand Up @@ -110,7 +111,6 @@ class DGLocalization:NSObject {

//MARK:- Locale
class Locale: NSObject {

var name:NSString?
var languageCode:NSString?
var countryCode:NSString?
Expand All @@ -126,7 +126,6 @@ class Locale: NSObject {

//MARK:- extension
extension String {

var localize:String{
return DGLocalization.sharedInstance.getTranslationForKey(key: self as NSString) as String
}
Expand Down
130 changes: 10 additions & 120 deletions InAppLocalize.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<group>"; };
1842C4E81C3B8B1600C06E6B /* nepal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = nepal.png; sourceTree = "<group>"; };
Expand All @@ -45,7 +34,6 @@
18EA8B491B0EE004003EA593 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
18EA8B4B1B0EE004003EA593 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
18EA8B4E1B0EE004003EA593 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
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 = "<group>"; };
18EA8B5A1B0EE004003EA593 /* InAppLocalizeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppLocalizeTests.swift; sourceTree = "<group>"; };
3EEF66391D9101B3009E989B /* LanguageChooserVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LanguageChooserVC.swift; sourceTree = "<group>"; };
Expand All @@ -59,13 +47,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
18EA8B511B0EE004003EA593 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
Expand Down Expand Up @@ -101,7 +82,6 @@
isa = PBXGroup;
children = (
18EA8B3C1B0EE004003EA593 /* InAppLocalize.app */,
18EA8B541B0EE004003EA593 /* InAppLocalizeTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -168,42 +148,19 @@
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 */
18EA8B341B0EE004003EA593 /* Project object */ = {
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;
};
};
};
Expand All @@ -222,7 +179,6 @@
projectRoot = "";
targets = (
18EA8B3B1B0EE004003EA593 /* InAppLocalize */,
18EA8B531B0EE004003EA593 /* InAppLocalizeTests */,
);
};
/* End PBXProject section */
Expand All @@ -241,13 +197,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
18EA8B521B0EE004003EA593 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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";
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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 */
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>InAppLocalize.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
53 changes: 19 additions & 34 deletions InAppLocalize/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -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:- [email protected]
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
}

}
Loading

0 comments on commit a728e6d

Please sign in to comment.