86 lines
3.1 KiB
Makefile
86 lines
3.1 KiB
Makefile
|
#!/bin/bash
|
||
|
#
|
||
|
# osBilling - Open Billing Software
|
||
|
#
|
||
|
# This program is free software: you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation, either version 3 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
#
|
||
|
# Originally authored by Deon George
|
||
|
#
|
||
|
# @author Deon George <deonATleenooksDOTnet>
|
||
|
# @copyright 2009 Deon George
|
||
|
# @link http://osb.leenooks.net
|
||
|
# @license http://www.gnu.org/licenses/
|
||
|
# @package AgileBill
|
||
|
# @subpackage Language
|
||
|
#
|
||
|
# Makefile Utility to manipulate PO and POT files
|
||
|
#
|
||
|
# Current target list:
|
||
|
#
|
||
|
# all display target
|
||
|
# all-mo compile .mo files from .po translation available
|
||
|
# pot create a update main POT file
|
||
|
# all-merge merge last POT with each current translations (re-create POT)
|
||
|
# all-merge-pot merge last POT with each current translations
|
||
|
|
||
|
LOCALEDIR = .
|
||
|
TEMPLATEFILES=`find ../../templates -iname *xml -exec echo -m {} \;`
|
||
|
EXPORTFILE = $(shell echo $${EXPORTFILE:-/tmp/launchpad-export.tgz})
|
||
|
|
||
|
all:
|
||
|
@echo Please, specify a target [pot, xml-pot, all-mo, all-merge, all-merge-pot, launchpad-export]
|
||
|
|
||
|
all-mo:
|
||
|
@for i in `ls -1 $(LOCALEDIR)` ; \
|
||
|
do \
|
||
|
if ls $(LOCALEDIR)/$$i/LC_MESSAGES/*.po >/dev/null 2>&1; then \
|
||
|
echo Processing: $$i ; \
|
||
|
for j in $(LOCALEDIR)/$$i/LC_MESSAGES/*.po; do \
|
||
|
x=$$(echo $$j|sed -e 's/.po$$/.mo/'); \
|
||
|
echo " - $$j => $$x"; \
|
||
|
msgfmt -v -c --statistics $$j -o $$x; \
|
||
|
done ; \
|
||
|
fi \
|
||
|
done
|
||
|
|
||
|
pot:
|
||
|
@echo TO TEST; exit 1;
|
||
|
@po4a-gettextize -o tags="<title> <description> <display>" -o tagsonly=1 -f xml $(TEMPLATEFILES) -p messages.pot
|
||
|
@find ../../ -name *.php -exec xgettext --keyword=_ -L PHP -j --omit-header -o messages.pot -s {} \;
|
||
|
@find ../../ -name *.inc -exec xgettext --keyword=_ -L PHP -j --omit-header -o messages.pot -s {} \;
|
||
|
@echo messages.pot created, you might like to change the header with contents of messages.header
|
||
|
|
||
|
all-merge: pot
|
||
|
all-merge-pot:
|
||
|
@echo TO TEST; exit 1;
|
||
|
@for i in `ls -1 $(LOCALEDIR)` ; \
|
||
|
do \
|
||
|
if [ -f $(LOCALEDIR)/$$i/LC_MESSAGES/messages.po ]; then \
|
||
|
echo Processing: $$i ; \
|
||
|
msgmerge -v $(LOCALEDIR)/$$i/LC_MESSAGES/messages.po messages.pot -o $$i.po; \
|
||
|
mv $$i.po $(LOCALEDIR)/$$i/LC_MESSAGES/messages.po; \
|
||
|
fi \
|
||
|
done
|
||
|
|
||
|
launchpad-extract:
|
||
|
@echo TO TEST; exit 1;
|
||
|
@[ ! -r $(EXPORTFILE) ] && echo "No export file [$(EXPORTFILE)] found?" && exit 1 || true
|
||
|
@cd $(LOCALEDIR); tar xzf $(EXPORTFILE)
|
||
|
@rm -f $(LOCALEDIR)/phpldapadmin/phpldapadmin-uk.po
|
||
|
@rm -f $(LOCALEDIR)/phpldapadmin/phpldapadmin.pot
|
||
|
@find $(LOCALEDIR) -name phpldapadmin-\*.po | while read i; do newi=$$(echo $$i| sed -r 's/phpldapadmin-(.*).po/..\/\1\*\/LC_MESSAGES\/messages.po/'); mv $$i $$newi; done
|
||
|
rmdir $(LOCALEDIR)/phpldapadmin
|
||
|
|
||
|
launchpad-export: launchpad-extract all-mo
|