Skip to content

Commit

Permalink
Merge pull request #2 from andresilvagomez/v1.1
Browse files Browse the repository at this point in the history
V1.1
  • Loading branch information
andresilvagomez authored Jan 17, 2017
2 parents 3b4d949 + fdcc69c commit f4ee290
Show file tree
Hide file tree
Showing 24 changed files with 928 additions and 230 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Change Log
All notable changes to this project will be documented in this file.
`JsonLocalizable` adheres to [Semantic Versioning](http://semver.org/).

## [1.1](https://github.com/kekiiwaa/JsonLocalizable/releases/tag/1.1)
Released on 2017-01-17.

#### Added
- Documentation for all methods.
- Method to detect all available languages.
- Method to localize languages codes.
- Method to update language with string language code.
- Notification when user change a language.
- Update all localized components when user change language.
- Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request
[#2](https://github.com/kekiiwaa/JsonLocalizable/pull/2).

#### Updated
- Updated Example.
- Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request
[#2](https://github.com/kekiiwaa/JsonLocalizable/pull/2).

---
49 changes: 32 additions & 17 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
/* Begin PBXBuildFile section */
9F8D41511E29359A00D7CE9A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F8D41501E29359A00D7CE9A /* AppDelegate.swift */; };
9F8D41531E29359A00D7CE9A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F8D41521E29359A00D7CE9A /* ViewController.swift */; };
9F8D41561E29359A00D7CE9A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F8D41541E29359A00D7CE9A /* Main.storyboard */; };
9F8D41581E29359A00D7CE9A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F8D41571E29359A00D7CE9A /* Assets.xcassets */; };
9F8D415B1E29359A00D7CE9A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F8D41591E29359A00D7CE9A /* LaunchScreen.storyboard */; };
9F8D416C1E2935EB00D7CE9A /* JsonLocalizable.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F8D41681E2935AD00D7CE9A /* JsonLocalizable.framework */; };
9F8D416D1E2935EB00D7CE9A /* JsonLocalizable.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9F8D41681E2935AD00D7CE9A /* JsonLocalizable.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9FB68F231E2B5D1400D386CE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FB68F1F1E2B5D1400D386CE /* LaunchScreen.storyboard */; };
9FB68F241E2B5D1400D386CE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FB68F211E2B5D1400D386CE /* Main.storyboard */; };
9FB68F271E2B611E00D386CE /* lang-es.json in Resources */ = {isa = PBXBuildFile; fileRef = 9FB68F251E2B611E00D386CE /* lang-es.json */; };
9FB68F281E2B611E00D386CE /* lang-fr.json in Resources */ = {isa = PBXBuildFile; fileRef = 9FB68F261E2B611E00D386CE /* lang-fr.json */; };
9FEED39D1E29369A006CA6A7 /* lang-en.json in Resources */ = {isa = PBXBuildFile; fileRef = 9FEED39C1E29369A006CA6A7 /* lang-en.json */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -59,11 +61,13 @@
9F8D414D1E29359A00D7CE9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
9F8D41501E29359A00D7CE9A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9F8D41521E29359A00D7CE9A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
9F8D41551E29359A00D7CE9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
9F8D41571E29359A00D7CE9A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
9F8D415A1E29359A00D7CE9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9F8D415C1E29359A00D7CE9A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9F8D41621E2935AD00D7CE9A /* JsonLocalizable.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = JsonLocalizable.xcodeproj; path = ../JsonLocalizable.xcodeproj; sourceTree = "<group>"; };
9FB68F201E2B5D1400D386CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9FB68F221E2B5D1400D386CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
9FB68F251E2B611E00D386CE /* lang-es.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-es.json"; sourceTree = "<group>"; };
9FB68F261E2B611E00D386CE /* lang-fr.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-fr.json"; sourceTree = "<group>"; };
9FEED39C1E29369A006CA6A7 /* lang-en.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-en.json"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -101,11 +105,13 @@
children = (
9F8D41501E29359A00D7CE9A /* AppDelegate.swift */,
9F8D41521E29359A00D7CE9A /* ViewController.swift */,
9F8D41541E29359A00D7CE9A /* Main.storyboard */,
9FB68F1F1E2B5D1400D386CE /* LaunchScreen.storyboard */,
9FB68F211E2B5D1400D386CE /* Main.storyboard */,
9F8D41571E29359A00D7CE9A /* Assets.xcassets */,
9F8D41591E29359A00D7CE9A /* LaunchScreen.storyboard */,
9F8D415C1E29359A00D7CE9A /* Info.plist */,
9FEED39C1E29369A006CA6A7 /* lang-en.json */,
9FB68F251E2B611E00D386CE /* lang-es.json */,
9FB68F261E2B611E00D386CE /* lang-fr.json */,
);
path = Example;
sourceTree = "<group>";
Expand Down Expand Up @@ -153,7 +159,7 @@
TargetAttributes = {
9F8D414C1E29359A00D7CE9A = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Automatic;
ProvisioningStyle = Manual;
};
};
};
Expand All @@ -164,6 +170,7 @@
knownRegions = (
en,
Base,
fr,
);
mainGroup = 9F8D41441E29359A00D7CE9A;
productRefGroup = 9F8D414E1E29359A00D7CE9A /* Products */;
Expand Down Expand Up @@ -203,10 +210,12 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9F8D415B1E29359A00D7CE9A /* LaunchScreen.storyboard in Resources */,
9FB68F231E2B5D1400D386CE /* LaunchScreen.storyboard in Resources */,
9FB68F271E2B611E00D386CE /* lang-es.json in Resources */,
9F8D41581E29359A00D7CE9A /* Assets.xcassets in Resources */,
9FEED39D1E29369A006CA6A7 /* lang-en.json in Resources */,
9F8D41561E29359A00D7CE9A /* Main.storyboard in Resources */,
9FB68F241E2B5D1400D386CE /* Main.storyboard in Resources */,
9FB68F281E2B611E00D386CE /* lang-fr.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -233,20 +242,20 @@
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
9F8D41541E29359A00D7CE9A /* Main.storyboard */ = {
9FB68F1F1E2B5D1400D386CE /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
9F8D41551E29359A00D7CE9A /* Base */,
9FB68F201E2B5D1400D386CE /* Base */,
);
name = Main.storyboard;
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
9F8D41591E29359A00D7CE9A /* LaunchScreen.storyboard */ = {
9FB68F211E2B5D1400D386CE /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
9F8D415A1E29359A00D7CE9A /* Base */,
9FB68F221E2B5D1400D386CE /* Base */,
);
name = LaunchScreen.storyboard;
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
Expand All @@ -256,6 +265,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -292,7 +302,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -306,6 +316,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -336,7 +347,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -350,7 +361,9 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mobility.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -363,7 +376,9 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mobility.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
scope = "0"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
4 changes: 3 additions & 1 deletion Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

