i18n support and translations

This commit is contained in:
Frédéric Péters 2006-08-16 11:24:05 +00:00
parent 7b8fbd5afe
commit 920f68b700
4 changed files with 290 additions and 0 deletions

View File

@ -1,5 +1,21 @@
import gettext
import modules.root
import modules.news
import modules.links
import modules.admin
import wcs
for lang in ['fr']:
try:
trans = gettext.translation('auquotidien', languages = [lang])
except IOError:
continue
translation = wcs.translations.get(lang)
if not translation:
translation = gettext.NullTranslations()
wcs.translations[lang] = translation
translation._catalog.update(trans._catalog)

38
po/Makefile Normal file
View File

@ -0,0 +1,38 @@
POFILES=$(wildcard *.po)
MOFILES=$(POFILES:.po=.mo)
PYFILES=$(shell find ../extra -name '*.py' -or -name '*.ptl')
all: $(MOFILES)
install: all
for file in $(MOFILES); do \
lang=`echo $$file | sed 's/\.mo//'`; \
install -d $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/; \
install -m 0644 $$file $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/auquotidien.mo; \
done
auquotidien.pot: $(PYFILES)
@echo "Rebuilding the pot file"
rm -f auquotidien.pot tmp.*.pot
cnt=0;
for file in $(PYFILES); do \
cnt=$$(expr $$cnt + 1); \
bn=$$cnt.`basename $$file`; \
xgettext --keyword=N_ -c -L Python -o tmp.$$bn.pot $$file; \
done
msgcat tmp.*.pot > auquotidien.pot
rm tmp.*.pot
%.mo: %.po
msgfmt -o $@ $<
%.po: auquotidien.pot
@echo -n "Merging auquotidien.pot and $@"
@msgmerge $@ auquotidien.pot -o $@.new
@if [ "`diff $@ $@.new | grep '[<>]' | wc -l`" -ne 2 ]; then \
mv -f $@.new $@; \
else \
rm -f $@.new; \
fi
@msgfmt --statistics $@

118
po/auquotidien.pot Normal file
View File

@ -0,0 +1,118 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-08-16 13:12+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../extra/modules/admin.ptl:21
msgid "Au Quotidien"
msgstr ""
#: ../extra/modules/admin.ptl:44
#, python-format
msgid "Form - %s"
msgstr ""
#: ../extra/modules/admin.ptl:46
#, python-format
msgid "Importing new form: %s"
msgstr ""
#: ../extra/modules/admin.ptl:48
#, python-format
msgid "Updating form: %s"
msgstr ""
#: ../extra/modules/admin.ptl:52
msgid "Category: "
msgstr ""
#: ../extra/modules/admin.ptl:56
msgid "(new)"
msgstr ""
#: ../extra/modules/admin.ptl:67 ../extra/modules/admin.ptl:72
#: ../extra/modules/admin.ptl:73 ../extra/modules/admin.ptl:74
msgid "Control Panel"
msgstr ""
#: ../extra/modules/admin.ptl:76
msgid "Available Forms"
msgstr ""
#: ../extra/modules/admin.ptl:115
msgid "Up to date"
msgstr ""
#: ../extra/modules/admin.ptl:117
msgid "Download new form"
msgstr ""
#: ../extra/modules/admin.ptl:118 ../extra/modules/links.ptl:82
#: ../extra/modules/news.ptl:82
msgid "New"
msgstr ""
#: ../extra/modules/links.ptl:50 ../extra/modules/news.ptl:50
msgid "You are about to irrevocably delete this link."
msgstr ""
#: ../extra/modules/links.ptl:51 ../extra/modules/news.ptl:51
msgid "Submit"
msgstr ""
#: ../extra/modules/links.ptl:52 ../extra/modules/news.ptl:52
msgid "Cancel"
msgstr ""
#: ../extra/modules/links.ptl:56 ../extra/modules/news.ptl:56
msgid "Delete"
msgstr ""
#: ../extra/modules/links.ptl:57 ../extra/modules/news.ptl:57
msgid "Delete Link"
msgstr ""
#: ../extra/modules/links.ptl:58 ../extra/modules/news.ptl:58
msgid "Deleting Link:"
msgstr ""
#: ../extra/modules/links.ptl:77 ../extra/modules/links.ptl:80
#: ../extra/modules/links.ptl:81 ../extra/modules/links.ptl:109
#: ../extra/modules/links.ptl:115
msgid "Links"
msgstr ""
#: ../extra/modules/news.ptl:77 ../extra/modules/news.ptl:80
#: ../extra/modules/news.ptl:81 ../extra/modules/news.ptl:106
#: ../extra/modules/news.ptl:112 ../extra/modules/root.ptl:87
msgid "News"
msgstr ""
#: ../extra/modules/root.ptl:14
msgid "Ma ville au quotidien"
msgstr ""
#: ../extra/modules/root.ptl:19
msgid "Services"
msgstr ""
#: ../extra/modules/root.ptl:46
msgid "Consultations"
msgstr ""
#: ../extra/modules/root.ptl:70
msgid "Useful links"
msgstr ""

