localio 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/localio/templates/android_localizable.erb +1 -1
- data/lib/localio/templates/ios_constant_localizable.erb +1 -1
- data/lib/localio/templates/ios_localizable.erb +1 -1
- data/lib/localio/templates/java_properties_localizable.erb +1 -1
- data/lib/localio/templates/json_localizable.erb +0 -1
- data/lib/localio/templates/rails_localizable.erb +1 -1
- data/lib/localio/templates/swift_constant_localizable.erb +1 -1
- data/lib/localio/version.rb +1 -1
- data/lib/localio/writers/ios_writer.rb +6 -3
- data/lib/localio/writers/swift_writer.rb +4 -3
- data/lib/localio.rb +2 -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: da16d143023030b2058abab91688e0fbadbafe27
|
4
|
+
data.tar.gz: 027b433450bdecd21c28633534e4876fb2ba9826
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4e2fa7597976ee4231c92fcb0c3aaa707f6762c9143a7fa3431abe456bed144765fa27dbf709c72f8b4797407839ef72a1b926999e5aa63b44b52e7cc5032f7
|
7
|
+
data.tar.gz: 43d40cef7a0e7894d4f99e8019c95c4f8d2347bb1fe49d4f5d6dc437b84fdd4623391af37c32053508c1185569f9622fe36fa7e892058ffdb2cedf321a845587
|
data/README.md
CHANGED
@@ -77,6 +77,19 @@ Option | Description
|
|
77
77
|
* `:json` for an easy JSON format for localizables. The `output_path` is yours to decide :)
|
78
78
|
* `:java_properties` for .properties files used mainly in Java. Files named language_(lang).properties will be generated in `output_path`'s root directory.
|
79
79
|
|
80
|
+
#### Extra platform parameters
|
81
|
+
|
82
|
+
##### iOS (:ios, :swift)
|
83
|
+
|
84
|
+
In iOS we can opt-out from the constants/macros. We will simple need to add :create_constants => false.
|
85
|
+
|
86
|
+
Example:
|
87
|
+
|
88
|
+
````ruby
|
89
|
+
platform :ios, :create_constants => false
|
90
|
+
# ... rest of your Locfile ...
|
91
|
+
````
|
92
|
+
|
80
93
|
#### Supported sources
|
81
94
|
|
82
95
|
##### Google Drive
|
data/lib/localio/version.rb
CHANGED
@@ -6,6 +6,7 @@ require 'localio/formatter'
|
|
6
6
|
class IosWriter
|
7
7
|
def self.write(languages, terms, path, formatter, options)
|
8
8
|
puts 'Writing iOS translations...'
|
9
|
+
create_constants = options[:create_constants].nil? ? true : options[:create_constants]
|
9
10
|
|
10
11
|
constant_segments = nil
|
11
12
|
languages.keys.each do |lang|
|
@@ -34,10 +35,11 @@ class IosWriter
|
|
34
35
|
puts " > #{lang.yellow}"
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
+
if create_constants && !constant_segments.nil?
|
38
39
|
TemplateHandler.process_template 'ios_constant_localizable.erb', path, 'LocalizableConstants.h', constant_segments
|
39
40
|
puts ' > ' + 'LocalizableConstants.h'.yellow
|
40
41
|
end
|
42
|
+
|
41
43
|
end
|
42
44
|
|
43
45
|
private
|
@@ -45,8 +47,9 @@ class IosWriter
|
|
45
47
|
def self.ios_key_formatter(key)
|
46
48
|
'_'+key.space_to_underscore.strip_tag.capitalize
|
47
49
|
end
|
48
|
-
|
50
|
+
|
49
51
|
def self.ios_constant_formatter(key)
|
50
|
-
'kLocale'+key.space_to_underscore.strip_tag.camel_case
|
52
|
+
'kLocale'+key.space_to_underscore.strip_tag.camel_case
|
51
53
|
end
|
54
|
+
|
52
55
|
end
|
@@ -6,6 +6,7 @@ require 'localio/formatter'
|
|
6
6
|
class SwiftWriter
|
7
7
|
def self.write(languages, terms, path, formatter, options)
|
8
8
|
puts 'Writing iOS translations...'
|
9
|
+
create_constants = options[:create_constants].nil? ? true : options[:create_constants]
|
9
10
|
|
10
11
|
constant_segments = nil
|
11
12
|
languages.keys.each do |lang|
|
@@ -34,7 +35,7 @@ class SwiftWriter
|
|
34
35
|
puts " > #{lang.yellow}"
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
+
if create_constants && !constant_segments.nil?
|
38
39
|
TemplateHandler.process_template 'swift_constant_localizable.erb', path, 'LocalizableConstants.swift', constant_segments
|
39
40
|
puts ' > ' + 'LocalizableConstants.swift'.yellow
|
40
41
|
end
|
@@ -45,8 +46,8 @@ class SwiftWriter
|
|
45
46
|
def self.swift_key_formatter(key)
|
46
47
|
'_'+key.space_to_underscore.strip_tag.capitalize
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def self.swift_constant_formatter(key)
|
50
|
-
'kLocale'+key.space_to_underscore.strip_tag.camel_case
|
51
|
+
'kLocale'+key.space_to_underscore.strip_tag.camel_case
|
51
52
|
end
|
52
53
|
end
|
data/lib/localio.rb
CHANGED
@@ -49,12 +49,13 @@ module Localio
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def self.build_localizables
|
52
|
+
@configuration.platform_options[:default_language] = @localizables[:default_language]
|
52
53
|
LocalizableWriter.write @configuration.platform_name,
|
53
54
|
@localizables[:languages],
|
54
55
|
@localizables[:segments],
|
55
56
|
@configuration.output_path,
|
56
57
|
@configuration.formatting,
|
57
|
-
|
58
|
+
@configuration.platform_options
|
58
59
|
puts 'Done!'.green
|
59
60
|
end
|
60
61
|
|