xcmultilingual 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d902db51daac9d760ac81be7fabcd3c062b52a01
4
- data.tar.gz: 96a0db28af23dbd9ff7d9f6bda5735e84501f965
3
+ metadata.gz: a2372792beae3590ed2ee82791da95304e301d83
4
+ data.tar.gz: f5f63f39c161ca04ccd4e66f41dd5f0dbbb3e361
5
5
  SHA512:
6
- metadata.gz: 9af0edd430e9a40bdbe670056d34ef412794b02d458ba2bae2410838b9e28bbd1a138945b137cd2f7d6be2e17ab9d9807d55711f0bd03197b576a10ac14bcbca
7
- data.tar.gz: a9b15493efa486210c7ab99bbc06406d28057b76a714c201d9450d2b6c06fea35bba027e473c36a5ad4d28f709bd47f165c299c859900cf74d85a3b6e1be2ce3
6
+ metadata.gz: d201551fca3884726658b60aa59c9af4c8ca185a2318a7cd57ec182f378dc930527d7c76f624e52b8118f27288200204cacad34354766f4786456d4fa5cf8287
7
+ data.tar.gz: 1cc824397daa7760e649b6fd771383d7f99cc85e4321fce166b24be4baf9dba34720166b8c9cb10ef21b5fcd3d9b42842998dcbba492e709976c0f3bc178caaf
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.3.0 Release Notes 2015-7-25
4
+
5
+ - **Breaking change:** Translated value is now not from `string()` function but just `value` computed property in swift template.
@@ -24,7 +24,7 @@ struct Multilingual {
24
24
  case GORILLA = "GORILLA"
25
25
  case MONKEY = "MONKEY"
26
26
 
27
- func string() -> String {
27
+ var value: String {
28
28
  return NSLocalizedString(rawValue, tableName: Animal.name, bundle: NSBundle.mainBundle(), value: rawValue, comment: "")
29
29
  }
30
30
 
@@ -35,7 +35,7 @@ struct Multilingual {
35
35
  }
36
36
 
37
37
  static var localizations: [String] {
38
- return Animal.keys.map { Animal(rawValue: $0)!.string() }
38
+ return Animal.keys.map { Animal(rawValue: $0)!.value }
39
39
  }
40
40
  }
41
41
 
@@ -44,7 +44,7 @@ struct Multilingual {
44
44
  case GOODMORNING = "GOODMORNING"
45
45
  case GOODEVENING = "GOODEVENING"
46
46
 
47
- func string() -> String {
47
+ var value: String {
48
48
  return NSLocalizedString(rawValue, tableName: Localizable.name, bundle: NSBundle.mainBundle(), value: rawValue, comment: "")
49
49
  }
50
50
 
@@ -55,14 +55,14 @@ struct Multilingual {
55
55
  }
56
56
 
57
57
  static var localizations: [String] {
58
- return Localizable.keys.map { Localizable(rawValue: $0)!.string() }
58
+ return Localizable.keys.map { Localizable(rawValue: $0)!.value }
59
59
  }
60
60
  }
61
61
 
62
62
  enum Sample2Sample_Localization: String {
63
63
  case SAMPLE_2 = "SAMPLE 2"
64
64
 
65
- func string() -> String {
65
+ var value: String {
66
66
  return NSLocalizedString(rawValue, tableName: Sample2Sample_Localization.name, bundle: Multilingual.bundle("Loalizations/sample2.bundle"), value: rawValue, comment: "")
67
67
  }
68
68
 
@@ -73,14 +73,14 @@ struct Multilingual {
73
73
  }
74
74
 
75
75
  static var localizations: [String] {
76
- return Sample2Sample_Localization.keys.map { Sample2Sample_Localization(rawValue: $0)!.string() }
76
+ return Sample2Sample_Localization.keys.map { Sample2Sample_Localization(rawValue: $0)!.value }
77
77
  }
78
78
  }
79
79
 
80
80
  enum SampleSample: String {
81
81
  case SAMPLE = "SAMPLE"
82
82
 
83
- func string() -> String {
83
+ var value: String {
84
84
  return NSLocalizedString(rawValue, tableName: SampleSample.name, bundle: Multilingual.bundle("sample.bundle"), value: rawValue, comment: "")
85
85
  }
86
86
 
@@ -91,7 +91,7 @@ struct Multilingual {
91
91
  }
92
92
 
93
93
  static var localizations: [String] {
94
- return SampleSample.keys.map { SampleSample(rawValue: $0)!.string() }
94
+ return SampleSample.keys.map { SampleSample(rawValue: $0)!.value }
95
95
  }
96
96
  }
97
97
 
@@ -43,6 +43,12 @@ class ViewController: UITableViewController {
43
43
  localizations: Multilingual.Sample2Sample_Localization.localizations
44
44
  )
45
45
  ]
46
+
47
+ override func viewDidLoad() {
48
+ super.viewDidLoad()
49
+
50
+ println("\(Multilingual.Localizable.GOODMORNING.value)")
51
+ }
46
52
  }
47
53
 
48
54
  // MARK: UITableVIewDataSource
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xcmultilingual (0.2.3)
4
+ xcmultilingual (0.3.0)
5
5
  thor
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # xcmultilingual
2
2
 
3
- Command line tool for Swift localizations: It parses localization files in the project and output swift file including functions with pretty complementations!
3
+ Command line tool for Swift localizations: It parses localization files in the project and generate swift file including functions with neat complementations!
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/xcmultilingual.svg)](http://badge.fury.io/rb/xcmultilingual) [![Join the chat at https://gitter.im/morizotter/xcmultilingual](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/morizotter/xcmultilingual?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
6
 
@@ -74,7 +74,7 @@ struct Multilingual {
74
74
  case GORILLA = "GORILLA"
75
75
  case MONKEY = "MONKEY"
76
76
 
77
- func string() -> String {
77
+ var value: String {
78
78
  return NSLocalizedString(rawValue, tableName: Animal.name, bundle: NSBundle.mainBundle(), value: rawValue, comment: "")
79
79
  }
80
80
 
@@ -85,14 +85,34 @@ struct Multilingual {
85
85
  }
86
86
 
87
87
  static var localizations: [String] {
88
- return Animal.keys.map { Animal(rawValue: $0)!.string() }
88
+ return Animal.keys.map { Animal(rawValue: $0)!.value }
89
+ }
90
+ }
91
+
92
+ enum Localizable: String {
93
+ case HELLO = "HELLO"
94
+ case GOODMORNING = "GOODMORNING"
95
+ case GOODEVENING = "GOODEVENING"
96
+
97
+ var value: String {
98
+ return NSLocalizedString(rawValue, tableName: Localizable.name, bundle: NSBundle.mainBundle(), value: rawValue, comment: "")
99
+ }
100
+
101
+ static let name = "Localizable"
102
+
103
+ static var keys: [String] {
104
+ return ["HELLO", "GOODMORNING", "GOODEVENING"]
105
+ }
106
+
107
+ static var localizations: [String] {
108
+ return Localizable.keys.map { Localizable(rawValue: $0)!.value }
89
109
  }
90
110
  }
91
111
 
92
112
  enum SampleSample: String {
93
113
  case SAMPLE = "SAMPLE"
94
114
 
95
- func string() -> String {
115
+ var value: String {
96
116
  return NSLocalizedString(rawValue, tableName: SampleSample.name, bundle: Multilingual.bundle("sample.bundle"), value: rawValue, comment: "")
97
117
  }
98
118
 
@@ -103,7 +123,7 @@ struct Multilingual {
103
123
  }
104
124
 
105
125
  static var localizations: [String] {
106
- return SampleSample.keys.map { SampleSample(rawValue: $0)!.string() }
126
+ return SampleSample.keys.map { SampleSample(rawValue: $0)!.value }
107
127
  }
108
128
  }
109
129
 
@@ -142,7 +162,7 @@ Awesome!
142
162
  And print localized string is:
143
163
 
144
164
  ```swift
145
- Multilingual.Animal.DOG.string()
165
+ Multilingual.Animal.DOG.value
146
166
  ```
147
167
 
148
168
  Easy!
@@ -158,20 +178,20 @@ options:
158
178
 
159
179
  **help:** Write `update` after help and show update options' help.
160
180
 
161
- If you want to use `LOC` for top level struct name. `xcmultilingual update ./DemoApp/Multilingual.swift -n LOC` and then you can write like `LOC.Animal.DOG.string()`
181
+ If you want to use `LOC` for top level struct name. `xcmultilingual update ./DemoApp/Multilingual.swift -n LOC` and then you can write like `LOC.Animal.DOG.value`
162
182
 
163
183
  ## Swift functions
164
184
 
165
185
  `Multilingual` is swift struct. Localization tables are represented as enum in this struct.
166
186
 
167
- Each enum has `string()` instance function and Table `name`, `keys` and `localizations` static computed properties.
187
+ Each enum has `value` instance computed property and Table `name`, `keys` and `localizations` static computed properties.
168
188
 
169
189
  Example:
170
190
 
171
191
  When you want to use Animal table's DOG key localization.
172
192
 
173
193
  ```swift
174
- Multilingual.Animal.DOG.string() // Dog
194
+ Multilingual.Animal.DOG.value // Dog
175
195
  ```
176
196
 
177
197
  When you want to show every localizations in test.
@@ -19,7 +19,7 @@ struct <%= @name %> {
19
19
  case <%= key.safe %> = "<%= key %>"
20
20
  <% end # keys -%>
21
21
 
22
- func string() -> String {
22
+ var value: String {
23
23
  return NSLocalizedString(rawValue, tableName: <%= class_name %>.name, bundle: <%= nsbundle %>, value: rawValue, comment: "")
24
24
  }
25
25
 
@@ -30,7 +30,7 @@ struct <%= @name %> {
30
30
  }
31
31
 
32
32
  static var localizations: [String] {
33
- return <%= class_name %>.keys.map { <%= class_name %>(rawValue: $0)!.string() }
33
+ return <%= class_name %>.keys.map { <%= class_name %>(rawValue: $0)!.value }
34
34
  }
35
35
  }
36
36
 
@@ -1,3 +1,3 @@
1
1
  module Xcmultilingual
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Naoki Morita"]
10
10
  spec.email = ["namorit@gmail.com"]
11
11
 
12
- spec.summary = "Command line tool for Swift localizations: It parses localization files in project and output swift file including functions with pretty good complementations"
13
- spec.description = "Command line tool for Swift localizations: It parses localization files in the project and output swift file including functions with pretty good complementations!"
12
+ spec.summary = "Command line tool for Swift localizations: It parses localization files in project and output swift file including functions with neat complementations"
13
+ spec.description = "Command line tool for Swift localizations: It parses localization files in the project and generate swift file including functions with pretty good complementations!"
14
14
  spec.homepage = "https://github.com/morizotter/xcmultilingual"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcmultilingual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoki Morita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-15 00:00:00.000000000 Z
11
+ date: 2015-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: 'Command line tool for Swift localizations: It parses localization files
70
- in the project and output swift file including functions with pretty good complementations!'
70
+ in the project and generate swift file including functions with pretty good complementations!'
71
71
  email:
72
72
  - namorit@gmail.com
73
73
  executables:
@@ -78,6 +78,7 @@ files:
78
78
  - ".gitignore"
79
79
  - ".rspec"
80
80
  - ".travis.yml"
81
+ - CHANGELOG.md
81
82
  - CODE_OF_CONDUCT.md
82
83
  - DemoApp/.gitignore
83
84
  - DemoApp/DemoApp.xcodeproj/project.pbxproj
@@ -175,5 +176,5 @@ rubygems_version: 2.4.8
175
176
  signing_key:
176
177
  specification_version: 4
177
178
  summary: 'Command line tool for Swift localizations: It parses localization files
178
- in project and output swift file including functions with pretty good complementations'
179
+ in project and output swift file including functions with neat complementations'
179
180
  test_files: []