tazpkg rev 343
Prepare for i18n with gettext
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Jun 20 11:52:56 2010 +0200 (2010-06-20) |
parents | 42d09a689803 |
children | f6dba4eac84a |
files | Makefile README tazpkg tazpkgbox |
line diff
1.1 --- a/Makefile Tue May 25 12:16:59 2010 +0200 1.2 +++ b/Makefile Sun Jun 20 11:52:56 2010 +0200 1.3 @@ -4,28 +4,64 @@ 1.4 DOCDIR?=$(PREFIX)/share/doc 1.5 LIBDIR?=$(PREFIX)/lib/slitaz 1.6 SYSCONFDIR?=/etc/slitaz 1.7 +DESTDIR?= 1.8 +LINGUAS?=fr 1.9 1.10 all: 1.11 - grep "^VERSION=[0-9]" tazpkg | sed 's/VERSION=//' 1.12 1.13 -install: 1.14 - @echo "Installing Tazpkg into $(PREFIX)/bin..." 1.15 - install -g root -o root -m 0755 -d $(PREFIX)/bin 1.16 - install -g root -o root -m 0777 tazpkg $(PREFIX)/bin 1.17 - install -g root -o root -m 0777 tazpkgbox $(PREFIX)/bin 1.18 - @echo "Installing Tazpkgbox lib into $(LIBDIR)..." 1.19 - install -g root -o root -m 0755 -d $(LIBDIR) 1.20 - cp -a lib/tazpkgbox $(LIBDIR) 1.21 +# i18n. 1.22 + 1.23 +pot: 1.24 + xgettext -o po/tazpkg/tazpkg.pot -L Shell ./tazpkg 1.25 + 1.26 +msgmerge: 1.27 + @for l in $(LINGUAS); do \ 1.28 + echo -n "Updating $$l po file."; \ 1.29 + msgmerge -U po/tazpkg/$$l.po po/tazpkg/tazpkg.pot ; \ 1.30 + done; 1.31 + 1.32 +msgfmt: 1.33 + @for l in $(LINGUAS); do \ 1.34 + echo "Compiling $$l mo file..."; \ 1.35 + mkdir -p po/mo/$$l/LC_MESSAGES; \ 1.36 + msgfmt -o po/mo/$$l/LC_MESSAGES/tazpkg.mo po/tazpkg/$$l.po ; \ 1.37 + done; 1.38 + 1.39 +# Installation. 1.40 + 1.41 +install: msgfmt 1.42 + @echo "Installing Tazpkg..." 1.43 + install -g root -o root -m 0755 -d $(DESTDIR)$(PREFIX)/bin 1.44 + install -g root -o root -m 0777 tazpkg $(DESTDIR)$(PREFIX)/bin 1.45 + install -g root -o root -m 0777 tazpkgbox $(DESTDIR)$(PREFIX)/bin 1.46 + @echo "Installing Tazpkgbox libraries..." 1.47 + install -g root -o root -m 0755 -d $(DESTDIR)$(LIBDIR) 1.48 + cp -a lib/tazpkgbox $(DESTDIR)$(LIBDIR) 1.49 @echo "Installing configuration files..." 1.50 - install -g root -o root -m 0755 -d $(SYSCONFDIR) 1.51 - install -g root -o root -m 0644 tazpkg.conf $(SYSCONFDIR) 1.52 + install -g root -o root -m 0755 -d $(DESTDIR)$(SYSCONFDIR) 1.53 + install -g root -o root -m 0644 tazpkg.conf $(DESTDIR)$(SYSCONFDIR) 1.54 @echo "Installing documentation files..." 1.55 - install -g root -o root -m 0755 -d $(DOCDIR)/tazpkg 1.56 - install -g root -o root -m 0644 doc/* $(DOCDIR)/tazpkg 1.57 + install -g root -o root -m 0755 -d $(DESTDIR)$(DOCDIR)/tazpkg 1.58 + install -g root -o root -m 0644 doc/* $(DESTDIR)$(DOCDIR)/tazpkg 1.59 + # i18n 1.60 + mkdir -p $(DESTDIR)$(PREFIX)/share/locale 1.61 + cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale 1.62 + # Desktop integration 1.63 + @echo "Setting up desktop integration..." 1.64 + mkdir -p $(DESTDIR)$(PREFIX)/share 1.65 + cp -a applications $(DESTDIR)$(PREFIX)/share 1.66 + 1.67 +# Uninstallation and clean-up commands. 1.68 1.69 uninstall: 1.70 - rm -f $(PREFIX)/bin/tazpkg 1.71 - rm -f $(PREFIX)/bin/tazpkgbox 1.72 - rm -f $(LIBDIR)/tazpkgbox 1.73 - rm -rf $(DOCDIR)/tazpkg 1.74 + rm -f $(DESTDIR)$(PREFIX)/bin/tazpkg 1.75 + rm -f $(DESTDIR)$(PREFIX)/bin/tazpkgbox 1.76 + rm -rf $(DESTDIR)$(LIBDIR)/tazpkgbox 1.77 + rm -rf $(DESTDIR)$(DOCDIR)/tazpkg 1.78 + rm -f $(DESTDIR)$(SYSCONFDIR)/tazpkg.conf 1.79 + rm -rf $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/tazpkg*.mo 1.80 1.81 +clean: 1.82 + rm -rf _pkg 1.83 + rm -rf po/mo 1.84 +
2.1 --- a/README Tue May 25 12:16:59 2010 +0200 2.2 +++ b/README Sun Jun 20 11:52:56 2010 +0200 2.3 @@ -1,50 +1,48 @@ 2.4 -README for Tazpkg - Tiny autonomus packages manager 2010 2.5 +README for Tazpkg - Tiny autonomus packages manager 2.6 =============================================================================== 2.7 2.8 2.9 -Tazpkg est un gestionnaire de paquets ultra léger (~35 Ko) permettant 2.10 -d'installer, lister, télécharger, enlever des paquets sur un système 2.11 -GNU/Linux. Tazpkg propose aussi une commande de recherche, pour générer une 2.12 -liste et des commandes pour la création de paquets. Il a été créé pour les 2.13 -besoins de SliTaz GNU/Linux, mini distribution autonome. Le format des paquets 2.14 -utilisent l'extension *.tazpkg, c'est une archive cpio contenant un système de 2.15 -fichiers (fs) compressés avec gzip, la recette et une éventuelle description. 2.16 -Tazpkg fournit aussi un système de gestion des dépendances basé sur les 2.17 -recettes des paquets. La recette contient toutes les informations au sujet du 2.18 -paquet, elle peu aussi contenir les fonctions de pre et post installation. 2.19 -Cette même recette est par ailleurs utilisée par Tazwok pour compiler les 2.20 -sources et créer un paquet tazpkg. 2.21 +Tazpkg is a small but powerfull packages manager for SliTaz GNU/Linux and 2.22 +other UNIX like operating system. It use tazpkg package generaly build by 2.23 +Tazwok with receipt found in the wok. More information can be found in the 2.24 +SliTaz Cookbook and the manual. 2.25 2.26 -Tazpkg est écrit en script shell depuis rien (from scratch), compatible 2.27 -Bash, et fonctionne avec Ash du projet Busybox. Tazpkg est distribué 2.28 -sous license libre GNU gpl v3. 2.29 +Tazpkg is entirely built from scratch using SHell script, compatible with 2.30 +Bash, it runs under Ash - part of the Busybox project. Tazpkg is distributed 2.31 +under the free GNU license GPL V3. 2.32 2.33 2.34 -Contenu de l'archive source 2.35 ---------------------------- 2.36 +Installation 2.37 +------------ 2.38 +To install all needed files and compile translated messages, make and gettext 2.39 +must be installed. Running 'make install' will install everything in /usr, but 2.40 +another path and/or destination can be specified via PREFIX and DESTDIR. 2.41 +Example: 2.42 2.43 - * tazpkg : c'est le script du gestionnaire de paquet, c'est le seul fichier 2.44 - à installer, mise à part la documentation optionnelle. 2.45 - * doc/ : La documentation contenant le manuel au format xHTML. 2.46 - * Les fichiers AUTHORS, ChangeLog, COPYING, gpl.txt et ce README. 2.47 + $ make DESTDIR=$PWD/_pkg install 2.48 2.49 +Uninstall 2.50 +--------- 2.51 +Simply type: 2.52 + 2.53 + $ make uninstall 2.54 2.55 -TESTING 2.56 -------- 2.57 +Translation 2.58 +----------- 2.59 +To start a new translation please use msginit from the pot file directory. 2.60 +Example for French/France locale (fr_FR): 2.61 2.62 - $ cd into/tazpkg-sources 2.63 - Test it : 2.64 - $ ./tazpkg usage 2.65 + $ msginit -l fr_FR -o fr.po -i tazpkg.pot 2.66 2.67 +To update all translations from the pot file: 2.68 2.69 -INSTALL 2.70 -------- 2.71 + $ make msgmerge 2.72 2.73 - # cd into/tazpkg-sources 2.74 - # make install 2.75 +To compile po files for testing purposes you can use 'make msgfmt' or manually 2.76 +compile your translation. Example for french locale, note that the file must be 2.77 +copied into /usr/share/locale/fr/LC_MESSAGES so gettext can find it: 2.78 2.79 -Uninstall : 2.80 - # make uninstall 2.81 + $ msgfmt -o tazpkg.mo fr.po 2.82 2.83 2.84 ===============================================================================
3.1 --- a/tazpkg Tue May 25 12:16:59 2010 +0200 3.2 +++ b/tazpkg Sun Jun 20 11:52:56 2010 +0200 3.3 @@ -5,7 +5,8 @@ 3.4 # SHell script. It works well with Busybox ash shell and bash. Tazpkg lets you 3.5 # list, install, remove, download or get information about a package. You can 3.6 # use 'tazpkg usage' to get a list of commands with short descriptions. Tazpkg 3.7 -# also resolves dependencies and can upgrade packages from a mirror. 3.8 +# also resolves dependencies and can upgrade packages from a mirror. I18n is 3.9 +# done with gettext: `gettext "displayed text"` 3.10 # 3.11 # (C) 2007-2010 SliTaz - GNU General Public License v3. 3.12 # 3.13 @@ -15,7 +16,7 @@ 3.14 # Paul Issott <paul@slitaz.org> 3.15 # Rohit Joshi <jozee@slitaz.org> 3.16 # 3.17 -VERSION=3.2.3 3.18 +VERSION=4.0 3.19 3.20 #################### 3.21 # Script variables # 3.22 @@ -23,6 +24,13 @@ 3.23 3.24 . /etc/slitaz/tazpkg.conf 3.25 3.26 +# Include gettext helper script. 3.27 +. /usr/bin/gettext.sh 3.28 + 3.29 +# Export package name for gettext. 3.30 +TEXTDOMAIN='tazpkg' 3.31 +export TEXTDOMAIN 3.32 + 3.33 # Initialize some variables to use words rather than numbers for functions 3.34 # and actions. 3.35 COMMAND=$1
4.1 --- a/tazpkgbox Tue May 25 12:16:59 2010 +0200 4.2 +++ b/tazpkgbox Sun Jun 20 11:52:56 2010 +0200 4.3 @@ -6,7 +6,7 @@ 4.4 # 4.5 # (C) GNU gpl v3 - SliTaz GNU/Linux 2010. 4.6 # 4.7 -VERSION=3.2.1 4.8 +VERSION=4.0 4.9 4.10 # Functions path. 4.11 export LIB=/usr/lib/slitaz/tazpkgbox 4.12 @@ -17,6 +17,13 @@ 4.13 exit 0 4.14 fi 4.15 4.16 +# Include gettext helper script. 4.17 +. /usr/bin/gettext.sh 4.18 + 4.19 +# Export package name for gettext. 4.20 +TEXTDOMAIN='tazpkgbox' 4.21 +export TEXTDOMAIN 4.22 + 4.23 # We need at least a mirror URL. 4.24 if [ ! -f /var/lib/tazpkg/mirror ]; then 4.25 tazpkg >/dev/null