# HG changeset patch # User Christophe Lincoln # Date 1277027576 -7200 # Node ID d6183a5cf8c47a45b6cca4010c27be0e0e5f2d38 # Parent 42d09a689803443d0d1f6bd2065a30f40f0e82a8 Prepare for i18n with gettext diff -r 42d09a689803 -r d6183a5cf8c4 Makefile --- a/Makefile Tue May 25 12:16:59 2010 +0200 +++ b/Makefile Sun Jun 20 11:52:56 2010 +0200 @@ -4,28 +4,64 @@ DOCDIR?=$(PREFIX)/share/doc LIBDIR?=$(PREFIX)/lib/slitaz SYSCONFDIR?=/etc/slitaz +DESTDIR?= +LINGUAS?=fr all: - grep "^VERSION=[0-9]" tazpkg | sed 's/VERSION=//' -install: - @echo "Installing Tazpkg into $(PREFIX)/bin..." - install -g root -o root -m 0755 -d $(PREFIX)/bin - install -g root -o root -m 0777 tazpkg $(PREFIX)/bin - install -g root -o root -m 0777 tazpkgbox $(PREFIX)/bin - @echo "Installing Tazpkgbox lib into $(LIBDIR)..." - install -g root -o root -m 0755 -d $(LIBDIR) - cp -a lib/tazpkgbox $(LIBDIR) +# i18n. + +pot: + xgettext -o po/tazpkg/tazpkg.pot -L Shell ./tazpkg + +msgmerge: + @for l in $(LINGUAS); do \ + echo -n "Updating $$l po file."; \ + msgmerge -U po/tazpkg/$$l.po po/tazpkg/tazpkg.pot ; \ + done; + +msgfmt: + @for l in $(LINGUAS); do \ + echo "Compiling $$l mo file..."; \ + mkdir -p po/mo/$$l/LC_MESSAGES; \ + msgfmt -o po/mo/$$l/LC_MESSAGES/tazpkg.mo po/tazpkg/$$l.po ; \ + done; + +# Installation. + +install: msgfmt + @echo "Installing Tazpkg..." + install -g root -o root -m 0755 -d $(DESTDIR)$(PREFIX)/bin + install -g root -o root -m 0777 tazpkg $(DESTDIR)$(PREFIX)/bin + install -g root -o root -m 0777 tazpkgbox $(DESTDIR)$(PREFIX)/bin + @echo "Installing Tazpkgbox libraries..." + install -g root -o root -m 0755 -d $(DESTDIR)$(LIBDIR) + cp -a lib/tazpkgbox $(DESTDIR)$(LIBDIR) @echo "Installing configuration files..." - install -g root -o root -m 0755 -d $(SYSCONFDIR) - install -g root -o root -m 0644 tazpkg.conf $(SYSCONFDIR) + install -g root -o root -m 0755 -d $(DESTDIR)$(SYSCONFDIR) + install -g root -o root -m 0644 tazpkg.conf $(DESTDIR)$(SYSCONFDIR) @echo "Installing documentation files..." - install -g root -o root -m 0755 -d $(DOCDIR)/tazpkg - install -g root -o root -m 0644 doc/* $(DOCDIR)/tazpkg + install -g root -o root -m 0755 -d $(DESTDIR)$(DOCDIR)/tazpkg + install -g root -o root -m 0644 doc/* $(DESTDIR)$(DOCDIR)/tazpkg + # i18n + mkdir -p $(DESTDIR)$(PREFIX)/share/locale + cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale + # Desktop integration + @echo "Setting up desktop integration..." + mkdir -p $(DESTDIR)$(PREFIX)/share + cp -a applications $(DESTDIR)$(PREFIX)/share + +# Uninstallation and clean-up commands. uninstall: - rm -f $(PREFIX)/bin/tazpkg - rm -f $(PREFIX)/bin/tazpkgbox - rm -f $(LIBDIR)/tazpkgbox - rm -rf $(DOCDIR)/tazpkg + rm -f $(DESTDIR)$(PREFIX)/bin/tazpkg + rm -f $(DESTDIR)$(PREFIX)/bin/tazpkgbox + rm -rf $(DESTDIR)$(LIBDIR)/tazpkgbox + rm -rf $(DESTDIR)$(DOCDIR)/tazpkg + rm -f $(DESTDIR)$(SYSCONFDIR)/tazpkg.conf + rm -rf $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/tazpkg*.mo +clean: + rm -rf _pkg + rm -rf po/mo + diff -r 42d09a689803 -r d6183a5cf8c4 README --- a/README Tue May 25 12:16:59 2010 +0200 +++ b/README Sun Jun 20 11:52:56 2010 +0200 @@ -1,50 +1,48 @@ -README for Tazpkg - Tiny autonomus packages manager 2010 +README for Tazpkg - Tiny autonomus packages manager =============================================================================== -Tazpkg est un gestionnaire de paquets ultra léger (~35 Ko) permettant -d'installer, lister, télécharger, enlever des paquets sur un système -GNU/Linux. Tazpkg propose aussi une commande de recherche, pour générer une -liste et des commandes pour la création de paquets. Il a été créé pour les -besoins de SliTaz GNU/Linux, mini distribution autonome. Le format des paquets -utilisent l'extension *.tazpkg, c'est une archive cpio contenant un système de -fichiers (fs) compressés avec gzip, la recette et une éventuelle description. -Tazpkg fournit aussi un système de gestion des dépendances basé sur les -recettes des paquets. La recette contient toutes les informations au sujet du -paquet, elle peu aussi contenir les fonctions de pre et post installation. -Cette même recette est par ailleurs utilisée par Tazwok pour compiler les -sources et créer un paquet tazpkg. +Tazpkg is a small but powerfull packages manager for SliTaz GNU/Linux and +other UNIX like operating system. It use tazpkg package generaly build by +Tazwok with receipt found in the wok. More information can be found in the +SliTaz Cookbook and the manual. -Tazpkg est écrit en script shell depuis rien (from scratch), compatible -Bash, et fonctionne avec Ash du projet Busybox. Tazpkg est distribué -sous license libre GNU gpl v3. +Tazpkg is entirely built from scratch using SHell script, compatible with +Bash, it runs under Ash - part of the Busybox project. Tazpkg is distributed +under the free GNU license GPL V3. -Contenu de l'archive source ---------------------------- +Installation +------------ +To install all needed files and compile translated messages, make and gettext +must be installed. Running 'make install' will install everything in /usr, but +another path and/or destination can be specified via PREFIX and DESTDIR. +Example: - * tazpkg : c'est le script du gestionnaire de paquet, c'est le seul fichier - à installer, mise à part la documentation optionnelle. - * doc/ : La documentation contenant le manuel au format xHTML. - * Les fichiers AUTHORS, ChangeLog, COPYING, gpl.txt et ce README. + $ make DESTDIR=$PWD/_pkg install +Uninstall +--------- +Simply type: + + $ make uninstall -TESTING -------- +Translation +----------- +To start a new translation please use msginit from the pot file directory. +Example for French/France locale (fr_FR): - $ cd into/tazpkg-sources - Test it : - $ ./tazpkg usage + $ msginit -l fr_FR -o fr.po -i tazpkg.pot +To update all translations from the pot file: -INSTALL -------- + $ make msgmerge - # cd into/tazpkg-sources - # make install +To compile po files for testing purposes you can use 'make msgfmt' or manually +compile your translation. Example for french locale, note that the file must be +copied into /usr/share/locale/fr/LC_MESSAGES so gettext can find it: -Uninstall : - # make uninstall + $ msgfmt -o tazpkg.mo fr.po =============================================================================== diff -r 42d09a689803 -r d6183a5cf8c4 tazpkg --- a/tazpkg Tue May 25 12:16:59 2010 +0200 +++ b/tazpkg Sun Jun 20 11:52:56 2010 +0200 @@ -5,7 +5,8 @@ # SHell script. It works well with Busybox ash shell and bash. Tazpkg lets you # list, install, remove, download or get information about a package. You can # use 'tazpkg usage' to get a list of commands with short descriptions. Tazpkg -# also resolves dependencies and can upgrade packages from a mirror. +# also resolves dependencies and can upgrade packages from a mirror. I18n is +# done with gettext: `gettext "displayed text"` # # (C) 2007-2010 SliTaz - GNU General Public License v3. # @@ -15,7 +16,7 @@ # Paul Issott # Rohit Joshi # -VERSION=3.2.3 +VERSION=4.0 #################### # Script variables # @@ -23,6 +24,13 @@ . /etc/slitaz/tazpkg.conf +# Include gettext helper script. +. /usr/bin/gettext.sh + +# Export package name for gettext. +TEXTDOMAIN='tazpkg' +export TEXTDOMAIN + # Initialize some variables to use words rather than numbers for functions # and actions. COMMAND=$1 diff -r 42d09a689803 -r d6183a5cf8c4 tazpkgbox --- a/tazpkgbox Tue May 25 12:16:59 2010 +0200 +++ b/tazpkgbox Sun Jun 20 11:52:56 2010 +0200 @@ -6,7 +6,7 @@ # # (C) GNU gpl v3 - SliTaz GNU/Linux 2010. # -VERSION=3.2.1 +VERSION=4.0 # Functions path. export LIB=/usr/lib/slitaz/tazpkgbox @@ -17,6 +17,13 @@ exit 0 fi +# Include gettext helper script. +. /usr/bin/gettext.sh + +# Export package name for gettext. +TEXTDOMAIN='tazpkgbox' +export TEXTDOMAIN + # We need at least a mirror URL. if [ ! -f /var/lib/tazpkg/mirror ]; then tazpkg >/dev/null