Skip to content

Commit

Permalink
Merge pull request #22 from andresilvagomez/master
Browse files Browse the repository at this point in the history
Version 2.0
  • Loading branch information
andresilvagomez authored Apr 12, 2018
2 parents 121f427 + 9191b4c commit ee40be7
Show file tree
Hide file tree
Showing 42 changed files with 1,418 additions and 554 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ script:
- if [ $POD_LINT == "YES" ]; then
pod lib lint;
fi
after_success:
- bash <(curl -s https://codecov.io/bash) -t ce05bbd9-41a7-4d70-96c5-b31cad55e791
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
All notable changes to this project will be documented in this file.
`Localize` adheres to [Semantic Versioning](http://semver.org/).

## [2.0.0](https://github.com/kekiiwaa/Localize/releases/tag/2.0.0)
Released on 2018-04-12.

#### Added
- Transfer ownership to [andresilvagomez](https://github.com/andresilvagomez/Localize)
- Swift 4.1 Support.
- Faster.
- Localize.currentLanguage.
- Localize.availableLanguages.
- Segment controls localize key using "," and base.
- UIView components tested.
- By [Andres Silva](https://github.com/andresilvagomez) in Pull Request
[#22](https://github.com/Kekiiwaa/Localize/pull/22).

---

## [1.5.2](https://github.com/kekiiwaa/Localize/releases/tag/1.5.2)
Expand Down
10 changes: 7 additions & 3 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Kekiiwaa ";
TargetAttributes = {
9F8D414C1E29359A00D7CE9A = {
Expand Down Expand Up @@ -267,13 +267,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -324,13 +326,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -367,7 +371,7 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 69RRCEKXZC;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -386,7 +390,7 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 69RRCEKXZC;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -46,7 +45,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 2 additions & 2 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// If you want remove storaged languaje use
localize.resetLanguage()
// The used language
print(localize.language())
print(localize.currentLanguage)
// List of aviable languajes
print(localize.availableLanguages())
print(localize.availableLanguages)

// Or you can use static methods for all

Expand Down
80 changes: 74 additions & 6 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" 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="12089"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -23,7 +23,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<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"/>
<rect key="frame" x="16" y="80" width="343" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -32,7 +32,7 @@
</userDefinedRuntimeAttributes>
</label>
<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"/>
<rect key="frame" x="16" y="116.5" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
Expand All @@ -46,6 +46,12 @@
<constraint firstAttribute="height" constant="45" id="eO6-Rr-kSy"/>
</constraints>
<state key="normal" title="Continue"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="Continue"/>
</userDefinedRuntimeAttributes>
<connections>
<segue destination="QHj-YI-Ix7" kind="show" id="HBm-eo-j6C"/>
</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"/>
Expand All @@ -61,7 +67,7 @@
</connections>
</button>
<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"/>
<rect key="frame" x="16" y="162.5" width="343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -101,13 +107,75 @@
</objects>
<point key="canvasLocation" x="842" y="-546"/>
</scene>
<!--View Controller-->
<scene sceneID="NVm-i4-pSf">
<objects>
<viewController id="QHj-YI-Ix7" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="hJI-XG-4ql"/>
<viewControllerLayoutGuide type="bottom" id="bLK-bW-LRg"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="uK2-dp-OwS">
<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="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qqs-QI-Vck">
<rect key="frame" x="32" y="96" width="311" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="app.label" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="0HU-Y9-uB5">
<rect key="frame" x="32" y="148.5" width="311" height="128"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="128" id="oec-cu-UBT"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Qqs-QI-Vck" firstAttribute="leading" secondItem="uK2-dp-OwS" secondAttribute="leading" constant="32" id="L6v-ZM-qM4"/>
<constraint firstItem="Qqs-QI-Vck" firstAttribute="top" secondItem="hJI-XG-4ql" secondAttribute="bottom" constant="32" id="ShY-j7-TaI"/>
<constraint firstItem="0HU-Y9-uB5" firstAttribute="leading" secondItem="uK2-dp-OwS" secondAttribute="leading" constant="32" id="Vpg-0k-pFy"/>
<constraint firstAttribute="trailing" secondItem="Qqs-QI-Vck" secondAttribute="trailing" constant="32" id="anC-QM-DfQ"/>
<constraint firstAttribute="trailing" secondItem="0HU-Y9-uB5" secondAttribute="trailing" constant="32" id="gxa-Ep-xwE"/>
<constraint firstItem="0HU-Y9-uB5" firstAttribute="top" secondItem="Qqs-QI-Vck" secondAttribute="bottom" constant="32" id="ofP-yD-LYg"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="KpE-oJ-hOB">
<nil key="title"/>
<segmentedControl key="titleView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="jG6-iV-0U4">
<rect key="frame" x="127" y="7" width="121" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title=""/>
<segment title=""/>
</segments>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="navigation.segment: one, two, tree"/>
</userDefinedRuntimeAttributes>
</segmentedControl>
<barButtonItem key="rightBarButtonItem" title="Item" id="Zu7-yN-4eL">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="one"/>
</userDefinedRuntimeAttributes>
</barButtonItem>
</navigationItem>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Gkz-PL-c8H" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1700" y="-546"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="xk1-7E-ym5">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="3md-ly-arL" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="gtX-QQ-nV6">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,30 @@
{
"orientation" : "portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"scale" : "2x"
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ViewController: UIViewController {

@IBAction func updateLanguage(_ sender: Any) {
let actionSheet = UIAlertController(title: nil, message: "app.update.language".localize(), preferredStyle: UIAlertControllerStyle.actionSheet)
for language in Localize.availableLanguages() {
for language in Localize.availableLanguages {
let displayName = Localize.displayNameForLanguage(language)
let languageAction = UIAlertAction(title: displayName, style: .default, handler: {
(alert: UIAlertAction!) -> Void in
Expand Down
10 changes: 8 additions & 2 deletions Example/Example/lang-en-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
},
"the.same.lavel" : "This is a localize in the same lavel",
"navigation" : {
"title" : "Localize English DE"
"title" : "Localize English DE",
"segment": {
"one": "First",
"two": "Second"
}
},
"app" : {
"label" : "In English, Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.",
Expand All @@ -24,5 +28,7 @@
"update" : {
"language" : "Update language"
}
}
},
"one": "First",
"two": "Second"
}
10 changes: 8 additions & 2 deletions Example/Example/lang-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
},
"the.same.lavel" : "This is a localize in the same lavel",
"navigation" : {
"title" : "Localize English"
"title" : "Localize English",
"segment": {
"one": "First",
"two": "Second"
}
},
"app" : {
"label" : "In English, Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.",
Expand All @@ -24,5 +28,7 @@
"update" : {
"language" : "Update language"
}
}
},
"one": "First",
"two": "Second"
}
Loading

0 comments on commit ee40be7

Please sign in to comment.