tolk 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tolk/config.rb +5 -0
- data/lib/tolk/sync.rb +13 -2
- data/lib/tolk/version.rb +1 -1
- metadata +2 -3
- data/config/initializers/will_paginate.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 652a7535765ad75372d8a594b0d39004d3f92691
|
4
|
+
data.tar.gz: f2745145fe518451579ff1ae55677b46dff21fcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 401672278375a77cfbad76d816f1e24b9ba827fbcf88a18d8894adc6f3c1066e84530f02a378605d11df6ff34c9130887fd659beb9d3e959e38d70b513975778
|
7
|
+
data.tar.gz: ce3597ae438da2dcc106af94cc56aeb42855fbc16b2f2731de6094f46dd30271a7e8d69e95410d265da2c6f9f5395f0a0d38734d0f7120c91a9296e7afd846f4
|
data/lib/tolk/config.rb
CHANGED
@@ -17,9 +17,14 @@ module Tolk
|
|
17
17
|
# exclude locales tokens from gems
|
18
18
|
attr_accessor :exclude_gems_token
|
19
19
|
|
20
|
+
# reject files of type xxx.en.yml when syncing locales
|
21
|
+
attr_accessor :block_xxx_en_yml_locale_files
|
22
|
+
|
20
23
|
def reset
|
21
24
|
@exclude_gems_token = false
|
22
25
|
|
26
|
+
@block_xxx_en_yml_locale_files = true # keep compat with older versions
|
27
|
+
|
23
28
|
@dump_path = Proc.new { "#{Rails.application.root}/config/locales" }
|
24
29
|
|
25
30
|
@mapping = {
|
data/lib/tolk/sync.rb
CHANGED
@@ -14,9 +14,20 @@ module Tolk
|
|
14
14
|
# bypass default init_translations
|
15
15
|
I18n.backend.reload! if I18n.backend.initialized?
|
16
16
|
I18n.backend.instance_variable_set(:@initialized, true)
|
17
|
-
|
17
|
+
translations_files = Dir[Rails.root.join('config', 'locales', "*.{rb,yml}")]
|
18
|
+
|
19
|
+
if Tolk.config.block_xxx_en_yml_locale_files
|
20
|
+
locale_block_filter = Proc.new {
|
21
|
+
|l| ['.', '..'].include?(l) ||
|
22
|
+
!l.ends_with?('.yml') ||
|
23
|
+
l.match(/(.*\.){2,}/) # reject files of type xxx.en.yml
|
24
|
+
}
|
25
|
+
translations_files = translations_files.reject(&locale_block_filter)
|
26
|
+
end
|
27
|
+
|
28
|
+
I18n.backend.load_translations(translations_files)
|
18
29
|
else
|
19
|
-
I18n.backend.send :init_translations unless I18n.backend.initialized? # force load
|
30
|
+
I18n.backend.send :init_translations unless I18n.backend.initialized? # force load
|
20
31
|
end
|
21
32
|
translations = flat_hash(I18n.backend.send(:translations)[primary_locale.name.to_sym])
|
22
33
|
filter_out_i18n_keys(translations.merge(read_primary_locale_file))
|
data/lib/tolk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tolk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -149,7 +149,6 @@ files:
|
|
149
149
|
- app/views/tolk/locales/show.html.erb
|
150
150
|
- app/views/tolk/searches/_form.html.erb
|
151
151
|
- app/views/tolk/searches/show.html.erb
|
152
|
-
- config/initializers/will_paginate.rb
|
153
152
|
- config/routes.rb
|
154
153
|
- lib/generators/tolk/install_generator.rb
|
155
154
|
- lib/generators/tolk/templates/initializer.erb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
if defined?(WillPaginate)
|
2
|
-
ActiveSupport.on_load :active_record do
|
3
|
-
module WillPaginate
|
4
|
-
module ActiveRecord
|
5
|
-
module RelationMethods
|
6
|
-
def per(value = nil) per_page(value) end
|
7
|
-
def total_count() count end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
module CollectionMethods
|
11
|
-
alias_method :num_pages, :total_pages
|
12
|
-
end
|
13
|
-
module PerPage
|
14
|
-
def paginates_per(value) self.per_page=(value) end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|