]> git.deb.at Git - deb/packages.git/blobdiff - cron.d/500update_mo
Add translation support for debtags
[deb/packages.git] / cron.d / 500update_mo
index 168a2fec669b63a3e1058ef7a8104373fbed4e9a..9676466cd4c7b83d58dda167dbc70b1c54122cea 100755 (executable)
@@ -3,10 +3,48 @@
 . `dirname $0`/../config.sh
 
 cd "$topdir"
-gettextfiles=$(find cgi-bin lib -not -name 'LanguageNames.pm' -a -not -name 'Sections.pm' -a \( -name '*.pl' -o -name '*.pm' \))
-templatefiles=$(find templates -name '*.tmpl' -o -name '*.inc')
-gettextfiles="$gettextfiles bin/create_index_pages"
-podomains="pdo templates sections langs"
+gettextfiles="
+lib/Packages/CGI.pm
+lib/Packages/Config.pm
+lib/Packages/DB.pm
+lib/Packages/DoDownload.pm
+lib/Packages/DoFilelist.pm
+lib/Packages/DoIndex.pm
+lib/Packages/DoNewPkg.pm
+lib/Packages/DoSearch.pm
+lib/Packages/DoSearchContents.pm
+lib/Packages/DoShow.pm
+lib/Packages/Page.pm
+lib/Packages/Search.pm
+lib/Packages/SrcPage.pm
+lib/Packages/Template.pm
+lib/Packages/Dispatcher.pm
+bin/create_index_pages
+"
+templatefiles="
+templates/config.tmpl
+templates/config/architectures.tmpl
+templates/config/archive_layout.tmpl
+templates/config/mirrors.tmpl
+templates/html/download.tmpl
+templates/html/error.tmpl
+templates/html/filelist.tmpl
+templates/html/foot.tmpl
+templates/html/head.tmpl
+templates/html/index.tmpl
+templates/html/menu.inc
+templates/html/messages.tmpl
+templates/html/newpkg.tmpl
+templates/html/search.tmpl
+templates/html/search_contents.tmpl
+templates/html/show.tmpl
+templates/html/suite_index.tmpl
+templates/html/tag_index.tmpl
+templates/rfc822/search.tmpl
+templates/rss/newpkg.tmpl
+templates/txt/index.tmpl
+"
+podomains="pdo templates sections langs debtags"
 
 # Update pot
 #
@@ -15,19 +53,16 @@ xgettext_opts="--language=Perl --keyword=N_ --keyword=_g --foreign-user --add-co
 
 echo gettextfiles=$gettextfiles
 echo templatefiles=$templatefiles
-xgettext $xgettext_opts -d pdo -o ${podir}/pdo.pot ${gettextfiles}
-$topdir/bin/ttxgettext templates ${templatefiles} >${podir}/templates.pot
-xgettext $xgettext_opts -d sections -o ${podir}/sections.pot ${libdir}/Packages/Sections.pm
-xgettext $xgettext_opts -d langs -o ${podir}/langs.pot ${libdir}/Packages/I18N/LanguageNames.pm
+xgettext $xgettext_opts -d pdo -o ${podir}/pdo.pot.new ${gettextfiles}
+xgettext $xgettext_opts -d sections -o ${podir}/sections.pot.new ${libdir}/Packages/Sections.pm
+xgettext $xgettext_opts -d langs -o ${podir}/langs.pot.new ${libdir}/Packages/I18N/LanguageNames.pm
+$topdir/bin/ttxgettext templates ${templatefiles} >${podir}/templates.pot.new
+if [ -f files/debtags/vocabulary ]; then
+    $topdir/bin/debtags-xgettext files/debtags/vocabulary >${podir}/debtags.pot.new
+fi
 
 cd $podir
 
-# normalize paths in .pot files
-for domain in ${podomains}
-do
-  perl -p -i -e "s,^#:\s*\Q${topdir}\E,#: .,go" ${domain}.pot
-done
-
 # Create missing po files
 #
 for lang in ${polangs}
@@ -38,20 +73,31 @@ do
   done
 done
 
-# Update po
-#
-for lang in ${polangs} 
+# normalize paths in .pot files
+for domain in ${podomains}
 do
-  for domain in ${podomains}
-  do
-    cp ${domain}.${lang}.po ${domain}.${lang}.po.tmp
-    msgmerge --previous --quiet --sort-by-file -o ${domain}.${lang}.po ${domain}.${lang}.po.tmp ${domain}.pot
-    rm ${domain}.${lang}.po.tmp
-    # normalize paths in .po files
-    perl -p -i -e "s,^#:\s*\Q${topdir}\E,#: .,go" ${domain}.${lang}.po
-  done
+  perl -p -i -e "s,^#:\s*\Q${topdir}\E,#: .,go" ${domain}.pot.new
+  if [ ! -f ${domain}.pot.new ] || diff -I"POT-Creation-Date" -q ${domain}.pot.new ${domain}.pot >/dev/null 2>&1
+  then
+      echo "${domain}.pot unchanged"
+      rm ${domain}.pot.new
+  else
+      echo "${domain}.pot changed"
+      mv ${domain}.pot.new ${domain}.pot
+      # Update po
+      for lang in ${polangs} 
+      do
+       echo "  update ${domain}.${lang}.po"
+       cp ${domain}.${lang}.po ${domain}.${lang}.po.tmp
+       msgmerge --previous --quiet --sort-by-file -o ${domain}.${lang}.po ${domain}.${lang}.po.tmp ${domain}.pot
+       rm ${domain}.${lang}.po.tmp
+        # normalize paths in .po files
+       perl -p -i -e "s,^#:\s*\Q${topdir}\E,#: .,go" ${domain}.${lang}.po
+      done
+  fi
 done
 
+echo
 # Update mo
 #
 test -d ${localedir} || mkdir -p ${localedir}