zlocalize 6.0.2.1 → 6.0.3

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
  SHA256:
3
- metadata.gz: f1d045086410b4219efddf96ff7165fffbf4d6f79f3c058d1b8a64a4a014d67e
4
- data.tar.gz: ddf36c917e025267baadf4d3dbdf4d47fcce6028d73f570170b1fe73c642060d
3
+ metadata.gz: 66b5522b6ea82798fe981eebf7d3dc4194244150004eb86b293db3fd8800978d
4
+ data.tar.gz: 281562dcdc5ca40e6618c60c4629856d152606b746fbaee0b53be84ef720f666
5
5
  SHA512:
6
- metadata.gz: 5def0cdcc38cb4711f069683a03cf75c63e4da9e18c0319790f20c80a2c497418679c619b550eb1843b8f476694e405f8f763a7e95acd7fa2a90f11f2b88d53c
7
- data.tar.gz: 9bb5d022d727b30904b4269575e9e3c7b566061cac95228015b9bfa3e82ef2671e267e1fd98e3606b5fb5ecbcd86415613f8f72333d6f024852be691d346f3ff
6
+ metadata.gz: 6be05d4c717b68ef0b2dd1babfc31e98e44e85f3e019418bc4e58852af9f99b3fe74dfa37d87d65b1a3c4ec66a628e23686e37cb6db1ed6d8cf51c5f5c492c20
7
+ data.tar.gz: 815138a1bea01dd2695ef521d841615a6e92c398f01bd7712c527ad8cc00a065f045166863ca81b7088f3bef395f5a713abefeb9c7e473e047a8ea4a3300ad07
@@ -15,7 +15,7 @@ module ZLocalize
15
15
 
16
16
  attr_accessor :rails_root
17
17
 
18
- DEFAULT_HARVEST_OPTIONS = { :output => 'config/locales/app-strings.yml',
18
+ DEFAULT_HARVEST_OPTIONS = { :output => 'config/translations/app-strings.yml',
19
19
  :overwrite_existing => false,
20
20
  :add_paths => [],
21
21
  :silent => false,
@@ -12,6 +12,7 @@ require 'rails/generators/base'
12
12
 
13
13
  def create_initializer_file
14
14
  template "initializer_template.rb", "config/initializers/zlocalize.rb"
15
+ FileUtils.mkdir_p "config/translations"
15
16
  end
16
17
 
17
18
  end
@@ -35,12 +35,12 @@ ZLocalize.config.return_source_on_missing = { development: false, test: false,
35
35
  ZLocalize.config.locales = {
36
36
  en: {
37
37
  plural_select: -> (n) { n <= 0 ? 0 : (n > 1 ? 2 : 1) },
38
- translations: File.join(Rails.root,'config/locales/en.strings.yml'),
38
+ translations: File.join(Rails.root,'config/translations/en.strings.yml'),
39
39
  convert_float: -> (s) { s.to_s.gsub(',','') }
40
40
  },
41
41
  # fr: {
42
42
  # plural_select: -> (n) { n <= 0 ? 0 : (n > 1 ? 2 : 1) },
43
- # translations: File.join(Rails.root,'config/locales/fr.strings.yml'),
43
+ # translations: File.join(Rails.root,'config/translations/fr.strings.yml'),
44
44
  # titleize: -> (s) { s.capitalize.to_s },
45
45
  # convert_float: -> (s) { s.to_s.gsub(' ','').gsub(',','.') }
46
46
  # }
@@ -5,7 +5,7 @@ namespace :zlocalize do
5
5
  desc "Collect all translatable strings (used in _('...') and n_('...') calls) in your Rails application\n\n" +
6
6
  "Usage: rake zlocalize:harvest\n" +
7
7
  "Options and their defaults are:\n\n" +
8
- " output=FILE_PATH Output file, relative to Rails.root (default: \'config/locales/app-strings.yml\')\n" +
8
+ " output=FILE_PATH Output file, relative to Rails.root (default: \'config/translations/app-strings.yml\')\n" +
9
9
  " purge=true|false Remove unused entries in the existing output file (if it exists). (default: false)\n" +
10
10
  " clear=true|false Clearing the existing translations in output file (if it exists). (default: false)\n" +
11
11
  " silent=true|false If true, do not report progress. (default: false)\n" +
@@ -14,7 +14,7 @@ namespace :zlocalize do
14
14
  task :harvest => :environment do
15
15
  options = { :clear => ['1','true'].include?(ENV['clear']),
16
16
  :purge => ['1','true'].include?(ENV['purge']),
17
- :output => ENV['output'].to_s.empty? ? 'config/locales/app-strings.yml' : ENV['output'],
17
+ :output => ENV['output'].to_s.empty? ? 'config/translations/app-strings.yml' : ENV['output'],
18
18
  :add_paths => ENV['add_paths'].to_s.empty? ? [] : ENV['add_paths'].split(','),
19
19
  :silent => ['1','true'].include?(ENV['silent']) }
20
20
 
@@ -27,7 +27,7 @@ class TranslationValidator < ActiveModel::EachValidator
27
27
  end
28
28
  end
29
29
 
30
- def validate_each(record,attr_name,value)
30
+ def validate_each(record, attr_name, value)
31
31
  configuration = { :message => :missing_translations,
32
32
  :required_locales => record.respond_to?(:get_required_locales) ? :get_required_locales : [] }
33
33
  configuration.update(options)
@@ -44,8 +44,7 @@ class TranslationValidator < ActiveModel::EachValidator
44
44
  end
45
45
  end
46
46
  if missing_locales.size > 0
47
- # m = configuration[:message].to_s.gsub()
48
- record.errors.add(attr_name, configuration[:message], { :locales => missing_locales.to_sentence })
47
+ record.errors.add(attr_name, :missing_translation, :message => configuration[:message], :locales => missing_locales.to_sentence)
49
48
  end
50
49
  end
51
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zlocalize
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2.1
4
+ version: 6.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Bedard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-25 00:00:00.000000000 Z
12
+ date: 2022-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubygems_version: 3.3.5
136
+ rubygems_version: 3.3.10
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Translation engine for Rails applications