Skip to content

Commit

Permalink
Merge pull request #16 from andresilvagomez/master
Browse files Browse the repository at this point in the history
v 1.5.0
  • Loading branch information
andresilvagomez authored Aug 8, 2017
2 parents e23fa3d + fc125e6 commit 43e8622
Show file tree
Hide file tree
Showing 15 changed files with 189 additions and 509 deletions.
23 changes: 19 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@
All notable changes to this project will be documented in this file.
`Localize` adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0](https://github.com/kekiiwaa/Localize/releases/tag/1.3.0)
---

## [1.5.0](https://github.com/kekiiwaa/Localize/releases/tag/1.5.0)
Released on 2017-08-08.

#### Added
- Localize UI elements with @IBInspectable.
- By [Andres Silva](https://github.com/andresilvagomez) in Pull Request
[#14](https://github.com/Kekiiwaa/Localize/pull/14).

#### Deleted
- Delete custom classes for UI elements in favor to @IBInspectable extensions.
- By [Andres Silva](https://github.com/andresilvagomez) in Pull Request
[#14](https://github.com/Kekiiwaa/Localize/pull/14).

---

## [1.4.0](https://github.com/kekiiwaa/Localize/releases/tag/1.4.0)
Released on 2017-07-10.

#### Added
- Dynamic bundle.
- Update bundle.
- Added by [Benjamin Erhart](https://github.com/tladesignz) in Pull Request
[#12](https://github.com/Kekiiwaa/Localize/pull/13).
[#13](https://github.com/Kekiiwaa/Localize/pull/13).

#### Updated
- Remove enums for language.
Expand Down Expand Up @@ -81,5 +98,3 @@ Released on 2017-01-17.
- Updated Example.
- Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request
[#2](https://github.com/kekiiwaa/Localize/pull/2).

---
27 changes: 19 additions & 8 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 48;
objects = {

/* Begin PBXBuildFile section */
9F176E791F279FF900336124 /* lang-en-DE.json in Resources */ = {isa = PBXBuildFile; fileRef = 9F8ACA6C1F279EC70052380A /* lang-en-DE.json */; };
9F36174D1E33CDA1006E81BC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F36174C1E33CDA1006E81BC /* Images.xcassets */; };
9F761AE81E3063AB00904B4B /* lang-en.json in Resources */ = {isa = PBXBuildFile; fileRef = 9F761AE51E3063AB00904B4B /* lang-en.json */; };
9F761AE91E3063AB00904B4B /* lang-es.json in Resources */ = {isa = PBXBuildFile; fileRef = 9F761AE61E3063AB00904B4B /* lang-es.json */; };
Expand Down Expand Up @@ -53,6 +54,7 @@
9F761AE51E3063AB00904B4B /* lang-en.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-en.json"; sourceTree = "<group>"; };
9F761AE61E3063AB00904B4B /* lang-es.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-es.json"; sourceTree = "<group>"; };
9F761AE71E3063AB00904B4B /* lang-fr.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-fr.json"; sourceTree = "<group>"; };
9F8ACA6C1F279EC70052380A /* lang-en-DE.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "lang-en-DE.json"; sourceTree = "<group>"; };
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>"; };
Expand Down Expand Up @@ -84,6 +86,7 @@
9F761AE21E3060B100904B4B /* Supporting Files */ = {
isa = PBXGroup;
children = (
9F8ACA6C1F279EC70052380A /* lang-en-DE.json */,
9F761AE51E3063AB00904B4B /* lang-en.json */,
9F761AE61E3063AB00904B4B /* lang-es.json */,
9F761AE71E3063AB00904B4B /* lang-fr.json */,
Expand Down Expand Up @@ -151,16 +154,16 @@
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0820;
ORGANIZATIONNAME = "Mobility Solutions SAS";
ORGANIZATIONNAME = "Kekiiwaa ";
TargetAttributes = {
9F8D414C1E29359A00D7CE9A = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Manual;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 9F8D41481E29359A00D7CE9A /* Build configuration list for PBXProject "Example" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 8.0";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -206,6 +209,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9F176E791F279FF900336124 /* lang-en-DE.json in Resources */,
9FB68F231E2B5D1400D386CE /* LaunchScreen.storyboard in Resources */,
9F761AEA1E3063AB00904B4B /* lang-fr.json in Resources */,
9FB68F241E2B5D1400D386CE /* Main.storyboard in Resources */,
Expand Down Expand Up @@ -349,12 +353,16 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 69RRCEKXZC;
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_BUNDLE_IDENTIFIER = com.kekiiwaa.localize;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand All @@ -364,12 +372,15 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 69RRCEKXZC;
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_BUNDLE_IDENTIFIER = com.kekiiwaa.localize;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down
10 changes: 5 additions & 5 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
localize.update(fileName: "lang")
// Set your default languaje.
localize.update(defaultLanguage: "fr")
// If you want change a user language, different to default in phone use this method.
// If you want change a user language, different to default in phone use thimethod.
localize.update(language: "en")
// If you want remove storaged languaje use
localize.resetLanguage()
// The used language
print(localize.language())
// List of aviable languajes
print(localize.availableLanguages())

// Or you can use static methods for all.

// Or you can use static methods for all
Localize.update(fileName: "lang")
Localize.update(defaultLanguage: "fr")
Localize.update(language: "en")
Localize.update(language: "en-DE")

return true
}
Expand Down
69 changes: 24 additions & 45 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D30a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="3md-ly-arL">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="3md-ly-arL">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--navigation.title-->
<!--Localize-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
Expand All @@ -22,43 +22,52 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<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">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Some text here" textAlignment="justified" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BBe-T0-9G7">
<rect key="frame" x="16" y="80" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="app.label"/>
</userDefinedRuntimeAttributes>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="app.textfield" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HTc-mN-LYL">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Search" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HTc-mN-LYL">
<rect key="frame" x="16" y="117" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizePlaceholder" value="app.textfield"/>
</userDefinedRuntimeAttributes>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="p63-5M-lb2">
<rect key="frame" x="16" y="606" width="343" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="eO6-Rr-kSy"/>
</constraints>
<state key="normal" title="Continue"/>
<connections>
<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"/>
<state key="normal" title="Update language"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="app.update.language"/>
</userDefinedRuntimeAttributes>
<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">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="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"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="app.language"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand All @@ -82,46 +91,16 @@
<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"/>
<navigationItem key="navigationItem" title="Localize" id="fTq-hX-6gC">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizeTitle" value="navigation.title"/>
</userDefinedRuntimeAttributes>
</navigationItem>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="842" y="-546"/>
</scene>
<!--View Controller-->
<scene sceneID="6bZ-eB-cHT">
<objects>
<viewController id="jds-WP-fKf" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="oad-br-8fg"/>
<viewControllerLayoutGuide type="bottom" id="UVU-cR-ltl"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Isn-KJ-zvj">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This is a label using class" textAlignment="justified" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OUi-ts-ES0" customClass="LocalizeLabel" customModule="Localize">
<rect key="frame" x="16" y="80" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizableKey" value="app.label"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="OUi-ts-ES0" firstAttribute="leading" secondItem="Isn-KJ-zvj" secondAttribute="leading" constant="16" id="B9B-6E-KXL"/>
<constraint firstItem="OUi-ts-ES0" firstAttribute="top" secondItem="oad-br-8fg" secondAttribute="bottom" constant="16" id="NDp-05-92R"/>
<constraint firstAttribute="trailing" secondItem="OUi-ts-ES0" secondAttribute="trailing" constant="16" id="ZGn-ET-Of6"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5BN-v0-4I9" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1722" y="-546"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="xk1-7E-ym5">
<objects>
Expand Down
4 changes: 0 additions & 4 deletions Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ class ViewController: UIViewController {
print("the.same.lavel".localize())
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}

@IBAction func updateLanguage(_ sender: Any) {
let actionSheet = UIAlertController(title: nil, message: "app.update.language".localize(), preferredStyle: UIAlertControllerStyle.actionSheet)
for language in Localize.availableLanguages() {
Expand Down
Loading

0 comments on commit 43e8622

Please sign in to comment.