From d9171adf9fc6501b826976ad5338e10086d8020c Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Thu, 5 Dec 2019 08:14:33 +0100 Subject: [PATCH] Move translated image selection into po file. 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 | 15 --------------- po/es/mwcc.po | 12 ++++++------ 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/fixup-docbook-translated.rb b/fixup-docbook-translated.rb index 38ec06e..3f04247 100644 --- a/fixup-docbook-translated.rb +++ b/fixup-docbook-translated.rb @@ -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 diff --git a/po/es/mwcc.po b/po/es/mwcc.po index 915a996..af3b2bb 100644 --- a/po/es/mwcc.po +++ b/po/es/mwcc.po @@ -1040,7 +1040,7 @@ msgstr "" #. type: Attribute 'fileref' of:
#: MadewithCreativeCommonsmostup-to-dateversion.xml:509 msgid "Pictures/10000201000008000000045C30360249076453E6.png" -msgstr "Pictures/10000201000008000000045C30360249076453E6.png" +msgstr "Pictures/es/10000201000008000000045C30360249076453E6.png" #. type: Content of:
#: MadewithCreativeCommonsmostup-to-dateversion.xml:507 @@ -1134,7 +1134,7 @@ msgstr "Cuatro aspectos de administración de recursos." #. type: Attribute 'fileref' of:
#: MadewithCreativeCommonsmostup-to-dateversion.xml:558 msgid "Pictures/10000201000007D0000007D0ACF13F8B71EAF0B9.png" -msgstr "Pictures/10000201000007D0000007D0ACF13F8B71EAF0B9.png" +msgstr "Pictures/es/10000201000007D0000007D0ACF13F8B71EAF0B9.png" #. type: Content of: #: 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 -- 2.47.2