Added target for localization bundle

This commit is contained in:
Matt Coneybeare
2014-09-17 14:20:41 -04:00
parent c65800b889
commit 52188a1ffd
45 changed files with 615 additions and 165 deletions

View File

@@ -39,7 +39,7 @@
import Cocoa
@NSApplicationMain
// @NSApplicationMain // TODO - Needs Xcode 6.1 beta 2 to compile. Figure out a way to support both for the time being
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6246" systemVersion="14A238x" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6246" systemVersion="14A238x" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6246"/>
</dependencies>
@@ -16,7 +16,12 @@
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<viewController id="g9K-Nf-HDk" customClass="ViewController" customModule="Mac_Example" customModuleProvider="target"/>
<viewController id="g9K-Nf-HDk" customClass="ViewController" customModule="Mac_Example" customModuleProvider="target">
<connections>
<outlet property="languageLabel" destination="TMr-De-pos" id="Pts-ch-UQq"/>
<outlet property="view" destination="EiT-Mj-1SZ" id="fYh-cJ-L5u"/>
</connections>
</viewController>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
@@ -670,7 +675,7 @@
<window title="Mac Example" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES"/>
<rect key="contentRect" x="335" y="390" width="400" height="368"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="800"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="400" height="368"/>
<autoresizingMask key="autoresizingMask"/>
@@ -686,13 +691,13 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="armchair" id="cpa-BH-nca"/>
</imageView>
<box autoresizesSubviews="NO" borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="0Gb-KD-yfU">
<rect key="frame" x="17" y="237" width="366" height="113"/>
<rect key="frame" x="17" y="250" width="366" height="100"/>
<view key="contentView">
<rect key="frame" x="1" y="1" width="364" height="111"/>
<rect key="frame" x="1" y="1" width="364" height="98"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YED-uj-VLq">
<rect key="frame" x="16" y="42" width="332" height="81"/>
<rect key="frame" x="16" y="29" width="332" height="81"/>
<constraints>
<constraint firstAttribute="width" constant="328" id="DsT-g1-qyE"/>
</constraints>
@@ -703,7 +708,7 @@
</textFieldCell>
</textField>
<button wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jkm-ga-2sM">
<rect key="frame" x="48" y="4" width="85" height="32"/>
<rect key="frame" x="63" y="8" width="85" height="32"/>
<contentFilters>
<ciFilter name="CIColorControls">
<configuration>
@@ -723,7 +728,7 @@
</connections>
</button>
<button wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yGG-Wr-1xP">
<rect key="frame" x="211" y="4" width="105" height="32"/>
<rect key="frame" x="211" y="8" width="105" height="32"/>
<contentFilters>
<ciFilter name="CIColorControls">
<configuration>
@@ -747,10 +752,10 @@
<constraints>
<constraint firstAttribute="centerX" secondItem="YED-uj-VLq" secondAttribute="centerX" id="0D2-Qc-szZ"/>
<constraint firstItem="YED-uj-VLq" firstAttribute="top" secondItem="0Gb-KD-yfU" secondAttribute="top" constant="-13" id="0dP-ks-bhc"/>
<constraint firstItem="yGG-Wr-1xP" firstAttribute="top" secondItem="YED-uj-VLq" secondAttribute="bottom" constant="6" id="FTY-wK-gxK"/>
<constraint firstItem="YED-uj-VLq" firstAttribute="leading" secondItem="jkm-ga-2sM" secondAttribute="leading" constant="-30" id="V7U-7Z-CIK"/>
<constraint firstItem="yGG-Wr-1xP" firstAttribute="top" secondItem="YED-uj-VLq" secondAttribute="bottom" constant="-11" id="FTY-wK-gxK"/>
<constraint firstItem="YED-uj-VLq" firstAttribute="leading" secondItem="jkm-ga-2sM" secondAttribute="leading" constant="-45" id="V7U-7Z-CIK"/>
<constraint firstItem="jkm-ga-2sM" firstAttribute="bottom" secondItem="yGG-Wr-1xP" secondAttribute="bottom" id="WZR-Hf-JcJ"/>
<constraint firstAttribute="height" constant="107" id="aN9-Sz-28k"/>
<constraint firstAttribute="height" constant="94" id="aN9-Sz-28k"/>
<constraint firstItem="yGG-Wr-1xP" firstAttribute="trailing" secondItem="YED-uj-VLq" secondAttribute="trailing" constant="-30" id="iUR-We-Kf1"/>
</constraints>
<color key="borderColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -770,16 +775,26 @@
<action selector="openUrbanApps:" target="g9K-Nf-HDk" id="p5P-Rh-N1T"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TMr-De-pos">
<rect key="frame" x="147" y="229" width="106" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Languange Label" id="k5m-JC-DUG">
<font key="font" size="12" name="AmericanTypewriter"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="centerY" secondItem="JWk-MV-osx" secondAttribute="centerY" id="1QU-qd-5HF"/>
<constraint firstAttribute="centerX" secondItem="JWk-MV-osx" secondAttribute="centerX" id="4MA-hd-vMN"/>
<constraint firstItem="0Gb-KD-yfU" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" id="BgQ-mm-2V4"/>
<constraint firstAttribute="bottom" secondItem="OSk-p7-dUM" secondAttribute="bottom" constant="8" id="Eg9-AS-cIz"/>
<constraint firstAttribute="centerX" secondItem="TMr-De-pos" secondAttribute="centerX" id="H7z-0n-mbL"/>
<constraint firstAttribute="trailing" secondItem="0Gb-KD-yfU" secondAttribute="trailing" constant="20" id="Jd9-NU-hNd"/>
<constraint firstAttribute="centerX" secondItem="0Gb-KD-yfU" secondAttribute="centerX" id="JvA-go-nfg"/>
<constraint firstItem="OSk-p7-dUM" firstAttribute="centerX" secondItem="0Gb-KD-yfU" secondAttribute="centerX" constant="152" id="NDh-HU-3OR"/>
<constraint firstItem="0Gb-KD-yfU" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" id="SUA-nW-p1P"/>
<constraint firstItem="TMr-De-pos" firstAttribute="top" secondItem="0Gb-KD-yfU" secondAttribute="bottom" constant="8" id="b8y-Oh-srw"/>
</constraints>
</view>
</window>