let localize = Localizable.shared
// Set your file name
localize.fileName = "myFileName"
localize.fileName = "lang"
// Set your default languaje.
localize.defaultLanguage = .french
// If you want change a user language, different to default in phone use this method.
Expand All @@ -26,6 +26,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
localize.resetLanguage()
// The used language
print(localize.language())
// List of aviable languajes
print(localize.availableLanguages())

return true
}
Expand Down
68 changes: 0 additions & 68 deletions Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json

This file was deleted.

32 changes: 28 additions & 4 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="app.label" textAlignment="justified" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BBe-T0-9G7">
<rect key="frame" x="24" y="80" width="327" height="21"/>
<rect key="frame" x="16" y="80" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -44,25 +44,49 @@
<segue destination="jds-WP-fKf" kind="show" id="vGa-q7-5Qm"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t6w-Gh-I1B">
<rect key="frame" x="16" y="545" width="343" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="WnF-75-Q25"/>
</constraints>
<state key="normal" title="app.update.language"/>
<connections>
<action selector="updateLanguage:" destination="BYZ-38-t0r" eventType="touchUpInside" id="5ws-kY-s95"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="app.language" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eRz-bg-Iry">
<rect key="frame" x="16" y="163" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="HTc-mN-LYL" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="16" id="8rl-SI-bS7"/>
<constraint firstItem="p63-5M-lb2" firstAttribute="top" secondItem="t6w-Gh-I1B" secondAttribute="bottom" constant="16" id="9Re-2H-AWu"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="p63-5M-lb2" secondAttribute="bottom" constant="16" id="9S3-Za-rbL"/>
<constraint firstItem="t6w-Gh-I1B" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="16" id="HU5-Ve-Jwh"/>
<constraint firstAttribute="trailing" secondItem="HTc-mN-LYL" secondAttribute="trailing" constant="16" id="UkC-Gs-LaI"/>
<constraint firstItem="eRz-bg-Iry" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="16" id="ebQ-Lb-YlJ"/>
<constraint firstItem="eRz-bg-Iry" firstAttribute="top" secondItem="HTc-mN-LYL" secondAttribute="bottom" constant="16" id="hUa-0v-0D1"/>
<constraint firstAttribute="trailing" secondItem="t6w-Gh-I1B" secondAttribute="trailing" constant="16" id="kKu-IE-Kka"/>
<constraint firstItem="HTc-mN-LYL" firstAttribute="top" secondItem="BBe-T0-9G7" secondAttribute="bottom" constant="16" id="moj-23-sv3"/>
<constraint firstAttribute="trailing" secondItem="p63-5M-lb2" secondAttribute="trailing" constant="16" id="nG1-qm-YdX"/>
<constraint firstAttribute="trailing" secondItem="eRz-bg-Iry" secondAttribute="trailing" constant="16" id="oDf-EE-l6i"/>
<constraint firstItem="p63-5M-lb2" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="16" id="qao-xb-Pm3"/>
<constraint firstAttribute="trailing" secondItem="t6w-Gh-I1B" secondAttribute="trailing" constant="16" id="r8G-Cl-FAh"/>
<constraint firstItem="t6w-Gh-I1B" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="16" id="rgY-2g-w2o"/>
<constraint firstItem="BBe-T0-9G7" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="16" id="sG0-Z9-Ojm"/>
<constraint firstItem="BBe-T0-9G7" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="8" id="xjA-Lc-h4j"/>
<constraint firstAttribute="trailingMargin" secondItem="BBe-T0-9G7" secondAttribute="trailing" constant="8" id="zHN-Qm-zVA"/>
<constraint firstItem="BBe-T0-9G7" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="xjA-Lc-h4j"/>
<constraint firstAttribute="trailingMargin" secondItem="BBe-T0-9G7" secondAttribute="trailing" id="zHN-Qm-zVA"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="navigation.title" id="fTq-hX-6gC"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="892" y="-546"/>
<point key="canvasLocation" x="842" y="-546"/>
</scene>
<!--View Controller-->
<scene sceneID="6bZ-eB-cHT">
Expand Down
Loading

0 comments on commit f4ee290

Please sign in to comment.