Skip to content

Commit

Permalink
Merge pull request #119 from diogot/watch-cleanup
Browse files Browse the repository at this point in the history
Add localization to watch app
  • Loading branch information
diogot authored Apr 16, 2017
2 parents 18962c7 + 9e2d6b1 commit fdabf5e
Show file tree
Hide file tree
Showing 27 changed files with 327 additions and 115 deletions.
216 changes: 145 additions & 71 deletions MyWeight.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D92D390B1E904EC500D9E9ED"
BuildableName = "watch Dev.app"
BlueprintName = "watch Dev"
BuildableName = "Watch Dev.app"
BlueprintName = "Watch Dev"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -47,8 +47,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D92D390B1E904EC500D9E9ED"
BuildableName = "watch Dev.app"
BlueprintName = "watch Dev"
BuildableName = "Watch Dev.app"
BlueprintName = "Watch Dev"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -72,17 +72,17 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D92D390B1E904EC500D9E9ED"
BuildableName = "watch Dev.app"
BlueprintName = "watch Dev"
BuildableName = "Watch Dev.app"
BlueprintName = "Watch Dev"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D92D390B1E904EC500D9E9ED"
BuildableName = "watch Dev.app"
BlueprintName = "watch Dev"
BuildableName = "Watch Dev.app"
BlueprintName = "Watch Dev"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -102,17 +102,17 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D92D390B1E904EC500D9E9ED"
BuildableName = "watch Dev.app"
BlueprintName = "watch Dev"
BuildableName = "Watch Dev.app"
BlueprintName = "Watch Dev"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D92D390B1E904EC500D9E9ED"
BuildableName = "watch Dev.app"
BlueprintName = "watch Dev"
BuildableName = "Watch Dev.app"
BlueprintName = "Watch Dev"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D95050F71E7DE30B00519138"
BuildableName = "watch.app"
BlueprintName = "watch"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -61,8 +61,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D95050F71E7DE30B00519138"
BuildableName = "watch.app"
BlueprintName = "watch"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -86,17 +86,17 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D95050F71E7DE30B00519138"
BuildableName = "watch.app"
BlueprintName = "watch"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D95050F71E7DE30B00519138"
BuildableName = "watch.app"
BlueprintName = "watch"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -116,17 +116,17 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D95050F71E7DE30B00519138"
BuildableName = "watch.app"
BlueprintName = "watch"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D95050F71E7DE30B00519138"
BuildableName = "watch.app"
BlueprintName = "watch"
BuildableName = "Watch.app"
BlueprintName = "Watch"
ReferencedContainer = "container:MyWeight.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand Down
2 changes: 1 addition & 1 deletion MyWeight/Resources/Info-Dev.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>14</string>
<string>15</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion MyWeight/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>14</string>
<string>15</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion MyWeightTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>14</string>
<string>15</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion MyWeightUITests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>14</string>
<string>15</string>
</dict>
</plist>
3 changes: 2 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ target 'MyWeight' do
target 'MyWeightTests' do
inherit! :search_paths
inhibit_all_warnings!


pod 'SwiftGen', '4.2.0'
pod 'Nimble'
pod 'Quick'
pod 'Nimble-Snapshots'
Expand Down
5 changes: 4 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ PODS:
- Nimble
- Quick
- Quick (1.1.0)
- SwiftGen (4.2.0)

DEPENDENCIES:
- Nimble
- Nimble-Snapshots
- Quick
- SwiftGen (= 4.2.0)

SPEC CHECKSUMS:
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
Nimble: c53e6903fee94041b90ded74f135820437d8bf59
Nimble-Snapshots: e743439f26c2fa99d8f7e0d7c01c99bcb40aa6f2
Quick: dafc587e21eed9f4cab3249b9f9015b0b7a7f71d
SwiftGen: b6bfed151243348e4603b91bf5bc4eb2486c9d5b

PODFILE CHECKSUM: ad932de1c6912bdc47fa1b1fe1cdf61408ef13a6
PODFILE CHECKSUM: f8baec29b960d8c541f8f64121d88f9118ca81f0

COCOAPODS: 1.2.1
3 changes: 3 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ PROJECT_PATH = "#{BASE_PATH}/#{APP_NAME}.xcodeproj"
TEST_SCHEME = 'MyWeight'
ARCHIVE_SCHEME = 'MyWeight'

