X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=cron.d%2F500update_mo;h=3b5c844362668ea489fcfb5713f86c990139a037;hb=ff0b31e3d3d5907391ea398583e77538e0cba72c;hp=ec37c4fd0b0e699c6a661e109655deab72b6bb40;hpb=56d4b3ed57e20359e5ea46feabb850cf4a94caf2;p=deb%2Fpackages.git diff --git a/cron.d/500update_mo b/cron.d/500update_mo index ec37c4f..3b5c844 100755 --- a/cron.d/500update_mo +++ b/cron.d/500update_mo @@ -2,28 +2,64 @@ . `dirname $0`/../config.sh -gettextfiles=$(find cgi-bin lib -not -name 'LanguageNames.pm' -a -not -name 'Sections.pm' -a \( -name '*.pl' -o -name '*.pm' \)); -gettextfiles="$gettextfiles bin/create_index_pages" -podomains="pdo sections langs" +cd "$topdir" +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" # Update pot # # Common options for all calls -xgettext_opts="--language=Perl --keyword=_ --keyword=N_ --keyword=_g --foreign-user --add-comments" +xgettext_opts="--language=Perl --keyword=N_ --keyword=_g --foreign-user --add-comments" echo gettextfiles=$gettextfiles -xgettext $xgettext_opts -d pdo -o ${podir}/pdo.pot ${gettextfiles} -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 +echo templatefiles=$templatefiles +xgettext $xgettext_opts -d pdo -o ${podir}/pdo.pot.new ${gettextfiles} +$topdir/bin/ttxgettext templates ${templatefiles} >${podir}/templates.pot.new +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 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} @@ -34,20 +70,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 - mv ${domain}.${lang}.po ${domain}.${lang}.po.tmp - msgmerge -q -F -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 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}