]> pere.pagekite.me Git - text-madewithcc.git/commitdiff
Move translated image selection into po file.
authorPetter Reinholdtsen <pere@hungry.com>
Thu, 5 Dec 2019 07:14:33 +0000 (08:14 +0100)
committerPetter Reinholdtsen <pere@hungry.com>
Thu, 5 Dec 2019 07:16:57 +0000 (08:16 +0100)
No need to rewrite the Docbook XML to find translated image files,
when this can be handled directly in the po files.  This ensure
consistent handling of translated images across all languages.

fixup-docbook-translated.rb
po/es/mwcc.po

index 38ec06e98fdf01fdba0f7c6d907e7fc99b1d5696..3f04247a60d9a4e660b6aee3cd64edbb4d0b89e3 100644 (file)
@@ -28,21 +28,6 @@ else
   log 0, ' -!- Introduction text not found or empty'
 end
 
-log 0, 'replace images with translated versions'
-xml.search('imagedata').each do |img|
-  # Included images are in the 'Pictures' directory. Translated images
-  # are in Pictures/[langcode]/. Only translated images need to be
-  # included.
-  orig_img = img.attributes['fileref'].text
-  trans_img = orig_img.gsub(/Pictures/, "Pictures/#{lang}")
-  next if orig_img == trans_img
-
-  if File.exists?(trans_img)
-    log 1, 'Replaced %s by %s' % [orig_img, trans_img]
-    img.set_attribute('fileref', trans_img)
-  end
-end
-
 log 0, 'Final editorial requests: Attributions on top, as in other chapters, also for prefaces'
 xml.search('preface').each do |pref|
   title = pref.search('title').first
index 915a9960c0a12a6c4beb028deaebe975420bb0be..af3b2bb16980c5262de136fca7ec2429f88baf5f 100644 (file)
@@ -1040,7 +1040,7 @@ msgstr ""
 #. type: Attribute 'fileref' of: <book><part><chapter><sect1><figure><mediaobject><imageobject><imagedata>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:509
 msgid "Pictures/10000201000008000000045C30360249076453E6.png"
-msgstr "Pictures/10000201000008000000045C30360249076453E6.png"
+msgstr "Pictures/es/10000201000008000000045C30360249076453E6.png"
 
 #. type: Content of: <book><part><chapter><sect1><figure>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:507
@@ -1134,7 +1134,7 @@ msgstr "Cuatro aspectos de administración de recursos."
 #. type: Attribute 'fileref' of: <book><part><chapter><sect1><figure><mediaobject><imageobject><imagedata>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:558
 msgid "Pictures/10000201000007D0000007D0ACF13F8B71EAF0B9.png"
-msgstr "Pictures/10000201000007D0000007D0ACF13F8B71EAF0B9.png"
+msgstr "Pictures/es/10000201000007D0000007D0ACF13F8B71EAF0B9.png"
 
 #. type: Content of: <book><part><chapter><sect1><sect2><title>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:567
@@ -1350,7 +1350,7 @@ msgstr "Cómo el mercado, los comunes y el Estado conciben los recursos."
 #. type: Attribute 'fileref' of: <book><part><chapter><sect1><sect2><figure><mediaobject><imageobject><imagedata>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:676
 msgid "Pictures/10000201000009C40000065D9EC4F530BD4DFBE0.png"
-msgstr "Pictures/10000201000009C40000065D9EC4F530BD4DFBE0.png"
+msgstr "Pictures/es/10000201000009C40000065D9EC4F530BD4DFBE0.png"
 
 #. type: Content of: <book><part><chapter><sect1><sect2><title>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:686
@@ -1593,7 +1593,7 @@ msgstr "En la sociedad preindustrializada."
 #. type: Attribute 'fileref' of: <book><part><chapter><sect1><figure><mediaobject><imageobject><imagedata>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:805
 msgid "Pictures/10000201000009C4000005153EACBD62F00F6BA9.png"
-msgstr "Pictures/10000201000009C4000005153EACBD62F00F6BA9.png"
+msgstr "Pictures/es/10000201000009C4000005153EACBD62F00F6BA9.png"
 
 #. type: Content of: <book><part><chapter><sect1><para><footnote><para>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:817
@@ -1668,7 +1668,7 @@ msgstr "Los comunes son gradualmente reemplazados por el Estado."
 #. type: Attribute 'fileref' of: <book><part><chapter><sect1><figure><mediaobject><imageobject><imagedata>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:847
 msgid "Pictures/10000201000009C4000005150F069409C1CC12F0.png"
-msgstr "Pictures/10000201000009C4000005150F069409C1CC12F0.png"
+msgstr "Pictures/es/10000201000009C4000005150F069409C1CC12F0.png"
 
 #. type: Content of: <book><part><chapter><sect1><para>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:856
@@ -1826,7 +1826,7 @@ msgstr "Cómo el mercado, el Estado y los comunes se ven al día de hoy."
 #. type: Attribute 'fileref' of: <book><part><chapter><sect1><figure><mediaobject><imageobject><imagedata>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:935
 msgid "Pictures/10000201000009C400000515F1CAA15B223F6BAF.png"
-msgstr "Pictures/10000201000009C400000515F1CAA15B223F6BAF.png"
+msgstr "Pictures/es/10000201000009C400000515F1CAA15B223F6BAF.png"
 
 #. type: Content of: <book><part><chapter><sect1><title>
 #: MadewithCreativeCommonsmostup-to-dateversion.xml:945