SWIFTGEN_PATH = 'Pods/SwiftGen/bin/swiftgen'
SWIFTGEN_STRINGS = { 'Watch Extension/Resources/en.lproj/Localizable.strings' => 'Watch Extension/Generated/L10n.swift' }.freeze

task default: [:help]
task :help do
sh 'rake -T'
Expand Down
72 changes: 72 additions & 0 deletions Watch Extension/Generated/L10n.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen

import Foundation

// swiftlint:disable file_length
// swiftlint:disable line_length

// swiftlint:disable type_body_length
// swiftlint:disable nesting
// swiftlint:disable variable_name
// swiftlint:disable valid_docs
// swiftlint:disable type_name

enum L10n {

enum Add {

enum Button {
/// Save
static let save = L10n.tr("add.button.save")
}
}

enum List {

enum Button {
/// Add
static let add = L10n.tr("list.button.add")
/// Done
static let done = L10n.tr("list.button.done")
}

enum Denied {
/// Access to Health data denied, you need to allow in Health App on your iPhone
static let text = L10n.tr("list.denied.text")
}

enum LastEntry {
/// Last Entry
static let text = L10n.tr("list.last_entry.text")
}

enum Loading {
/// Loading ...
static let text = L10n.tr("list.loading.text")
}

enum NoEntry {
/// No entry
static let text = L10n.tr("list.no_entry.text")
}

enum NotDetermined {
/// You need to authorize in your iPhone.
static let text = L10n.tr("list.not_determined.text")
}
}
}

extension L10n {
fileprivate static func tr(_ key: String, _ args: CVarArg...) -> String {
let format = NSLocalizedString(key, bundle: Bundle(for: BundleToken.self), comment: "")
return String(format: format, locale: Locale.current, arguments: args)
}
}

private final class BundleToken {}

// swiftlint:enable type_body_length
// swiftlint:enable nesting
// swiftlint:enable variable_name
// swiftlint:enable valid_docs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>watch Extension Dev</string>
<string>Watch Extension Dev</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<key>CFBundleVersion</key>
<string>14</string>
<string>15</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>watch Extension</string>
<string>Watch Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<key>CFBundleVersion</key>
<string>14</string>
<string>15</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
22 changes: 22 additions & 0 deletions Watch Extension/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Localizable.strings
MyWeight

Created by Diogo on 15/04/17.
Copyright © 2017 Diogo Tridapalli. All rights reserved. */

"list.button.add" = "Add";

"list.button.done" = "Done";

"list.last_entry.text" = "Last Entry";

"list.loading.text" = "Loading ...";

"list.no_entry.text" = "No entry";

"list.denied.text" = "Access to Health data denied, you need to allow in Health App on your iPhone";

"list.not_determined.text" = "You need to authorize in your iPhone.";

"add.button.save" = "Save";

7 changes: 7 additions & 0 deletions Watch Extension/Resources/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Localizable.strings
MyWeight

Created by Diogo on 15/04/17.
Copyright © 2017 Diogo Tridapalli. All rights reserved.
*/
22 changes: 22 additions & 0 deletions Watch Extension/Resources/pt-BR.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Localizable.strings
MyWeight

Created by Diogo on 15/04/17.
Copyright © 2017 Diogo Tridapalli. All rights reserved. */

"list.button.add" = "Adicionar";

"list.button.done" = "Pronto";

"list.last_entry.text" = "Última medida";

"list.loading.text" = "Carregando ...";

"list.no_entry.text" = "Sem medidas";

"list.denied.text" = "Acesso negado à suas medidas, você precisa ir ao App Saúde em seu iPhone para autorizar";

"list.not_determined.text" = "Você precisa autorizar no seu iPhone.";

"add.button.save" = "Salvar";

8 changes: 8 additions & 0 deletions rakelib/swiftgen.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

desc 'Generate strings'
task :swiftgen_strings do
SWIFTGEN_STRINGS.each do |strings, generated|
sh "#{SWIFTGEN_PATH} strings -template dot-syntax-swift3 --output '#{generated}' '#{strings}'"
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct AddInterfaceControllerViewModel {
let massFormatter: MeasurementFormatter

init() {
buttonText = "Save"
buttonText = L10n.Add.Button.save

massFormatter = MeasurementFormatter()
massFormatter.numberFormatter.minimumFractionDigits = 1
Expand Down
Loading

0 comments on commit fdabf5e

Please sign in to comment.