Skip to content

Commit 07f1bbd

Browse files
committed
distinguish keys from values
1 parent 80c1974 commit 07f1bbd

File tree

21 files changed

+798
-0
lines changed

21 files changed

+798
-0
lines changed

bk1ch09p397localization2/Empty Window.xcodeproj/project.pbxproj

+389
Large diffs are not rendered by default.

bk1ch09p397localization2/Empty Window.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1300"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "8180474B1F2E5DF20096D446"
18+
BuildableName = "Empty Window.app"
19+
BlueprintName = "Empty Window"
20+
ReferencedContainer = "container:Empty Window.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
language = "fr"
38+
launchStyle = "0"
39+
useCustomWorkingDirectory = "NO"
40+
ignoresPersistentStateOnLaunch = "NO"
41+
debugDocumentVersioning = "YES"
42+
debugServiceExtension = "internal"
43+
allowLocationSimulation = "YES">
44+
<BuildableProductRunnable
45+
runnableDebuggingMode = "0">
46+
<BuildableReference
47+
BuildableIdentifier = "primary"
48+
BlueprintIdentifier = "8180474B1F2E5DF20096D446"
49+
BuildableName = "Empty Window.app"
50+
BlueprintName = "Empty Window"
51+
ReferencedContainer = "container:Empty Window.xcodeproj">
52+
</BuildableReference>
53+
</BuildableProductRunnable>
54+
</LaunchAction>
55+
<ProfileAction
56+
buildConfiguration = "Release"
57+
shouldUseLaunchSchemeArgsEnv = "YES"
58+
savedToolIdentifier = ""
59+
useCustomWorkingDirectory = "NO"
60+
debugDocumentVersioning = "YES">
61+
<BuildableProductRunnable
62+
runnableDebuggingMode = "0">
63+
<BuildableReference
64+
BuildableIdentifier = "primary"
65+
BlueprintIdentifier = "8180474B1F2E5DF20096D446"
66+
BuildableName = "Empty Window.app"
67+
BlueprintName = "Empty Window"
68+
ReferencedContainer = "container:Empty Window.xcodeproj">
69+
</BuildableReference>
70+
</BuildableProductRunnable>
71+
</ProfileAction>
72+
<AnalyzeAction
73+
buildConfiguration = "Debug">
74+
</AnalyzeAction>
75+
<ArchiveAction
76+
buildConfiguration = "Release"
77+
revealArchiveInOrganizer = "YES">
78+
</ArchiveAction>
79+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
import UIKit
3+
4+
@UIApplicationMain
5+
class AppDelegate: UIResponder, UIApplicationDelegate {
6+
7+
var window: UIWindow?
8+
9+
10+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
11+
// Override point for customization after application launch.
12+
return true
13+
}
14+
15+
16+
}
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "29x29",
16+
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "29x29",
21+
"scale" : "3x"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"size" : "40x40",
26+
"scale" : "2x"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"size" : "40x40",
31+
"scale" : "3x"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"size" : "60x60",
36+
"scale" : "2x"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"size" : "60x60",
41+
"scale" : "3x"
42+
},
43+
{
44+
"idiom" : "ipad",
45+
"size" : "20x20",
46+
"scale" : "1x"
47+
},
48+
{
49+
"idiom" : "ipad",
50+
"size" : "20x20",
51+
"scale" : "2x"
52+
},
53+
{
54+
"idiom" : "ipad",
55+
"size" : "29x29",
56+
"scale" : "1x"
57+
},
58+
{
59+
"idiom" : "ipad",
60+
"size" : "29x29",
61+
"scale" : "2x"
62+
},
63+
{
64+
"idiom" : "ipad",
65+
"size" : "40x40",
66+
"scale" : "1x"
67+
},
68+
{
69+
"idiom" : "ipad",
70+
"size" : "40x40",
71+
"scale" : "2x"
72+
},
73+
{
74+
"idiom" : "ipad",
75+
"size" : "76x76",
76+
"scale" : "1x"
77+
},
78+
{
79+
"idiom" : "ipad",
80+
"size" : "76x76",
81+
"scale" : "2x"
82+
},
83+
{
84+
"idiom" : "ipad",
85+
"size" : "83.5x83.5",
86+
"scale" : "2x"
87+
},
88+
{
89+
"idiom" : "ios-marketing",
90+
"size" : "1024x1024",
91+
"scale" : "1x"
92+
}
93+
],
94+
"info" : {
95+
"version" : 1,
96+
"author" : "xcode"
97+
}
98+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "180.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "1x",
11+
"locale" : "en"
12+
},
13+
{
14+
"locale" : "fr",
15+
"idiom" : "universal",
16+
"filename" : "180_fr.png",
17+
"scale" : "1x"
18+
},
19+
{
20+
"idiom" : "universal",
21+
"scale" : "2x"
22+
},
23+
{
24+
"idiom" : "universal",
25+
"scale" : "2x",
26+
"locale" : "en"
27+
},
28+
{
29+
"idiom" : "universal",
30+
"scale" : "2x",
31+
"locale" : "fr"
32+
},
33+
{
34+
"idiom" : "universal",
35+
"scale" : "3x"
36+
},
37+
{
38+
"idiom" : "universal",
39+
"scale" : "3x",
40+
"locale" : "en"
41+
},
42+
{
43+
"idiom" : "universal",
44+
"scale" : "3x",
45+
"locale" : "fr"
46+
}
47+
],
48+
"info" : {
49+
"version" : 1,
50+
"author" : "xcode"
51+
},
52+
"properties" : {
53+
"localizable" : true
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="EHf-IW-A2E">
11+
<objects>
12+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+
<view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="YES" id="Ze5-6b-2t3">
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
17+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+
</view>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21+
</objects>
22+
<point key="canvasLocation" x="53" y="375"/>
23+
</scene>
24+
</scenes>
25+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
6+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
7+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8+
</dependencies>
9+
<scenes>
10+
<!--View Controller-->
11+
<scene sceneID="tne-QT-ifu">
12+
<objects>
13+
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Empty_Window" customModuleProvider="target" sceneMemberID="viewController">
14+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
15+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
16+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17+
<subviews>
18+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" fixedFrame="YES" image="LocalizableImage" translatesAutoresizingMaskIntoConstraints="NO" id="tWA-Vk-4PR">
19+
<rect key="frame" x="33" y="181" width="180" height="180"/>
20+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
21+
</imageView>
22+
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YMD-h7-RKH">
23+
<rect key="frame" x="33" y="84" width="95" height="30"/>
24+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
25+
<state key="normal" title="Greeting"/>
26+
<connections>
27+
<action selector="buttonPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="r42-fS-mRa"/>
28+
</connections>
29+
</button>
30+
</subviews>
31+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
32+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
33+
</view>
34+
</viewController>
35+
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
36+
</objects>
37+
<point key="canvasLocation" x="117.59999999999999" y="123.68815592203899"/>
38+
</scene>
39+
</scenes>
40+
<resources>
41+
<image name="LocalizableImage" width="180" height="180"/>
42+
</resources>
43+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict/>
5+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
3+
import UIKit
4+
5+
class ViewController: UIViewController {
6+
7+
// in the absence of a `key:` parameter,
8+
// I think the "right" way is to make the _key_ the text throughout the app
9+
// then explicitly localize for English, and then for other languages
10+
// in that way, the key can remain constant and we can change the English at will
11+
// and different keys can have the same English rendering
12+
13+
@IBAction func buttonPressed(_ sender: Any) {
14+
let greeting = String(
15+
localized: "InformalHello",
16+
comment: "Alert title: Say hello informally")
17+
let message = String(
18+
localized: "ReportTap",
19+
comment: "Alert message: Report a tap")
20+
let ok = String(
21+
localized: "OKButton",
22+
comment: "Alert button: accept and dismiss")
23+
let alert = UIAlertController(
24+
title: greeting,
25+
message: message,
26+
preferredStyle: .alert)
27+
alert.addAction(
28+
UIAlertAction(title: ok, style: .cancel))
29+
self.present(alert, animated: true)
30+
}
31+
32+
33+
34+
}
35+

0 commit comments

Comments
 (0)