Hello community,

here is the log from the commit of package rubygem-yast-rake for 
openSUSE:Factory checked in at 2020-05-15 23:51:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-yast-rake (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-yast-rake.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-yast-rake"

Fri May 15 23:51:00 2020 rev:32 rq:805349 version:0.2.38

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-yast-rake/rubygem-yast-rake.changes      
2020-05-05 18:53:31.905172563 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-yast-rake.new.2738/rubygem-yast-rake.changes
    2020-05-15 23:51:02.117395993 +0200
@@ -1,0 +2,8 @@
+Wed May 13 10:13:35 UTC 2020 - Ladislav Slezák <lsle...@suse.cz>
+
+- Enhanced "check:pot" task to check for "%<foo>" tags in
+  translatable strings (should be replaced with "%{}")
+  (bsc#1171555)
+- 0.2.38
+
+-------------------------------------------------------------------

Old:
----
  yast-rake-0.2.37.gem

New:
----
  yast-rake-0.2.38.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-yast-rake.spec ++++++
--- /var/tmp/diff_new_pack.xyRjoJ/_old  2020-05-15 23:51:02.809397327 +0200
+++ /var/tmp/diff_new_pack.xyRjoJ/_new  2020-05-15 23:51:02.813397334 +0200
@@ -21,7 +21,7 @@
 %define rb_build_ruby_abis    %{rb_default_ruby_abi}
 
 Name:           rubygem-yast-rake
-Version:        0.2.37
+Version:        0.2.38
 Release:        0
 %define mod_name yast-rake
 %define mod_full_name %{mod_name}-%{version}

++++++ yast-rake-0.2.37.gem -> yast-rake-0.2.38.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/VERSION new/VERSION
--- old/VERSION 2019-06-27 16:55:34.000000000 +0200
+++ new/VERSION 2020-05-13 17:52:39.000000000 +0200
@@ -1 +1 @@
-0.2.37
+0.2.38
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tasks/pot.rake new/lib/tasks/pot.rake
--- old/lib/tasks/pot.rake      2019-06-27 16:55:34.000000000 +0200
+++ new/lib/tasks/pot.rake      2020-05-13 17:52:39.000000000 +0200
@@ -27,19 +27,36 @@
 end
 
 namespace :check do
+
+  def interpolation_message
+    <<~MSG
+      Note: \#{foo} substitution in translatable strings does
+      not work properly, use
+        _("foo %{bar} baz") % { :bar => bar }
+      or
+        _("foo %s baz") % bar
+    MSG
+  end
+
+  def angle_brackets_message
+    <<~MSG
+      Note: %<foo> placeholder should not be used in translatable strings
+      because GNU Gettext does not support any suitable language format for 
that,
+      use %{foo} instead.
+    MSG
+  end
+
   # print failed lines and a hint to STDERR
-  def report_pot_errors(lines)
+  def report_pot_errors(lines, message)
+    return if lines.empty?
+
     warn "Failed lines:"
     warn "-" * 30
     warn lines
     warn "-" * 30
-    $stderr.puts
-    warn "Note: \#{foo} substitution in translatable strings does" \
-      " not work properly, use"
-    warn "  _(\"foo %{bar} baz\") % { :bar => bar }"
-    warn "or"
-    warn "  _(\"foo %s baz\") % bar"
-    $stderr.puts
+    warn ""
+    warn message
+    warn ""
   end
 
   # remove gettext keywords and extra quotes
@@ -53,7 +70,9 @@
   end
 
   desc "Check translatable strings for common mistakes"
-  # depends on the global "pot" task defined above
+  # depends on the global "pot" task defined above,
+  # this scans for the #{} interpolations (do not work in translations)
+  # and %<> (no compatible language format in Gettext)
   task pot: :"rake:pot" do
     Dir["*.pot"].each do |pot|
       puts "Checking #{pot}..."
@@ -61,14 +80,18 @@
       # remove comments
       lines.reject! { |line| line.match(/^#/) }
       # Ruby substitution present?
-      lines.select! { |line| line.include?("\#{") }
+      interpolations = lines.select { |line| line.include?("\#{") }
+      angle_brackets = lines.select { |line| line.include?("%<") }
+
+      next if interpolations.empty? && angle_brackets.empty?
+
+      clean_pot_lines(interpolations)
+      clean_pot_lines(angle_brackets)
 
-      clean_pot_lines(lines)
+      report_pot_errors(interpolations, interpolation_message)
+      report_pot_errors(angle_brackets, angle_brackets_message)
 
-      if !lines.empty?
-        report_pot_errors(lines)
-        raise "ERROR: Ruby substitution found in a translatable string"
-      end
+      raise "ERROR: Found invalid or unsupported translatable string"
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2020-03-05 17:06:27.000000000 +0100
+++ new/metadata        2020-05-13 17:52:39.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: yast-rake
 version: !ruby/object:Gem::Version
-  version: 0.2.37
+  version: 0.2.38
 platform: ruby
 authors:
 - Josef Reidinger
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2020-03-05 00:00:00.000000000 Z
+date: 2020-05-13 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: packaging_rake_tasks
@@ -86,8 +86,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubyforge_project: 
-rubygems_version: 2.7.6.2
+rubygems_version: 3.1.2
 signing_key: 
 specification_version: 4
 summary: Rake tasks providing basic work-flow for Yast development


Reply via email to