]> git.deb.at Git - deb/packages.git/blob - cron.d/500update_mo
073e8429d5b520ebc9e54494432150a8010d1002
[deb/packages.git] / cron.d / 500update_mo
1 #! /bin/bash
2
3 . `dirname $0`/../config.sh
4
5 cd "$topdir"
6 gettextfiles="
7 lib/Packages/CGI.pm
8 lib/Packages/Config.pm
9 lib/Packages/DB.pm
10 lib/Packages/DoDownload.pm
11 lib/Packages/DoFilelist.pm
12 lib/Packages/DoIndex.pm
13 lib/Packages/DoNewPkg.pm
14 lib/Packages/DoSearch.pm
15 lib/Packages/DoSearchContents.pm
16 lib/Packages/DoShow.pm
17 lib/Packages/Page.pm
18 lib/Packages/Search.pm
19 lib/Packages/SrcPage.pm
20 lib/Packages/Template.pm
21 lib/Packages/Dispatcher.pm
22 bin/create_index_pages
23 "
24 templatefiles="
25 templates/config.tmpl
26 templates/config/architectures.tmpl
27 templates/config/archive_layout.tmpl
28 templates/config/mirrors.tmpl
29 templates/html/download.tmpl
30 templates/html/error.tmpl
31 templates/html/filelist.tmpl
32 templates/html/foot.tmpl
33 templates/html/head.tmpl
34 templates/html/index.tmpl
35 templates/html/menu.inc
36 templates/html/messages.tmpl
37 templates/html/newpkg.tmpl
38 templates/html/search.tmpl
39 templates/html/search_contents.tmpl
40 templates/html/show.tmpl
41 templates/html/suite_index.tmpl
42 templates/html/tag_index.tmpl
43 templates/rfc822/search.tmpl
44 templates/rss/newpkg.tmpl
45 templates/txt/index.tmpl
46 "
47 podomains="pdo templates sections langs"
48
49 # Update pot
50 #
51 # Common options for all calls
52 xgettext_opts="--language=Perl --keyword=N_ --keyword=_g --foreign-user --add-comments"
53
54 echo gettextfiles=$gettextfiles
55 echo templatefiles=$templatefiles
56 xgettext $xgettext_opts -d pdo -o ${podir}/pdo.pot ${gettextfiles}
57 $topdir/bin/ttxgettext templates ${templatefiles} >${podir}/templates.pot
58 xgettext $xgettext_opts -d sections -o ${podir}/sections.pot ${libdir}/Packages/Sections.pm
59 xgettext $xgettext_opts -d langs -o ${podir}/langs.pot ${libdir}/Packages/I18N/LanguageNames.pm
60
61 cd $podir
62
63 # normalize paths in .pot files
64 for domain in ${podomains}
65 do
66   perl -p -i -e "s,^#:\s*\Q${topdir}\E,#: .,go" ${domain}.pot
67 done
68
69 # Create missing po files
70 #
71 for lang in ${polangs}
72 do
73   for domain in ${podomains}
74   do
75     test -f ${domain}.${lang}.po || cp ${domain}.pot ${domain}.${lang}.po
76   done
77 done
78
79 # Update po
80 #
81 for lang in ${polangs} 
82 do
83   for domain in ${podomains}
84   do
85     cp ${domain}.${lang}.po ${domain}.${lang}.po.tmp
86     msgmerge --previous --quiet --sort-by-file -o ${domain}.${lang}.po ${domain}.${lang}.po.tmp ${domain}.pot
87     rm ${domain}.${lang}.po.tmp
88     # normalize paths in .po files
89     perl -p -i -e "s,^#:\s*\Q${topdir}\E,#: .,go" ${domain}.${lang}.po
90   done
91 done
92
93 # Update mo
94 #
95 test -d ${localedir} || mkdir -p ${localedir}
96 for lang in ${polangs}
97 do 
98   test -d ${localedir}/${lang}/LC_MESSAGES \
99       || mkdir -p ${localedir}/${lang}/LC_MESSAGES
100   for domain in ${podomains}
101   do
102     echo domain=$domain language=$lang
103     msgfmt --statistics -o ${localedir}/${lang}/LC_MESSAGES/${domain}.mo ${domain}.${lang}.po
104   done
105 done