general: switch i18n to django (#6735)
This commit is contained in:
parent
968a40525f
commit
35a93ec287
|
@ -2,9 +2,7 @@ include au-quotidien-wcs-settings.xml
|
||||||
include wcs-au-quotidien.cfg-sample
|
include wcs-au-quotidien.cfg-sample
|
||||||
include MANIFEST.in
|
include MANIFEST.in
|
||||||
include VERSION
|
include VERSION
|
||||||
include po/Makefile
|
recursive-include auquotidien/locale *.po *.mo
|
||||||
include po/*.po
|
|
||||||
include po/*.pot
|
|
||||||
recursive-include apache-errors/ *.html
|
recursive-include apache-errors/ *.html
|
||||||
recursive-include data/themes/ *.css *.png *.jpeg '*.jpg *.xml *.html *.js *.ezt *.gif *.otf
|
recursive-include data/themes/ *.css *.png *.jpeg '*.jpg *.xml *.html *.js *.ezt *.gif *.otf
|
||||||
recursive-include auquotidien/ *.py
|
recursive-include auquotidien/ *.py
|
||||||
|
|
|
@ -6,6 +6,3 @@
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --with python2
|
dh $@ --with python2
|
||||||
|
|
||||||
override_dh_install:
|
|
||||||
cd po && make install prefix=$(CURDIR)/debian/wcs-au-quotidien/
|
|
||||||
|
|
38
po/Makefile
38
po/Makefile
|
@ -1,38 +0,0 @@
|
||||||
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 $@
|
|
||||||
|
|
48
setup.py
48
setup.py
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import distutils.core
|
import sys
|
||||||
|
|
||||||
|
from distutils.cmd import Command
|
||||||
|
from distutils.command.build import build as _build
|
||||||
from distutils.command.sdist import sdist
|
from distutils.command.sdist import sdist
|
||||||
from quixote.ptl.qx_distutils import qx_build_py
|
from setuptools.command.install_lib import install_lib as _install_lib
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
VERSION = '1.20'
|
VERSION = '1.20'
|
||||||
|
@ -36,6 +38,41 @@ def data_tree(destdir, sourcedir):
|
||||||
dirs.remove('.svn')
|
dirs.remove('.svn')
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
class compile_translations(Command):
|
||||||
|
description = 'compile message catalogs to MO files via django compilemessages'
|
||||||
|
user_options = []
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
try:
|
||||||
|
from django.core.management import call_command
|
||||||
|
for path, dirs, files in os.walk('auquotidien'):
|
||||||
|
if 'locale' not in dirs:
|
||||||
|
continue
|
||||||
|
curdir = os.getcwd()
|
||||||
|
os.chdir(os.path.realpath(path))
|
||||||
|
call_command('compilemessages')
|
||||||
|
os.chdir(curdir)
|
||||||
|
except ImportError:
|
||||||
|
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
|
||||||
|
|
||||||
|
|
||||||
|
class build(_build):
|
||||||
|
sub_commands = [('compile_translations', None)] + _build.sub_commands
|
||||||
|
|
||||||
|
|
||||||
|
class install_lib(_install_lib):
|
||||||
|
def run(self):
|
||||||
|
self.run_command('compile_translations')
|
||||||
|
_install_lib.run(self)
|
||||||
|
|
||||||
|
|
||||||
class eo_sdist(sdist):
|
class eo_sdist(sdist):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -58,8 +95,11 @@ setup(
|
||||||
maintainer_email = 'fpeters@entrouvert.com',
|
maintainer_email = 'fpeters@entrouvert.com',
|
||||||
package_dir = {'auquotidien': 'auquotidien'},
|
package_dir = {'auquotidien': 'auquotidien'},
|
||||||
packages = ['auquotidien', 'auquotidien.modules', 'auquotidien.modules.pyatom'],
|
packages = ['auquotidien', 'auquotidien.modules', 'auquotidien.modules.pyatom'],
|
||||||
cmdclass = {'build_py': qx_build_py,
|
cmdclass={'build': build,
|
||||||
'sdist': eo_sdist},
|
'compile_translations': compile_translations,
|
||||||
|
'install_lib': install_lib,
|
||||||
|
'sdist': eo_sdist},
|
||||||
|
include_package_data=True,
|
||||||
data_files = data_tree('share/wcs/texts', 'texts') +\
|
data_files = data_tree('share/wcs/texts', 'texts') +\
|
||||||
data_tree('share/wcs/themes/auquotidien', 'theme') +\
|
data_tree('share/wcs/themes/auquotidien', 'theme') +\
|
||||||
data_tree('share/wcs/themes/', 'data/themes/') + \
|
data_tree('share/wcs/themes/', 'data/themes/') + \
|
||||||
|
|
Reference in New Issue