localio 0.0.21 → 0.0.22

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: 0c6e41796010a2c10291bc7c0886965dd36be6ec
4
- data.tar.gz: e97e962ec3a19ce40cee4c0be5c58e435ef1ec8f
3
+ metadata.gz: da16d143023030b2058abab91688e0fbadbafe27
4
+ data.tar.gz: 027b433450bdecd21c28633534e4876fb2ba9826
5
5
  SHA512:
6
- metadata.gz: 8adc4c750fc5d9fcac475b0d628c48ebf9e0da0c5b41c1c83239f675086e6111d320e44f2a3d6f8303addf6a986cdd4b56fd50219bb70bb1849924b764b881ef
7
- data.tar.gz: 918ceae2d4a431bf1d1ab1ec85f0a0df5a8915006fbf85bf53cad4180c0b11d4899001be13f535aa5407c3431b913060a9b9714ae98e46bb0413794ad70a7953
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
@@ -1,4 +1,4 @@
1
- <!-- Localizable created with localio on (<%= Time.now.localtime %>). DO NOT MODIFY. -->
1
+ <!-- Localizable created with localio. DO NOT MODIFY. -->
2
2
  <resources>
3
3
  <%
4
4
  @segments.each do |term|
@@ -3,7 +3,7 @@ LocalizableConstants.h
3
3
 
4
4
  GENERATED - DO NOT MODIFY - use localio instead.
5
5
 
6
- Created by localio on <%= Time.now.localtime %>.
6
+ Created by localio.
7
7
  */
8
8
 
9
9
  <% @segments.each do |term| %>
@@ -3,7 +3,7 @@ Localizable.strings
3
3
 
4
4
  GENERATED - DO NOT MODIFY - use the localio gem instead.
5
5
 
6
- Created by localio on <%= Time.now.localtime %>.
6
+ Created by localio.
7
7
  */
8
8
 
9
9
  <% @segments.each do |term| %>
@@ -1,4 +1,4 @@
1
- # Localizable created with localio on (<%= Time.now.localtime %>). DO NOT MODIFY.
1
+ # Localizable created with localio. DO NOT MODIFY.
2
2
  #
3
3
  # Language: <%= @language %>
4
4
  <% @segments.each do |term|
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "meta" : {
3
3
  "info": "Localizable created with localio. DO NOT MODIFY.",
4
- "last_modification": "<%= Time.now.localtime %>",
5
4
  "language": "<%= @language %>"
6
5
  },
7
6
  "translations": {
@@ -1,4 +1,4 @@
1
- # Localizable created with localio on (<%= Time.now.localtime %>). DO NOT MODIFY.
1
+ # Localizable created with localio. DO NOT MODIFY.
2
2
  #
3
3
  # Language: <%= @language %>
4
4
 
@@ -3,7 +3,7 @@ LocalizableConstants.swift
3
3
 
4
4
  GENERATED - DO NOT MODIFY - use localio instead.
5
5
 
6
- Created by localio on <%= Time.now.localtime %>.
6
+ Created by localio
7
7
  */
8
8
 
9
9
  <% @segments.each do |term| %>
@@ -1,3 +1,3 @@
1
1
  module Localio
2
- VERSION = "0.0.21"
2
+ VERSION = "0.0.22"
3
3
  end
@@ -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
- unless constant_segments.nil?
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
- unless constant_segments.nil?
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
- :default_language => @localizables[:default_language]
58
+ @configuration.platform_options
58
59
  puts 'Done!'.green
59
60
  end
60
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nacho Lopez