diff --git a/Makefile b/Makefile index 4379478..65cb8ab 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) DOBJECTS = $(patsubst %.c, %.do, $(SOURCE)) all: options ${PROJECT} + $(MAKE) -C po options: @echo ${PROJECT} build options: @@ -60,6 +61,7 @@ clean: ${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \ *gcda *gcno $(PROJECT).info gcov $(QUIET)make -C tests clean + $(QUIET)make -C po clean ${PROJECT}-debug: ${DOBJECTS} $(ECHO) CC -o $@ @@ -89,12 +91,14 @@ test: ${OBJECTS} dist: clean $(QUIET)mkdir -p ${PROJECT}-${VERSION} $(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests + $(QUIET)mkdir -p ${PROJECT}-${VERSION}/po $(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \ ${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \ ${PROJECT}.desktop version.h.in database-*.c \ ${PROJECT}-${VERSION} $(QUIET)cp tests/Makefile tests/config.mk tests/*.c \ ${PROJECT}-${VERSION}/tests + $(QUIET)cp po/Makefile po/*.po ${PROJECT}-${VERSION}/po $(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION} $(QUIET)gzip ${PROJECT}-${VERSION}.tar $(QUIET)rm -rf ${PROJECT}-${VERSION} @@ -134,6 +138,7 @@ install: all ${PROJECT}.pc $(ECHO) installing pkgconfig file $(QUIET)mkdir -p ${DESTDIR}${PREFIX}/lib/pkgconfig $(QUIET)cp -f ${PROJECT}.pc ${DESTDIR}${PREFIX}/lib/pkgconfig + $(MAKE) -C po install uninstall: $(ECHO) removing executable file diff --git a/config.mk b/config.mk index ebd4f8f..7042acb 100644 --- a/config.mk +++ b/config.mk @@ -14,12 +14,12 @@ ZATHURA_GTK_VERSION ?= 2 PREFIX ?= /usr MANPREFIX ?= ${PREFIX}/share/man DESKTOPPREFIX ?= ${PREFIX}/share/applications -# list of : seperated values +# plugin directory PLUGINDIR ?= ${PREFIX}/lib/zathura +# locale directory +LOCALEDIR ?= ${PREFIX}/share/locale # libs - -# set this to 0 if you don't need to link against dl GTK_INC ?= $(shell pkg-config --cflags gtk+-${ZATHURA_GTK_VERSION}.0) GTK_LIB ?= $(shell pkg-config --libs gtk+-${ZATHURA_GTK_VERSION}.0 gthread-2.0) @@ -37,7 +37,7 @@ LIBS = ${GIRARA_LIB} ${GTK_LIB} ${DL_LIB} -lpthread -lm # flags CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS) -CPPFLAGS += -DZATHURA_PLUGINDIR=\"${PLUGINDIR}\" +CPPFLAGS += -DZATHURA_PLUGINDIR=\"${PLUGINDIR}\" -DGETTEXT_PACKAGE=\"${PROJECT}\" -DLOCALEDIR=\"${LOCALEDIR}\" # debug DFLAGS ?= -g diff --git a/main.c b/main.c index be57800..31d64c7 100644 --- a/main.c +++ b/main.c @@ -2,12 +2,18 @@ #include #include +#include #include "zathura.h" /* main function */ int main(int argc, char* argv[]) { + setlocale(LC_ALL, ""); + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); + g_thread_init(NULL); gdk_threads_init(); gtk_init(&argc, &argv); diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 0000000..f356070 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,2 @@ +POTFILES.in* +*.mo diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 0000000..fada635 --- /dev/null +++ b/po/Makefile @@ -0,0 +1,40 @@ +# See LICENSE file for license and copyright information + +PROJECT = zathura +CATALOGS = $(wildcard *.po) +MOS = $(patsubst %.po, %/LC_MESSAGES/${PROJECT}.mo, $(CATALOGS)) + +include ../config.mk +include ../common.mk + +all: ${MOS} + +clean: + rm -rf POTFILES.in POTFILES.in.tmp $(patsubst %.po, %, $(CATALOGS)) + +POTFILES.in: $(wildcard ../*.c) + $(QUIET) set -e && rm -f $@.tmp && touch $@.tmp && \ + for f in $(^F) ; do \ + echo $$f >> $@.tmp ; \ + done && \ + mv $@.tmp $@ + +${PROJECT}.pot: POTFILES.in + $(ECHO) regenerate ${PROJECT}.pot + $(QUIET)intltool-update --pot --gettext-package=${PROJECT} + +%.po: ${PROJECT}.pot + $(ECHO) updating language $(shell echo $@ | sed 's/\.po//') + $(QUIET)intltool-update --dist --gettext-package=${PROJECT} $(shell echo $@ | sed 's/\.po//') + +%/LC_MESSAGES/${PROJECT}.mo: %.po + @mkdir -p $(@D) + $(ECHO) msgfmt $(shell echo $< | sed 's/\.po//') + $(QUIET)msgfmt $< -o $@ -f + +install: ${MOS} + $(ECHO) installing translations + $(QUIET)set -e && for f in $^ ; do \ + mkdir -p $(DESTDIR)$(LOCALEDIR)/`dirname $$f`; \ + install -m 644 $$f $(DESTDIR)$(LOCALEDIR)/`dirname $$f` ; \ + done diff --git a/po/de_DE.po b/po/de_DE.po new file mode 100644 index 0000000..593a4d0 --- /dev/null +++ b/po/de_DE.po @@ -0,0 +1,38 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-03-04 18:29+0100\n" +"PO-Revision-Date: 2012-03-04 17:77+0100\n" +"Last-Translator: Sebastian Ramacher \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../zathura.c:52 +msgid "Reparents to window specified by xid" +msgstr "" + +#: ../zathura.c:53 +msgid "Path to the config directory" +msgstr "Pfad des Konfigurationsverzeichnisses" + +#: ../zathura.c:54 +msgid "Path to the data directory" +msgstr "" + +#: ../zathura.c:55 +msgid "Path to the directories containing plugins" +msgstr "" + +#: ../zathura.c:56 +msgid "Fork into the background" +msgstr "" diff --git a/po/zathura.pot b/po/zathura.pot new file mode 100644 index 0000000..ee8ef75 --- /dev/null +++ b/po/zathura.pot @@ -0,0 +1,38 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-03-04 18:29+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../zathura.c:52 +msgid "Reparents to window specified by xid" +msgstr "" + +#: ../zathura.c:53 +msgid "Path to the config directory" +msgstr "" + +#: ../zathura.c:54 +msgid "Path to the data directory" +msgstr "" + +#: ../zathura.c:55 +msgid "Path to the directories containing plugins" +msgstr "" + +#: ../zathura.c:56 +msgid "Fork into the background" +msgstr "" diff --git a/zathura.c b/zathura.c index cf6b29c..5334197 100644 --- a/zathura.c +++ b/zathura.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "bookmarks.h" #include "callbacks.h" @@ -48,11 +49,11 @@ zathura_init(int argc, char* argv[]) bool forkback = false; GOptionEntry entries[] = { - { "reparent", 'e', 0, G_OPTION_ARG_INT, &embed, "Reparents to window specified by xid", "xid" }, - { "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, "Path to the config directory", "path" }, - { "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, "Path to the data directory", "path" }, - { "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, "Path to the directories containing plugins", "path" }, - { "fork", '\0', 0, G_OPTION_ARG_NONE, &forkback, "Fork into the background" , NULL }, + { "reparent", 'e', 0, G_OPTION_ARG_INT, &embed, _("Reparents to window specified by xid"), "xid" }, + { "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, _("Path to the config directory"), "path" }, + { "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, _("Path to the data directory"), "path" }, + { "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, _("Path to the directories containing plugins"), "path" }, + { "fork", '\0', 0, G_OPTION_ARG_NONE, &forkback, _("Fork into the background") , NULL }, { NULL, '\0', 0, 0, NULL, NULL, NULL } };