xcmultilingual 0.2.0 → 0.2.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +17 -15
- data/lib/xcmultilingual/templates/swift.erb +1 -0
- data/lib/xcmultilingual/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c740fe53b868e8b088e5f3be7854ff15ff144679
|
4
|
+
data.tar.gz: fd89d0c23589a17a8f44917299b062840bbd782e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75caeba0f44b5afff01d3ed588eea5974733322d8bf621adb2fa57a1d5a703f4ab550bc2770285686bc55b91e0ead0170754012bc8700ae132caec37700510a
|
7
|
+
data.tar.gz: 2970f4f3870ebbc637c1ccc364a945fe349158d35601abe8d3e8e832b344f29e617e2b89ef530e9f8ce6f28376d6db7d5d82891c551766ace16ebd398263fcf4
|
data/Gemfile.lock
CHANGED
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
|
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
|
-
|
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
|
91
|
-
case
|
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: "
|
95
|
+
return NSLocalizedString(rawValue, tableName: "Sample", bundle: Multilingual.bundle("sample.bundle"), value: "\(rawValue)", comment: "")
|
97
96
|
}
|
98
97
|
|
99
|
-
static
|
100
|
-
return ["HELLO", "GOODMORNING", "GOODEVENING"]
|
101
|
-
}
|
98
|
+
static let name = "Sample"
|
102
99
|
|
103
|
-
static
|
104
|
-
return
|
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 `
|
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.
|