i18n-translators-tools 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +53 -2
- data/i18n-translators-tools.gemspec +3 -1
- data/lib/i18n/processor/gettext.rb +1 -2
- data/lib/i18n/processor/properties.rb +2 -2
- data/lib/i18n/processor/ts.rb +1 -1
- data/lib/i18n/translate.rb +2 -2
- metadata +4 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0acd2b5fd463093d6ccb095c7a2e1e7d4c6ec46
|
4
|
+
data.tar.gz: b8776da042deab19368d2b2229ed99a0f816a40e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a30ad68ec6248fcdb233638382f0fb3cc2bd1152bb338d6aa636434c5fa49fd3fcefefeee1bfc75d87dab77cd53429f16a22dae438f657c3686521a4e8373bc5
|
7
|
+
data.tar.gz: 34cf8479d2071b94e9a95b3b8afefb9bcf811c96f1ae485fa45d6f03f8d40c5a1dc08621d621da657320ce290bc15533253d00c9f8a6fc683b49f9fe6327f3f6
|
data/README.md
CHANGED
@@ -115,13 +115,22 @@ Installation
|
|
115
115
|
|
116
116
|
gem install i18n-translators-tools
|
117
117
|
|
118
|
-
**Latest from sources
|
118
|
+
**Latest from sources**
|
119
119
|
|
120
120
|
git clone git://github.com/pejuko/i18n-translators-tools.git
|
121
121
|
cd i18n-translators-tools
|
122
122
|
rake gem
|
123
123
|
gem install pkg/i18n-translators-tools.gem
|
124
|
+
|
125
|
+
**Rails**
|
124
126
|
|
127
|
+
in `Gemfile` add
|
128
|
+
|
129
|
+
gem 'i18n-translators-tools'
|
130
|
+
|
131
|
+
then run
|
132
|
+
|
133
|
+
bundle install
|
125
134
|
|
126
135
|
How to add support into your application
|
127
136
|
----------------------------------------
|
@@ -165,6 +174,48 @@ It is hightly recommended to use Fallbacks backend together with
|
|
165
174
|
Translate. If you have experienced nil or empty translations due to
|
166
175
|
untranslated strings this can fix the problem.
|
167
176
|
|
177
|
+
**Rails**
|
178
|
+
|
179
|
+
Your `config/application.rb` should look like this
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
require File.expand_path('../boot', __FILE__)
|
183
|
+
|
184
|
+
require 'rails/all'
|
185
|
+
|
186
|
+
# Require the gems listed in Gemfile, including any gems
|
187
|
+
# you've limited to :test, :development, or :production.
|
188
|
+
Bundler.require(*Rails.groups)
|
189
|
+
|
190
|
+
I18n::Backend::Simple.send(:include, I18n::Backend::Translate)
|
191
|
+
I18n::Backend::Simple.send(:include, I18n::Backend::TS)
|
192
|
+
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
193
|
+
|
194
|
+
module MyApplication
|
195
|
+
class Application < Rails::Application
|
196
|
+
# Settings in config/environments/* take precedence over those specified here.
|
197
|
+
# Application configuration should go into files in config/initializers
|
198
|
+
# -- all .rb files in that directory are automatically loaded.
|
199
|
+
|
200
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
201
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
202
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
203
|
+
|
204
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
205
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
206
|
+
# config.i18n.default_locale = :de
|
207
|
+
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.yml').to_s]
|
208
|
+
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.ts').to_s]
|
209
|
+
config.i18n.default_locale = :en
|
210
|
+
|
211
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
212
|
+
config.active_record.raise_in_transactional_callbacks = true
|
213
|
+
end
|
214
|
+
end
|
215
|
+
```
|
216
|
+
|
217
|
+
This config file is adding support for TS files.
|
218
|
+
|
168
219
|
|
169
220
|
Examples
|
170
221
|
--------
|
@@ -305,7 +356,7 @@ handle them but Translate backend can.
|
|
305
356
|
|
306
357
|
|
307
358
|
Configure file format
|
308
|
-
|
359
|
+
---------------------
|
309
360
|
|
310
361
|
Configuration files are normal ruby files which should return hash.
|
311
362
|
It is not necessary to use all switches.
|
@@ -13,7 +13,7 @@ spec = Gem::Specification.new do |s|
|
|
13
13
|
s.email = "pejuko@gmail.com"
|
14
14
|
s.authors = ["Petr Kovar"]
|
15
15
|
s.name = 'i18n-translators-tools'
|
16
|
-
s.version = '0.2.
|
16
|
+
s.version = '0.2.8'
|
17
17
|
s.date = Time.now.strftime("%Y-%m-%d")
|
18
18
|
s.add_dependency('i18n', '>= 0.7.0')
|
19
19
|
s.add_dependency('ya2yaml')
|
@@ -21,6 +21,7 @@ spec = Gem::Specification.new do |s|
|
|
21
21
|
s.files = ["bin/i18n-translate", "README.md", "i18n-translators-tools.gemspec", "Rakefile"]
|
22
22
|
s.files += Dir["lib/**/*.rb", "test/**/*.{rb,yml,po}"]
|
23
23
|
s.executables = ["i18n-translate"]
|
24
|
+
=begin
|
24
25
|
s.post_install_message = <<EOF
|
25
26
|
=============================================================================
|
26
27
|
|
@@ -94,6 +95,7 @@ http://github.com/pejuko/i18n-translators-tools
|
|
94
95
|
|
95
96
|
=============================================================================
|
96
97
|
EOF
|
98
|
+
=end
|
97
99
|
s.description = <<EOF
|
98
100
|
This package brings you useful utility and library which can help you to handle
|
99
101
|
locale files and translations in your Ruby projects.
|
@@ -127,8 +127,7 @@ module I18n::Translate::Processor
|
|
127
127
|
entry = [""]
|
128
128
|
value = @translate.find(key, target)
|
129
129
|
next unless value
|
130
|
-
|
131
|
-
if value.kind_of?(String)
|
130
|
+
if value.kind_of?(String) || value.kind_of?(Array) || value.kind_of?(Integer)
|
132
131
|
# leave out msgctxt if using po strings as a key
|
133
132
|
default = @translate.find(key, @translate.default)
|
134
133
|
entry << %~msgctxt #{key.inspect}~ if key != default
|
data/lib/i18n/processor/ts.rb
CHANGED
@@ -85,7 +85,7 @@ EOF
|
|
85
85
|
value = @translate.find(key, target)
|
86
86
|
next unless value
|
87
87
|
|
88
|
-
if value.kind_of?(String)
|
88
|
+
if value.kind_of?(String) || value.kind_of?(Array) || value.kind_of?(Integer)
|
89
89
|
fuzzy = (value.to_s.empty?) ? %~ type="unfinished"~ : ""
|
90
90
|
xml += <<EOF
|
91
91
|
<context>
|
data/lib/i18n/translate.rb
CHANGED
@@ -90,7 +90,7 @@ module I18n::Translate
|
|
90
90
|
path = key.to_s.split(separator)
|
91
91
|
path.each do |key|
|
92
92
|
h = h[key]
|
93
|
-
return nil
|
93
|
+
return nil if h.nil?
|
94
94
|
end
|
95
95
|
h
|
96
96
|
end
|
@@ -247,7 +247,7 @@ module I18n::Translate
|
|
247
247
|
# }
|
248
248
|
def [](key)
|
249
249
|
d = I18n::Translate.find(key, @default, @options[:separator])
|
250
|
-
raise "Translate#[key]: wrong key '#{key}'"
|
250
|
+
raise "Translate#[key]: wrong key '#{key}'" if d.nil?
|
251
251
|
|
252
252
|
entry = {"key" => key, "default" => d}
|
253
253
|
if d.kind_of? Hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-translators-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petr Kovar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -99,78 +99,7 @@ files:
|
|
99
99
|
homepage: http://github.com/pejuko/i18n-translators-tools
|
100
100
|
licenses: []
|
101
101
|
metadata: {}
|
102
|
-
post_install_message:
|
103
|
-
=============================================================================
|
104
|
-
|
105
|
-
I18N TRANSLATORS TOOLS
|
106
|
-
|
107
|
-
-----------------------------------------------------------------------------
|
108
|
-
|
109
|
-
Supported formats:
|
110
|
-
* yml
|
111
|
-
* rb
|
112
|
-
* ts
|
113
|
-
* po
|
114
|
-
* properties
|
115
|
-
|
116
|
-
Backends:
|
117
|
-
* Extended format. i18n-translators-tools brings extended format
|
118
|
-
I18n::Backend::Simple.send(:include, I18n::Backend::Translate)
|
119
|
-
* Gettext po
|
120
|
-
I18n::Backend::Simple.send(:include, I18n::Backend::PO)
|
121
|
-
* QT Linguist TS
|
122
|
-
I18n::Backend::Simple.send(:include, I18n::Backend::TS)
|
123
|
-
* Java Properties files
|
124
|
-
I18n::Backend::Simple.send(:include, I18n::Backend::Properties)
|
125
|
-
|
126
|
-
Functions:
|
127
|
-
* merge
|
128
|
-
* convert
|
129
|
-
* translate (built-in simple console translator)
|
130
|
-
* statistics
|
131
|
-
|
132
|
-
Changelog:
|
133
|
-
v0.2.7
|
134
|
-
* fix reading .ts file
|
135
|
-
v0.2.6
|
136
|
-
* compatible with i18n 0.7.0
|
137
|
-
* make it works with rails 4.2
|
138
|
-
v0.2.5
|
139
|
-
* fix recursive directory scan (-r and --deep options should work now)
|
140
|
-
* enables usage require 'i18n-translators-tools'
|
141
|
-
|
142
|
-
v0.2.4
|
143
|
-
* enhanced support for java properties
|
144
|
-
* hard/soft merges. hard deletes deleted keys in target and soft set them to
|
145
|
-
obsolete
|
146
|
-
* processors now generate keys list from provided data and not from @tr.default
|
147
|
-
* flag obsolete added
|
148
|
-
* delete function
|
149
|
-
* i18n-0.5.0 compatibility
|
150
|
-
|
151
|
-
|
152
|
-
v0.2.3
|
153
|
-
* fix: hash_to_keys can work with enhanced format => default can be in
|
154
|
-
enhanced format
|
155
|
-
* default file can be now in enhanced format. if translation field is missing
|
156
|
-
in default file then field default is used instead
|
157
|
-
* i18n-translate <source file> <target file>
|
158
|
-
automaticlay perform convert action from one file to another
|
159
|
-
|
160
|
-
|
161
|
-
v0.2.2
|
162
|
-
* fix: don't merge if default file doesn't exist
|
163
|
-
* fix: for default format autodetection works again
|
164
|
-
* merge can be more verbose
|
165
|
-
|
166
|
-
|
167
|
-
For more information read README.md and CHANGELOG.md
|
168
|
-
|
169
|
-
-----------------------------------------------------------------------------
|
170
|
-
|
171
|
-
http://github.com/pejuko/i18n-translators-tools
|
172
|
-
|
173
|
-
=============================================================================
|
102
|
+
post_install_message:
|
174
103
|
rdoc_options: []
|
175
104
|
require_paths:
|
176
105
|
- lib
|
@@ -186,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
115
|
version: '0'
|
187
116
|
requirements: []
|
188
117
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.5.1
|
190
119
|
signing_key:
|
191
120
|
specification_version: 4
|
192
121
|
summary: I18n translation utility which helps to manage files with locales.
|