xcmultilingual 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da9fbf5ba45832c00e8cee478c30c1e7f56059c9
4
- data.tar.gz: d4fa56b66ea906b632dbdaa94573daa1d576e85e
3
+ metadata.gz: c740fe53b868e8b088e5f3be7854ff15ff144679
4
+ data.tar.gz: fd89d0c23589a17a8f44917299b062840bbd782e
5
5
  SHA512:
6
- metadata.gz: d2a5c99476070187fadce16261b3e96901ef50dd65da776444035293b4c5a1ac90a8763ba40b04081b7bf96c24dc5d8b03bad1c9f8bf92cb3b7a695f87ffaf10
7
- data.tar.gz: 6611c99675c2c1e0cce6f7722f432ab51555bfbc33642bd20bd2d60d74d74468f0796c371b1667be07a0f60b68090d84afd8b1ff4947cb917dece78a4ca15020
6
+ metadata.gz: c75caeba0f44b5afff01d3ed588eea5974733322d8bf621adb2fa57a1d5a703f4ab550bc2770285686bc55b91e0ead0170754012bc8700ae132caec37700510a
7
+ data.tar.gz: 2970f4f3870ebbc637c1ccc364a945fe349158d35601abe8d3e8e832b344f29e617e2b89ef530e9f8ce6f28376d6db7d5d82891c551766ace16ebd398263fcf4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xcmultilingual (0.2.0)
4
+ xcmultilingual (0.2.1)
5
5
  thor
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -78,30 +78,30 @@ struct Multilingual {
78
78
  return NSLocalizedString(rawValue, tableName: "Animal", bundle: NSBundle.mainBundle(), value: "\(rawValue)", comment: "")
79
79
  }
80
80
 
81
- static func keys() -> [String] {
81
+ static let name = "Animal"
82
+
83
+ static var keys: [String] {
82
84
  return ["CAT", "DOG", "BEAR", "DEER", "SQUIRREL", "ELEPHANT", "GIRAFFE", "TIGER", "LION", "RABBIT", "RHINOCEROS", "GORILLA", "MONKEY"]
83
85
  }
84
-
85
- static func localizations() -> [String] {
86
- return Animal.keys().map { Animal(rawValue: $0)!.string() }
86
+ static var localizations: [String] {
87
+ return Animal.keys.map { Animal(rawValue: $0)!.string() }
87
88
  }
88
89
  }
89
90
 
90
- enum Localizable: String {
91
- case HELLO = "HELLO"
92
- case GOODMORNING = "GOODMORNING"
93
- case GOODEVENING = "GOODEVENING"
91
+ enum SampleSample: String {
92
+ case SAMPLE = "SAMPLE"
94
93
 
95
94
  func string() -> String {
96
- return NSLocalizedString(rawValue, tableName: "Localizable", bundle: NSBundle.mainBundle(), value: "\(rawValue)", comment: "")
95
+ return NSLocalizedString(rawValue, tableName: "Sample", bundle: Multilingual.bundle("sample.bundle"), value: "\(rawValue)", comment: "")
97
96
  }
98
97
 
99
- static func keys() -> [String] {
100
- return ["HELLO", "GOODMORNING", "GOODEVENING"]
101
- }
98
+ static let name = "Sample"
102
99
 
103
- static func localizations() -> [String] {
104
- return Localizable.keys().map { Localizable(rawValue: $0)!.string() }
100
+ static var keys: [String] {
101
+ return ["SAMPLE"]
102
+ }
103
+ static var localizations: [String] {
104
+ return SampleSample.keys.map { SampleSample(rawValue: $0)!.string() }
105
105
  }
106
106
  }
107
107
 
@@ -161,7 +161,7 @@ If you want to use `LOC` for top level struct name. `xcmultilingual update ./Dem
161
161
 
162
162
  `Multilingual` is swift struct. Localization tables are represented as enum in this struct.
163
163
 
164
- Each enum has `Table name` and `string()` instance function and `keys()` and `localizations()` static functions.
164
+ Each enum has `string()` instance function and Table `name`, `keys` and `localizations` static computed properties.
165
165
 
166
166
  Example:
167
167
 
@@ -177,6 +177,8 @@ When you want to show every localizations in test.
177
177
  Multilingual.Animal.localizations() // ["Cat", "Dog", "Bear", "Dear"]
178
178
  ```
179
179
 
180
+
181
+
180
182
  ## Contributing
181
183
 
182
184
  Bug reports and pull requests are welcome on GitHub at https://github.com/morizotter/xcmultilingual. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
@@ -28,6 +28,7 @@ struct <%= @name %> {
28
28
  static var keys: [String] {
29
29
  return ["<%= table.keys.join("\", \"") %>"]
30
30
  }
31
+
31
32
  static var localizations: [String] {
32
33
  return <%= class_name %>.keys.map { <%= class_name %>(rawValue: $0)!.string() }
33
34
  }
@@ -1,3 +1,3 @@
1
1
  module Xcmultilingual
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcmultilingual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoki Morita