*** empty log message ***
[booh] / bin / booh-backend
index 0e2c5bb295a656e44566f69e70629f0c0a4a255f..ef86b690175aac289eabf24946993463c4e6aa80 100755 (executable)
@@ -672,16 +672,16 @@ def find_translation_for_file(file, msg)
     end
 end
 
-def sub_previous_next_album(file, previous_album, next_album, html)
+def sub_previous_next_album(file, previous_album, next_album, html, previous_album_msg, next_album_msg)
     if previous_album
-        html.gsub!(/~~previous_album~~/, '<a href="' + previous_album + 'thumbnails' + $htmlsuffix + '">' + find_translation_for_file(file, N_('previous album')) + '</a>')
+        html.gsub!(/~~previous_album~~/, '<a href="' + previous_album + 'thumbnails' + $htmlsuffix + '">' + previous_album_msg + '</a>')
         html.gsub!(/~~ifprevious_album\?~~(.+?)~~fi~~/) { $1 }
     else
         html.gsub!(/~~previous_album~~/, '')
         html.gsub!(/~~ifprevious_album\?~~(.+?)~~fi~~/, '')
     end
     if next_album
-        html.gsub!(/~~next_album~~/, '<a href="' + next_album + 'thumbnails' + $htmlsuffix + '">' + find_translation_for_file(file, N_('next album')) + '</a>')
+        html.gsub!(/~~next_album~~/, '<a href="' + next_album + 'thumbnails' + $htmlsuffix + '">' + next_album_msg + '</a>')
         html.gsub!(/~~ifnext_album\?~~(.+?)~~fi~~/) { $1 }
     else
         html.gsub!(/~~next_album~~/, '')
@@ -1352,13 +1352,17 @@ def walk_source_dir
             for suffix in [ '', '-nojs' ]
                 for sizeobj in $images_size
                     Dir.glob("#{dest_dir}/thumbnails-#{size2js(sizeobj['name'])}#{suffix}-*.html") do |file|
+                        #- unroll translations, they are costly if rerun for each line of files
+                        rta = find_translation_for_file(file, N_('return to albums'))
+                        pa = find_translation_for_file(file, N_('previous album'))
+                        na = find_translation_for_file(file, N_('next album'))
                         substInFile(file) { |line|
-                            sub_previous_next_album(file, previous_album, next_album, line)
+                            sub_previous_next_album(file, previous_album, next_album, line, pa, na)
                             if dirpresent
-                                line.sub!(/~~return_to_albums~~/, '<a href="index' + $htmlsuffix + '">' + find_translation_for_file(file, N_('return to albums')) + '</a>')
+                                line.sub!(/~~return_to_albums~~/, '<a href="index' + $htmlsuffix + '">' + rta + '</a>')
                             else
                                 if parentname == 'dir'
-                                    line.sub!(/~~return_to_albums~~/, '<a href="../index' + $htmlsuffix + '">' + find_translation_for_file(file, N_('return to albums')) + '</a>')
+                                    line.sub!(/~~return_to_albums~~/, '<a href="../index' + $htmlsuffix + '">' + rta + '</a>')
                                 else
                                     line.sub!(/~~return_to_albums~~/, '')
                                 end
@@ -1368,8 +1372,10 @@ def walk_source_dir
                     end
                     if suffix == '' && xmldir.child_byname_notattr('image', 'deleted')
                         Dir.glob("#{dest_dir}/image-#{size2js(sizeobj['name'])}*.html") do |file|
+                            pa = find_translation_for_file(file, N_('previous album'))
+                            na = find_translation_for_file(file, N_('next album'))
                             substInFile(file) { |line|
-                                sub_previous_next_album(file, previous_album, next_album, line)
+                                sub_previous_next_album(file, previous_album, next_album, line, pa, na)
                             }
                         end
                     end