118
po/fr.po Normal file
View File

@ -0,0 +1,118 @@
# Translation for Au Quotidien w.c.s. extension
# Copyright (C) 2006 Entr'ouvert
# This file is distributed under the same license as the auquotidien package.
# Frederic Peters <fpeters@entrouvert.com>, 2006
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: auquotidien 0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-08-16 13:12+0200\n"
"PO-Revision-Date: 2006-08-16 13:12+0200\n"
"Last-Translator: Frederic Peters <fpeters@entrouvert.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../extra/modules/admin.ptl:21
msgid "Au Quotidien"
msgstr "Au Quotidien"
#: ../extra/modules/admin.ptl:44
#, python-format
msgid "Form - %s"
msgstr "Formulaire - %s"
#: ../extra/modules/admin.ptl:46
#, python-format
msgid "Importing new form: %s"
msgstr "Import d'un nouveau formulaire: %s"
#: ../extra/modules/admin.ptl:48
#, python-format
msgid "Updating form: %s"
msgstr "Mise à jour d'un nouveau formulaire: %s"
#: ../extra/modules/admin.ptl:52
msgid "Category: "
msgstr "Cagérorie: "
#: ../extra/modules/admin.ptl:56
msgid "(new)"
msgstr "(nouvelle)"
#: ../extra/modules/admin.ptl:67 ../extra/modules/admin.ptl:72
#: ../extra/modules/admin.ptl:73 ../extra/modules/admin.ptl:74
msgid "Control Panel"
msgstr "Panneau de contrôle"
#: ../extra/modules/admin.ptl:76
msgid "Available Forms"
msgstr "Formulaires disponibles"
#: ../extra/modules/admin.ptl:115
msgid "Up to date"
msgstr "À jour"
#: ../extra/modules/admin.ptl:117
msgid "Download new form"
msgstr "Télécharger nouveau formulaire"
#: ../extra/modules/admin.ptl:118 ../extra/modules/links.ptl:82
#: ../extra/modules/news.ptl:82
msgid "New"
msgstr "Nouveau"
#: ../extra/modules/links.ptl:50 ../extra/modules/news.ptl:50
msgid "You are about to irrevocably delete this link."
msgstr "Vous allez définitivement supprimer ce lien."
#: ../extra/modules/links.ptl:51 ../extra/modules/news.ptl:51
msgid "Submit"
msgstr ""
#: ../extra/modules/links.ptl:52 ../extra/modules/news.ptl:52
msgid "Cancel"
msgstr ""
#: ../extra/modules/links.ptl:56 ../extra/modules/news.ptl:56
msgid "Delete"
msgstr ""
#: ../extra/modules/links.ptl:57 ../extra/modules/news.ptl:57
msgid "Delete Link"
msgstr ""
#: ../extra/modules/links.ptl:58 ../extra/modules/news.ptl:58
msgid "Deleting Link:"
msgstr ""
#: ../extra/modules/links.ptl:77 ../extra/modules/links.ptl:80
#: ../extra/modules/links.ptl:81 ../extra/modules/links.ptl:109
#: ../extra/modules/links.ptl:115
msgid "Links"
msgstr "Liens"
#: ../extra/modules/news.ptl:77 ../extra/modules/news.ptl:80
#: ../extra/modules/news.ptl:81 ../extra/modules/news.ptl:106
#: ../extra/modules/news.ptl:112 ../extra/modules/root.ptl:87
msgid "News"
msgstr "Actualités"
#: ../extra/modules/root.ptl:14
msgid "Ma ville au quotidien"
msgstr "Ma ville au quotidien"
#: ../extra/modules/root.ptl:19
msgid "Services"
msgstr "Services"
#: ../extra/modules/root.ptl:46
msgid "Consultations"
msgstr "Consultations"
#: ../extra/modules/root.ptl:70
msgid "Useful links"
msgstr "Liens utiles"