Skip to content

Commit a79f1c0

Browse files
committed
added Localize and made LGTextView localizable
1 parent 744d151 commit a79f1c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2094
-629
lines changed

Example/LGTextView.xcodeproj/project.pbxproj

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
1313
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
1414
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
15+
88EC1AB4216B3B340028F21B /* lang-en.json in Resources */ = {isa = PBXBuildFile; fileRef = 88EC1AB3216B3B340028F21B /* lang-en.json */; };
16+
88EC1AB6216B3B3B0028F21B /* lang-de.json in Resources */ = {isa = PBXBuildFile; fileRef = 88EC1AB5216B3B3B0028F21B /* lang-de.json */; };
1517
D42232E67AEA58353B61D77C /* Pods_LGTextView_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6073AC2FCA27700A19EBE81 /* Pods_LGTextView_Example.framework */; };
1618
/* End PBXBuildFile section */
1719

@@ -30,6 +32,9 @@
3032
7082F6E4056EF1413B506693 /* Pods-LGTextView_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LGTextView_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-LGTextView_Example/Pods-LGTextView_Example.release.xcconfig"; sourceTree = "<group>"; };
3133
73B12A032A0B5A111CE510DE /* Pods-LGTextView_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LGTextView_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LGTextView_Tests/Pods-LGTextView_Tests.debug.xcconfig"; sourceTree = "<group>"; };
3234
8034EB8B7A5D27E22479F1BD /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
35+
88EC1AB0216B3B080028F21B /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
36+
88EC1AB3216B3B340028F21B /* lang-en.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "lang-en.json"; sourceTree = "<group>"; };
37+
88EC1AB5216B3B3B0028F21B /* lang-de.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "lang-de.json"; sourceTree = "<group>"; };
3338
ABF6D2BD3B9BE8C4914904F5 /* Pods_LGTextView_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LGTextView_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3439
ADFFE2B0AD2A019A9ED62E01 /* LGTextView.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LGTextView.podspec; path = ../LGTextView.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
3540
D6073AC2FCA27700A19EBE81 /* Pods_LGTextView_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LGTextView_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -80,6 +85,7 @@
8085
607FACD21AFB9204008FA782 /* Example for LGTextView */ = {
8186
isa = PBXGroup;
8287
children = (
88+
88EC1AB2216B3B1C0028F21B /* Localization */,
8389
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
8490
607FACD71AFB9204008FA782 /* ViewController.swift */,
8591
607FACD91AFB9204008FA782 /* Main.storyboard */,
@@ -126,6 +132,15 @@
126132
name = "Podspec Metadata";
127133
sourceTree = "<group>";
128134
};
135+
88EC1AB2216B3B1C0028F21B /* Localization */ = {
136+
isa = PBXGroup;
137+
children = (
138+
88EC1AB3216B3B340028F21B /* lang-en.json */,
139+
88EC1AB5216B3B3B0028F21B /* lang-de.json */,
140+
);
141+
path = Localization;
142+
sourceTree = "<group>";
143+
};
129144
CB8059380AD376E464EEC007 /* Pods */ = {
130145
isa = PBXGroup;
131146
children = (
@@ -201,7 +216,9 @@
201216
files = (
202217
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
203218
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
219+
88EC1AB4216B3B340028F21B /* lang-en.json in Resources */,
204220
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
221+
88EC1AB6216B3B3B0028F21B /* lang-de.json in Resources */,
205222
);
206223
runOnlyForDeploymentPostprocessing = 0;
207224
};
@@ -234,10 +251,12 @@
234251
inputPaths = (
235252
"${SRCROOT}/Pods/Target Support Files/Pods-LGTextView_Example/Pods-LGTextView_Example-frameworks.sh",
236253
"${BUILT_PRODUCTS_DIR}/LGTextView/LGTextView.framework",
254+
"${BUILT_PRODUCTS_DIR}/Localize/Localize.framework",
237255
);
238256
name = "[CP] Embed Pods Frameworks";
239257
outputPaths = (
240258
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LGTextView.framework",
259+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Localize.framework",
241260
);
242261
runOnlyForDeploymentPostprocessing = 0;
243262
shellPath = /bin/sh;
@@ -271,6 +290,7 @@
271290
isa = PBXVariantGroup;
272291
children = (
273292
607FACDF1AFB9204008FA782 /* Base */,
293+
88EC1AB0216B3B080028F21B /* de */,
274294
);
275295
name = LaunchScreen.xib;
276296
sourceTree = "<group>";
@@ -282,6 +302,7 @@
282302
isa = XCBuildConfiguration;
283303
buildSettings = {
284304
ALWAYS_SEARCH_USER_PATHS = NO;
305+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
285306
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
286307
CLANG_CXX_LIBRARY = "libc++";
287308
CLANG_ENABLE_MODULES = YES;
@@ -335,6 +356,7 @@
335356
isa = XCBuildConfiguration;
336357
buildSettings = {
337358
ALWAYS_SEARCH_USER_PATHS = NO;
359+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
338360
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
339361
CLANG_CXX_LIBRARY = "libc++";
340362
CLANG_ENABLE_MODULES = YES;
@@ -384,7 +406,7 @@
384406
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
385407
DEVELOPMENT_TEAM = 578YR5HPG3;
386408
INFOPLIST_FILE = LGTextView/Info.plist;
387-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
409+
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
388410
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
389411
MODULE_NAME = ExampleApp;
390412
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
@@ -400,7 +422,7 @@
400422
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
401423
DEVELOPMENT_TEAM = 578YR5HPG3;
402424
INFOPLIST_FILE = LGTextView/Info.plist;
403-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
425+
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
404426
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
405427
MODULE_NAME = ExampleApp;
406428
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";

Example/LGTextView/AppDelegate.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@
77
//
88

99
import UIKit
10+
import Localize
1011

1112
@UIApplicationMain
1213
class AppDelegate: UIResponder, UIApplicationDelegate {
13-
14+
1415
var window: UIWindow?
15-
16-
16+
1717
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18-
// Override point for customization after application launch.
18+
19+
let loc = Localize.shared
20+
loc.update(provider: .json)
21+
loc.update(fileName: "lang")
22+
loc.update(defaultLanguage: "en")
23+
loc.update(language: "de")
24+
1925
return true
2026
}
2127

Example/LGTextView/Base.lproj/Main.storyboard

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
3333
<userDefinedRuntimeAttributes>
3434
<userDefinedRuntimeAttribute type="string" keyPath="placeholder" value="Put some fancy placeholder here 💥"/>
35+
<userDefinedRuntimeAttribute type="string" keyPath="placeholderKey" value="placeholder"/>
3536
</userDefinedRuntimeAttributes>
3637
</textView>
3738
</subviews>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"placeholder": "Hier kannst du einen Platzhalter eintragen 💥"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"placeholder": "Put some fancy placeholder here 💥"
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
/* Class = "UILabel"; text = " Copyright (c) 2015 CocoaPods. All rights reserved."; ObjectID = "8ie-xW-0ye"; */
3+
"8ie-xW-0ye.text" = " Copyright (c) 2015 CocoaPods. All rights reserved.";
4+
5+
/* Class = "UILabel"; text = "LGTextView"; ObjectID = "kId-c2-rCX"; */
6+
"kId-c2-rCX.text" = "LGTextView";

Example/Podfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ use_frameworks!
22

33
target 'LGTextView_Example' do
44
pod 'LGTextView', :path => '../'
5-
6-
target 'LGTextView_Tests' do
7-
inherit! :search_paths
8-
5+
pod 'Localize', '~> 2.0.5'
96

10-
end
117
end

Example/Podfile.lock

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
PODS:
2-
- LGTextView (0.1.0)
2+
- LGTextView (1.0.0):
3+
- Localize (~> 2.0.5)
4+
- Localize (2.0.5)
35

46
DEPENDENCIES:
57
- LGTextView (from `../`)
8+
- Localize (~> 2.0.5)
9+
10+
SPEC REPOS:
11+
https://github.com/cocoapods/specs.git:
12+
- Localize
613

714
EXTERNAL SOURCES:
815
LGTextView:
916
:path: "../"
1017

1118
SPEC CHECKSUMS:
12-
LGTextView: 1bc97ed981e8039fcb32c420b254390220f43a8f
19+
LGTextView: 03a2b08ff80d3a51abcf37c8bc0036af06182dc1
20+
Localize: 0fa01a98c5caf8e235cc0160984c4922aa310b61
1321

14-
PODFILE CHECKSUM: 4551e5ca38dfcad68560c5aee66ab49a61736931
22+
PODFILE CHECKSUM: c8f3d35ec9325997ceae3a5dd2c65913ab79debe
1523

1624
COCOAPODS: 1.5.3

Example/Pods/Local Podspecs/LGTextView.podspec.json

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Localize/Licence

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)