translation 1.31 → 1.32

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
  SHA256:
3
- metadata.gz: 186fe35e21fca5df7945cce6f444396496bfafeafacad620c9f3ddfc4870f238
4
- data.tar.gz: 63f7e4ffd3ff3634ca1601d5aafd9f9ca6e029b78a60ffcc4cc1ca164056661d
3
+ metadata.gz: 7a34c57ba0de5df8e9d6e302e24d1d959db4b2a697678d7cfc67e08b36702ef6
4
+ data.tar.gz: 5e024618fe204efef1a26294ec9e8bb6ab5fe357d9a32d826623a7ed4a5b508b
5
5
  SHA512:
6
- metadata.gz: 95d72a1cf231462570c6e9fd8fa67055b6245b4b76f733b2398ebfc484c7885199c57651973a85af47c2d413eaae8eed43762ee0aed7b72d1909c0fe7268e0a2
7
- data.tar.gz: 142b2e7206fff2e3eafc2d3581396aaa37ad6c6acf64869d99a2e83f7ac12a3286d048e1b26250de25a1f96f631c058398a66c1e0eb7d9c3db0fe2cbfe868333
6
+ metadata.gz: 59e48c919c27811c8d8ba6f1b29104d9adf2b661ce69a156acaea8ea669d137d87c9a07f0cb2e9e7f8175ca1930419d0ee6f1752fb4abb045fbfea9795185ea9
7
+ data.tar.gz: c2e556ccaf8f3bec9c833a51ba181c996e76f8f549cb1a180779ba287a9ac56ad992cf8b8fddb40bdb574cb63a3b6130145fe6a09a7d6f93af18dfbad43239af
data/lib/translation.rb CHANGED
@@ -72,13 +72,20 @@ module TranslationIO
72
72
  require 'gettext/tools'
73
73
  require 'gettext/text_domain_manager'
74
74
  require 'gettext/tools/xgettext'
75
+ require "gettext/tools/parser/erubi" if Gem::Version.new(GetText::VERSION) >= Gem::Version.new('3.4.3')
75
76
  end
76
77
 
77
78
  def add_parser_for_erb_source_formats(new_erb_formats)
78
- existing_extensions = GetText::ErbParser.instance_variable_get("@config")[:extnames]
79
79
  new_extensions = new_erb_formats.collect { |ext| ".#{ext}" }
80
80
 
81
+ existing_extensions = GetText::ErbParser.instance_variable_get("@config")[:extnames]
81
82
  GetText::ErbParser.instance_variable_get("@config")[:extnames] = (existing_extensions + new_extensions).uniq
83
+
84
+ # for gettext >= 3.4.3 (erubi compatibility)
85
+ if defined?(GetText::ErubiParser)
86
+ existing_extensions = GetText::ErubiParser.instance_variable_get("@config")[:extnames]
87
+ GetText::ErubiParser.instance_variable_get("@config")[:extnames] = (existing_extensions + new_extensions).uniq
88
+ end
82
89
  end
83
90
 
84
91
  def info(message, level = 0, verbose_level = 0)
@@ -16,12 +16,29 @@ module TranslationIO
16
16
  TranslationIO.info "Updating POT file."
17
17
 
18
18
  FileUtils.mkdir_p(File.dirname(@pot_path))
19
- GetText::Tools::XGetText.run(*@source_files, '-o', @pot_path,
20
- '--msgid-bugs-address', TranslationIO.config.pot_msgid_bugs_address,
21
- '--package-name', TranslationIO.config.pot_package_name,
22
- '--package-version', TranslationIO.config.pot_package_version,
23
- '--copyright-holder', TranslationIO.config.pot_copyright_holder,
24
- '--copyright-year', TranslationIO.config.pot_copyright_year.to_s)
19
+
20
+ # for gettext >= 3.4.3 (erubi compatibility)
21
+ if defined?(GetText::ErubiParser)
22
+ GetText::Tools::XGetText.run(
23
+ *@source_files, '-o', @pot_path,
24
+ '--msgid-bugs-address', TranslationIO.config.pot_msgid_bugs_address,
25
+ '--package-name', TranslationIO.config.pot_package_name,
26
+ '--package-version', TranslationIO.config.pot_package_version,
27
+ '--copyright-holder', TranslationIO.config.pot_copyright_holder,
28
+ '--copyright-year', TranslationIO.config.pot_copyright_year.to_s,
29
+ '--require', 'gettext/tools/parser/erubi', # Cf. (1) https://github.com/ruby-gettext/gettext/pull/91
30
+ '--parser', 'GetText::ErubiParser' # (2) https://github.com/ruby-gettext/gettext/commit/0eb06a88323a5cc16065680ffe228d978fb87c88
31
+ )
32
+ else
33
+ GetText::Tools::XGetText.run(
34
+ *@source_files, '-o', @pot_path,
35
+ '--msgid-bugs-address', TranslationIO.config.pot_msgid_bugs_address,
36
+ '--package-name', TranslationIO.config.pot_package_name,
37
+ '--package-version', TranslationIO.config.pot_package_version,
38
+ '--copyright-holder', TranslationIO.config.pot_copyright_holder,
39
+ '--copyright-year', TranslationIO.config.pot_copyright_year.to_s
40
+ )
41
+ end
25
42
 
26
43
  FileUtils.rm_f(@tmp_empty_file) if @tmp_empty_file.present?
27
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translation
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.31'
4
+ version: '1.32'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hoste
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-04-04 00:00:00.000000000 Z
12
+ date: 2022-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gettext
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: 3.2.5
24
24
  - - "<="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.4.2
26
+ version: 3.4.3
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
@@ -36,7 +36,7 @@ dependencies:
36
36
  version: 3.2.5
37
37
  - - "<="
38
38
  - !ruby/object:Gem::Version
39
- version: 3.4.2
39
+ version: 3.4.3
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rake
42
42
  requirement: !ruby/object:Gem::Requirement