View File

@@ -12,6 +12,41 @@
<string>com.armchair.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>
<array>
<string>ar</string>
<string>arm</string>
<string>ca</string>
<string>cs</string>
<string>da</string>
<string>de</string>
<string>el</string>
<string>en</string>
<string>es</string>
<string>fi</string>
<string>fr</string>
<string>he</string>
<string>hu</string>
<string>id</string>
<string>it</string>
<string>ja</string>
<string>ko</string>
<string>ms</string>
<string>nb</string>
<string>nl</string>
<string>pl</string>
<string>pt-BR</string>
<string>pt</string>
<string>ro</string>
<string>ru</string>
<string>sk</string>
<string>sv</string>
<string>th</string>
<string>tr</string>
<string>vi</string>
<string>zh-Hans</string>
<string>zh-Hant</string>
</array>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>

View File

@@ -14,6 +14,41 @@
<string>com.armchair.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>
<array>
<string>ar</string>
<string>arm</string>
<string>ca</string>
<string>cs</string>
<string>da</string>
<string>de</string>
<string>el</string>
<string>en</string>
<string>es</string>
<string>fi</string>
<string>fr</string>
<string>he</string>
<string>hu</string>
<string>id</string>
<string>it</string>
<string>ja</string>
<string>ko</string>
<string>ms</string>
<string>nb</string>
<string>nl</string>
<string>pl</string>
<string>pt-BR</string>
<string>pt</string>
<string>ro</string>
<string>ru</string>
<string>sk</string>
<string>sv</string>
<string>th</string>
<string>tr</string>
<string>vi</string>
<string>zh-Hans</string>
<string>zh-Hant</string>
</array>
<key>CFBundleName</key>
<string>Armchair</string>
<key>CFBundlePackageType</key>

View File

