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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a621000f302fd01a07574c3110c028601132dbd
4
- data.tar.gz: 8fed6ed61584487c090385083fa38f804876fa8a
3
+ metadata.gz: 652a7535765ad75372d8a594b0d39004d3f92691
4
+ data.tar.gz: f2745145fe518451579ff1ae55677b46dff21fcf
5
5
  SHA512:
6
- metadata.gz: fc1db991d2afc7b6cc64d5fcfbfb61032b9d9d1cf4e3179fc9f2ea1c71ec72a65f28b4438716ae5bd330688f062040c332feb04b802fdd136f78cfde18637444
7
- data.tar.gz: 0440b91e0dd044fd119d2608c0a8a10d3a5bbb375fbd1e4641b3a48f0ed4bd924c4df381fa8c41300750a1427e5f1ec0f1f74d8a98e401cc4ae32f4f4c6f9676
6
+ metadata.gz: 401672278375a77cfbad76d816f1e24b9ba827fbcf88a18d8894adc6f3c1066e84530f02a378605d11df6ff34c9130887fd659beb9d3e959e38d70b513975778
7
+ data.tar.gz: ce3597ae438da2dcc106af94cc56aeb42855fbc16b2f2731de6094f46dd30271a7e8d69e95410d265da2c6f9f5395f0a0d38734d0f7120c91a9296e7afd846f4
@@ -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 = {
@@ -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
- I18n.backend.load_translations(Dir[Rails.root.join('config', 'locales', "*.{rb,yml}")])
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))
@@ -1,3 +1,3 @@
1
1
  module Tolk
2
- VERSION = "1.8.1"
2
+ VERSION = "1.9.0"
3
3
  end
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.8.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-05-04 00:00:00.000000000 Z
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