@@ -22,17 +22,58 @@
#if os(iOS)
import UIKit
class ViewController: UIViewController { }
class ViewController: UIViewController {
@IBOutlet weak var languageLabel: UILabel!
}
#elseif os(OSX)
import Cocoa
class ViewController: NSViewController { }
class ViewController: NSViewController {
@IBOutlet weak var languageLabel: NSTextField!
}
#else
#endif
import Armchair
extension ViewController {
#if os(iOS)
override func viewDidLoad() {
setLanguageLabel()
}
#elseif os(OSX)
override func awakeFromNib() {
setLanguageLabel()
}
#else
#endif
func setLanguageLabel() {
var languageLabelText = ""
// Only set it if we are using Armchair localizations
if !Armchair.useMainAppBundleForLocalizations() {
var currentLocalization: NSString = NSBundle.mainBundle().preferredLocalizations[0] as NSString
// Only set it if we are using a different language than this apps development language
if let developmentLocalization = NSBundle.mainBundle().developmentLocalization {
if currentLocalization != developmentLocalization {
languageLabelText = currentLocalization
if let displayName = NSLocale(localeIdentifier: currentLocalization).displayNameForKey(NSLocaleIdentifier, value:currentLocalization) {
languageLabelText = "\(displayName): \(currentLocalization)"
}
}
}
}
#if os(iOS)
languageLabel.text = languageLabelText
#elseif os(OSX)
languageLabel.stringValue = languageLabelText
#else
#endif
}
@IBAction func presentStandardPrompt(AnyObject) {
resetAppReviewManager()
@@ -156,7 +197,7 @@ extension ViewController {
Armchair.userDidSignificantEvent(true)
}
#endif
func resetAppReviewManager() {
Armchair.resetDefaults()
}
@@ -164,7 +205,7 @@ extension ViewController {
@IBAction func openUrbanApps(AnyObject) {
let url = NSURL(string: "http://urbanapps.com")
#if os(iOS)
UIApplication.sharedApplication().openURL(url!)
UIApplication.sharedApplication().openURL(url)
#elseif os(OSX)
NSWorkspace.sharedWorkspace().openURL(url)
#else

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6246" systemVersion="14A238x" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="d2j-86-NpT">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="d2j-86-NpT">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6239"/>
<deployment defaultVersion="1792" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
@@ -102,6 +102,12 @@
<action selector="openUrbanApps:" destination="d2j-86-NpT" eventType="touchUpInside" id="gm5-65-hdf"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Language Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cRH-yo-5R5">
<rect key="frame" x="255" y="148" width="90" height="14"/>
<fontDescription key="fontDescription" name="AmericanTypewriter" family="American Typewriter" pointSize="12"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="aGK-R4-nip" firstAttribute="centerX" secondItem="p7K-BU-wrj" secondAttribute="centerX" id="0zC-Sb-exW"/>
@@ -111,10 +117,12 @@
<constraint firstAttribute="centerY" secondItem="pjK-Zp-UbQ" secondAttribute="centerY" id="9s8-qH-i1P"/>
<constraint firstItem="pjK-Zp-UbQ" firstAttribute="height" secondItem="mCe-MJ-dGn" secondAttribute="height" id="JIc-fT-UjL"/>
<constraint firstAttribute="centerY" secondItem="p7K-BU-wrj" secondAttribute="centerY" constant="244" id="JwD-6n-gDl"/>
<constraint firstItem="cRH-yo-5R5" firstAttribute="top" secondItem="p7K-BU-wrj" secondAttribute="bottom" constant="8" id="QNw-JV-8Hj"/>
<constraint firstAttribute="centerX" secondItem="pjK-Zp-UbQ" secondAttribute="centerX" id="SKh-dx-lMw"/>
<constraint firstAttribute="trailingMargin" secondItem="pjK-Zp-UbQ" secondAttribute="trailing" constant="-16" id="Wco-iZ-WK3"/>
<constraint firstItem="pjK-Zp-UbQ" firstAttribute="width" secondItem="mCe-MJ-dGn" secondAttribute="width" id="X4I-1D-UFn"/>
<constraint firstAttribute="height" secondItem="pjK-Zp-UbQ" secondAttribute="height" id="Xex-NE-7OZ"/>
<constraint firstAttribute="centerX" secondItem="cRH-yo-5R5" secondAttribute="centerX" id="dcA-rF-XxK"/>
<constraint firstItem="pjK-Zp-UbQ" firstAttribute="top" secondItem="jBK-Sp-EmM" secondAttribute="bottom" constant="-20" id="edj-sT-3H0"/>
<constraint firstItem="MVO-Fx-XzJ" firstAttribute="top" secondItem="pjK-Zp-UbQ" secondAttribute="bottom" id="fbb-mU-rbb"/>
<constraint firstItem="p7K-BU-wrj" firstAttribute="trailing" secondItem="mCe-MJ-dGn" secondAttribute="trailingMargin" id="jfw-jd-DBJ"/>
@@ -138,6 +146,9 @@
</variation>
</view>
<navigationItem key="navigationItem" id="lJo-8x-S3p"/>
<connections>
<outlet property="languageLabel" destination="cRH-yo-5R5" id="adV-Qt-4rt"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="hXP-CJ-uQp" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>

View File

@@ -1,12 +0,0 @@
/* Class = "IBUIButton"; normalTitle = "Customized"; ObjectID = "1cx-Uc-icC"; */
"1cx-Uc-icC.normalTitle" = "Customized";
/* Class = "IBUIButton"; normalTitle = "Store-Kit"; ObjectID = "5ex-RA-hKB"; */
"5ex-RA-hKB.normalTitle" = "Store-Kit";
/* Class = "IBUIButton"; normalTitle = "Standard"; ObjectID = "94v-di-Sgl"; */
"94v-di-Sgl.normalTitle" = "Standard";
/* Class = "IBUILabel"; text = "ARMCHAIR"; ObjectID = "XVe-fD-yl8"; */
"XVe-fD-yl8.text" = "ARMCHAIR";