From 5dc5b2f9bb437e5192f73b21fd57110d4967ab97 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Thu, 26 Jul 2012 23:39:17 -0400 Subject: [PATCH] po: added gettext support to each opensync plugin, with string changes --- buildgen.sh | 4 +- opensync-plugin-0.4x/Makefile.am | 2 +- opensync-plugin-0.4x/buildgen.sh | 1 + opensync-plugin-0.4x/configure.ac | 5 + opensync-plugin-0.4x/po/ChangeLog | 12 + opensync-plugin-0.4x/po/LINGUAS | 4 + opensync-plugin-0.4x/po/Makevars | 44 ++++ opensync-plugin-0.4x/po/POTFILES.in | 8 + opensync-plugin-0.4x/po/README | 26 ++ opensync-plugin-0.4x/po/Rules-quot | 47 ++++ .../po/barry-opensync-plugin-0-4x.pot | 240 ++++++++++++++++++ opensync-plugin-0.4x/po/boldquot.sed | 10 + opensync-plugin-0.4x/po/en@boldquot.header | 25 ++ opensync-plugin-0.4x/po/en@quot.header | 22 ++ opensync-plugin-0.4x/po/es.po | 240 ++++++++++++++++++ opensync-plugin-0.4x/po/fr.po | 240 ++++++++++++++++++ opensync-plugin-0.4x/po/insert-header.sin | 23 ++ opensync-plugin-0.4x/po/quot.sed | 6 + opensync-plugin-0.4x/po/remove-potcdate.sin | 19 ++ opensync-plugin-0.4x/src/Makefile.am | 7 + opensync-plugin-0.4x/src/barry_sync.cc | 76 +++--- opensync-plugin-0.4x/src/environment.cc | 17 +- opensync-plugin-0.4x/src/gettext.h | 271 +++++++++++++++++++++ opensync-plugin-0.4x/src/i18n.h | 40 +++ opensync-plugin-0.4x/src/vcard.cc | 18 +- opensync-plugin-0.4x/src/vevent.cc | 18 +- opensync-plugin-0.4x/src/vjournal.cc | 18 +- opensync-plugin-0.4x/src/vtodo.cc | 18 +- opensync-plugin/Makefile.am | 2 +- opensync-plugin/buildgen.sh | 1 + opensync-plugin/configure.ac | 5 + opensync-plugin/po/ChangeLog | 12 + opensync-plugin/po/LINGUAS | 4 + opensync-plugin/po/Makevars | 44 ++++ opensync-plugin/po/POTFILES.in | 7 + opensync-plugin/po/README | 26 ++ opensync-plugin/po/Rules-quot | 47 ++++ opensync-plugin/po/barry-opensync-plugin.pot | 175 +++++++++++++ opensync-plugin/po/boldquot.sed | 10 + opensync-plugin/po/en@boldquot.header | 25 ++ opensync-plugin/po/en@quot.header | 22 ++ opensync-plugin/po/es.po | 175 +++++++++++++ opensync-plugin/po/fr.po | 175 +++++++++++++ opensync-plugin/po/insert-header.sin | 23 ++ opensync-plugin/po/quot.sed | 6 + opensync-plugin/po/remove-potcdate.sin | 19 ++ opensync-plugin/src/Makefile.am | 7 + opensync-plugin/src/barry_sync.cc | 54 ++-- opensync-plugin/src/environment.cc | 17 +- opensync-plugin/src/gettext.h | 271 +++++++++++++++++++++ opensync-plugin/src/i18n.h | 40 +++ opensync-plugin/src/vcard.cc | 18 +- opensync-plugin/src/vevent.cc | 18 +- po/POTFILES.in | 154 +++++++----- 54 files changed, 2631 insertions(+), 187 deletions(-) create mode 100644 opensync-plugin-0.4x/po/ChangeLog create mode 100644 opensync-plugin-0.4x/po/LINGUAS create mode 100644 opensync-plugin-0.4x/po/Makevars create mode 100644 opensync-plugin-0.4x/po/POTFILES.in create mode 100644 opensync-plugin-0.4x/po/README create mode 100644 opensync-plugin-0.4x/po/Rules-quot create mode 100644 opensync-plugin-0.4x/po/barry-opensync-plugin-0-4x.pot create mode 100644 opensync-plugin-0.4x/po/boldquot.sed create mode 100644 opensync-plugin-0.4x/po/en@boldquot.header create mode 100644 opensync-plugin-0.4x/po/en@quot.header create mode 100644 opensync-plugin-0.4x/po/es.po create mode 100644 opensync-plugin-0.4x/po/fr.po create mode 100644 opensync-plugin-0.4x/po/insert-header.sin create mode 100644 opensync-plugin-0.4x/po/quot.sed create mode 100644 opensync-plugin-0.4x/po/remove-potcdate.sin create mode 100644 opensync-plugin-0.4x/src/gettext.h create mode 100644 opensync-plugin-0.4x/src/i18n.h create mode 100644 opensync-plugin/po/ChangeLog create mode 100644 opensync-plugin/po/LINGUAS create mode 100644 opensync-plugin/po/Makevars create mode 100644 opensync-plugin/po/POTFILES.in create mode 100644 opensync-plugin/po/README create mode 100644 opensync-plugin/po/Rules-quot create mode 100644 opensync-plugin/po/barry-opensync-plugin.pot create mode 100644 opensync-plugin/po/boldquot.sed create mode 100644 opensync-plugin/po/en@boldquot.header create mode 100644 opensync-plugin/po/en@quot.header create mode 100644 opensync-plugin/po/es.po create mode 100644 opensync-plugin/po/fr.po create mode 100644 opensync-plugin/po/insert-header.sin create mode 100644 opensync-plugin/po/quot.sed create mode 100644 opensync-plugin/po/remove-potcdate.sin create mode 100644 opensync-plugin/src/gettext.h create mode 100644 opensync-plugin/src/i18n.h diff --git a/buildgen.sh b/buildgen.sh index b05aa0b4..0344ad6f 100755 --- a/buildgen.sh +++ b/buildgen.sh @@ -139,10 +139,12 @@ else #autoreconf -ifv --include=config # Autogenerate the gettext PO support files - # Do this for ./ and gui/ and desktop/ + # All submodules have PO support files now, so no difference autopoint (cd gui && autopoint) (cd desktop && autopoint) + (cd opensync-plugin && autopoint) + (cd opensync-plugin-0.4x && autopoint) # If we let autoreconf do this, it will run libtoolize after # creating some or all of the configure files. For example, diff --git a/opensync-plugin-0.4x/Makefile.am b/opensync-plugin-0.4x/Makefile.am index 28147329..19fa2d61 100644 --- a/opensync-plugin-0.4x/Makefile.am +++ b/opensync-plugin-0.4x/Makefile.am @@ -1,6 +1,6 @@ ACLOCAL_FLAGS = -I m4 -SUBDIRS = src +SUBDIRS = po . src EXTRA_DIST = \ buildgen.sh diff --git a/opensync-plugin-0.4x/buildgen.sh b/opensync-plugin-0.4x/buildgen.sh index 069e24b5..c1c11aaa 100755 --- a/opensync-plugin-0.4x/buildgen.sh +++ b/opensync-plugin-0.4x/buildgen.sh @@ -10,6 +10,7 @@ if [ "$1" = "clean" ] ; then config.sub \ configure depcomp install-sh ltmain.sh missing \ src/Makefile.in INSTALL \ + config.rpath \ config.h.in~ else autoreconf -if diff --git a/opensync-plugin-0.4x/configure.ac b/opensync-plugin-0.4x/configure.ac index c41310c3..7c1e0e8d 100644 --- a/opensync-plugin-0.4x/configure.ac +++ b/opensync-plugin-0.4x/configure.ac @@ -8,6 +8,10 @@ AC_CONFIG_AUX_DIR([.]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE(foreign) +AM_GNU_GETTEXT([external]) +# this is the verion of gettext, not barry +AM_GNU_GETTEXT_VERSION([0.18.1]) + AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_STDC @@ -48,6 +52,7 @@ AC_SUBST(OPENSYNC_HEADERDIR) ## Here are the headers that a user interface may n AC_OUTPUT([ Makefile +po/Makefile.in src/Makefile ]) diff --git a/opensync-plugin-0.4x/po/ChangeLog b/opensync-plugin-0.4x/po/ChangeLog new file mode 100644 index 00000000..5e8a606a --- /dev/null +++ b/opensync-plugin-0.4x/po/ChangeLog @@ -0,0 +1,12 @@ +2009-11-19 gettextize + + * Makefile.in.in: New file, from gettext-0.17. + * boldquot.sed: New file, from gettext-0.17. + * en@boldquot.header: New file, from gettext-0.17. + * en@quot.header: New file, from gettext-0.17. + * insert-header.sin: New file, from gettext-0.17. + * quot.sed: New file, from gettext-0.17. + * remove-potcdate.sin: New file, from gettext-0.17. + * Rules-quot: New file, from gettext-0.17. + * POTFILES.in: New file. + diff --git a/opensync-plugin-0.4x/po/LINGUAS b/opensync-plugin-0.4x/po/LINGUAS new file mode 100644 index 00000000..d76295fe --- /dev/null +++ b/opensync-plugin-0.4x/po/LINGUAS @@ -0,0 +1,4 @@ +# Set of available languages. +fr +es + diff --git a/opensync-plugin-0.4x/po/Makevars b/opensync-plugin-0.4x/po/Makevars new file mode 100644 index 00000000..3f2062f2 --- /dev/null +++ b/opensync-plugin-0.4x/po/Makevars @@ -0,0 +1,44 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Net Direct, Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +# +# See the "contact" page from the URL below: +MSGID_BUGS_ADDRESS = http://netdirect.ca/barry + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = + diff --git a/opensync-plugin-0.4x/po/POTFILES.in b/opensync-plugin-0.4x/po/POTFILES.in new file mode 100644 index 00000000..c9b8b82c --- /dev/null +++ b/opensync-plugin-0.4x/po/POTFILES.in @@ -0,0 +1,8 @@ +# List of source files which contain translatable strings. +src/barry_sync.cc +src/environment.cc +src/vcard.cc +src/vevent.cc +src/vjournal.cc +src/vtodo.cc + diff --git a/opensync-plugin-0.4x/po/README b/opensync-plugin-0.4x/po/README new file mode 100644 index 00000000..9ee88a2d --- /dev/null +++ b/opensync-plugin-0.4x/po/README @@ -0,0 +1,26 @@ +HOWTO to add a new language or update translation +================================================= + +To add a new language +--------------------- + +Sample to add spanish language + + $ cd /po + $ msginit --locale=es --input=barry.pot + $ echo "es" >> LINGUAS + $ make update-po + +Then, send to barry team your work. + +To update translation +--------------------- + +You have to only edit a ".po" file. + + $ cd /po + $ vi es.po + $ make update-po + +Then, send to barry team your work. + diff --git a/opensync-plugin-0.4x/po/Rules-quot b/opensync-plugin-0.4x/po/Rules-quot new file mode 100644 index 00000000..af524879 --- /dev/null +++ b/opensync-plugin-0.4x/po/Rules-quot @@ -0,0 +1,47 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/opensync-plugin-0.4x/po/barry-opensync-plugin-0-4x.pot b/opensync-plugin-0.4x/po/barry-opensync-plugin-0-4x.pot new file mode 100644 index 00000000..f238576f --- /dev/null +++ b/opensync-plugin-0.4x/po/barry-opensync-plugin-0-4x.pot @@ -0,0 +1,240 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Net Direct, Inc. +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: barry-opensync-plugin-0-4x 0.18.4\n" +"Report-Msgid-Bugs-To: http://netdirect.ca/barry\n" +"POT-Creation-Date: 2012-07-26 23:23-0400\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" + +#: src/barry_sync.cc:93 +msgid "Error converting string to unsigned long: " +msgstr "" + +#: src/barry_sync.cc:135 +msgid "GetChanges: slow sync request detected" +msgstr "" + +#: src/barry_sync.cc:139 +msgid "GetChanges: slow sync error: " +msgstr "" + +#: src/barry_sync.cc:178 +#, c-format +msgid "change record ID: %s" +msgstr "" + +#: src/barry_sync.cc:241 +msgid "Found deleted record ID in state map! " +msgstr "" + +#: src/barry_sync.cc:246 +msgid "found DELETE change" +msgstr "" + +#: src/barry_sync.cc:367 +msgid "vcard30 found in barry-sync" +msgstr "" + +#: src/barry_sync.cc:386 +msgid "contact initialize OK" +msgstr "" + +#: src/barry_sync.cc:573 +msgid "Unable to get config." +msgstr "" + +#: src/barry_sync.cc:616 +msgid "Process Ressource options..." +msgstr "" + +#: src/barry_sync.cc:622 +msgid "No sync Calendar" +msgstr "" + +#: src/barry_sync.cc:630 +msgid "No sync Contact" +msgstr "" + +#: src/barry_sync.cc:638 +msgid "No sync Journal" +msgstr "" + +#: src/barry_sync.cc:646 +msgid "No sync Todo" +msgstr "" + +#: src/barry_sync.cc:654 src/barry_sync.cc:726 +#, c-format +msgid "Unable to allocate memory for controller: %s" +msgstr "" + +#: src/barry_sync.cc:659 +#, c-format +msgid "exception: %s" +msgstr "" + +#: src/barry_sync.cc:707 +#, c-format +msgid "Unable to find PIN %x" +msgstr "" + +#: src/barry_sync.cc:711 +msgid "connecting..." +msgstr "" + +#: src/barry_sync.cc:715 +msgid "connected !" +msgstr "" + +#: src/barry_sync.cc:721 +msgid "connect success" +msgstr "" + +#: src/barry_sync.cc:840 +msgid "unable to get commit function pointer" +msgstr "" + +#: src/barry_sync.cc:848 +msgid "unable to get sync object that matches change type" +msgstr "" + +#: src/barry_sync.cc:855 +msgid "This object type is disabled in the barry-sync config" +msgstr "" + +#: src/barry_sync.cc:880 +#, c-format +msgid "uid from change: %s" +msgstr "" + +#: src/barry_sync.cc:887 src/barry_sync.cc:888 +#, c-format +msgid "Unable to extract a valid record ID from: %s" +msgstr "" + +#: src/barry_sync.cc:897 +#, c-format +msgid "unable to get state table index for RecordId: %lu" +msgstr "" + +#: src/barry_sync.cc:927 +#, c-format +msgid "CommitData() for ADDED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:940 +#, c-format +msgid "CommitData() for MODIFIED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:948 +msgid "Unknown change type" +msgstr "" + +#: src/barry_sync.cc:1117 +#, c-format +msgid "Barry OpenSync plugin v%s for the Blackberry handheld" +msgstr "" + +#: src/barry_sync.cc:1118 +msgid "" +"Plugin to synchronize note, task, calendar and contact entries on USB " +"Blackberry handhelds" +msgstr "" + +#: src/environment.cc:91 +msgid "Tried to use empty Connector" +msgstr "" + +#: src/environment.cc:165 +#, c-format +msgid "Clearing dirty flag for db %u, index %u" +msgstr "" + +#: src/environment.cc:202 +#, c-format +msgid "osync_change_get_objtype returns %s" +msgstr "" + +#: src/environment.cc:205 +msgid "return calendar object" +msgstr "" + +#: src/environment.cc:210 +msgid "return contact object" +msgstr "" + +#: src/environment.cc:215 +msgid "return journal object" +msgstr "" + +#: src/environment.cc:220 +msgid "return todo object" +msgstr "" + +#: src/environment.cc:225 +msgid "return none" +msgstr "" + +#: src/vcard.cc:73 src/vcard.cc:100 +#, c-format +msgid "ERROR: vcard:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vcard.cc:146 src/vevent.cc:164 src/vjournal.cc:151 src/vtodo.cc:152 +msgid "Can't use recommended recordId, generating new one." +msgstr "" + +#: src/vcard.cc:158 src/vevent.cc:176 src/vjournal.cc:163 src/vtodo.cc:164 +msgid "unable to parse change data for new RecordId: " +msgstr "" + +#: src/vcard.cc:161 src/vevent.cc:179 src/vjournal.cc:166 src/vtodo.cc:167 +msgid "data: " +msgstr "" + +#: src/vcard.cc:170 src/vevent.cc:202 src/vjournal.cc:175 src/vtodo.cc:176 +msgid "adding record" +msgstr "" + +#: src/vcard.cc:174 src/vevent.cc:206 src/vjournal.cc:179 +msgid "setting record" +msgstr "" + +#: src/vcard.cc:176 src/vevent.cc:208 src/vjournal.cc:181 +msgid "clearing dirty flag" +msgstr "" + +#: src/vevent.cc:78 src/vevent.cc:118 +#, c-format +msgid "ERROR: vevent:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vjournal.cc:77 src/vjournal.cc:105 +#, c-format +msgid "ERROR: vjournal:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vtodo.cc:78 src/vtodo.cc:106 +#, c-format +msgid "ERROR: vtodo:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vtodo.cc:201 +msgid "deleting task record" +msgstr "" + +#: src/vtodo.cc:203 +msgid "re-adding task record" +msgstr "" diff --git a/opensync-plugin-0.4x/po/boldquot.sed b/opensync-plugin-0.4x/po/boldquot.sed new file mode 100644 index 00000000..4b937aa5 --- /dev/null +++ b/opensync-plugin-0.4x/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff --git a/opensync-plugin-0.4x/po/en@boldquot.header b/opensync-plugin-0.4x/po/en@boldquot.header new file mode 100644 index 00000000..fedb6a06 --- /dev/null +++ b/opensync-plugin-0.4x/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/opensync-plugin-0.4x/po/en@quot.header b/opensync-plugin-0.4x/po/en@quot.header new file mode 100644 index 00000000..a9647fc3 --- /dev/null +++ b/opensync-plugin-0.4x/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/opensync-plugin-0.4x/po/es.po b/opensync-plugin-0.4x/po/es.po new file mode 100644 index 00000000..436c2a92 --- /dev/null +++ b/opensync-plugin-0.4x/po/es.po @@ -0,0 +1,240 @@ +# Spanish translations for barry-opensync-plugin-0-4x package. +# Copyright (C) 2012 Net Direct, Inc. +# This file is distributed under the same license as the barry-opensync-plugin-0-4x package. +# Chris Frey , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: barry-opensync-plugin-0-4x 0.18.4\n" +"Report-Msgid-Bugs-To: http://netdirect.ca/barry\n" +"POT-Creation-Date: 2012-07-26 23:23-0400\n" +"PO-Revision-Date: 2012-07-26 23:24-0400\n" +"Last-Translator: Chris Frey \n" +"Language-Team: Spanish\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/barry_sync.cc:93 +msgid "Error converting string to unsigned long: " +msgstr "" + +#: src/barry_sync.cc:135 +msgid "GetChanges: slow sync request detected" +msgstr "" + +#: src/barry_sync.cc:139 +msgid "GetChanges: slow sync error: " +msgstr "" + +#: src/barry_sync.cc:178 +#, c-format +msgid "change record ID: %s" +msgstr "" + +#: src/barry_sync.cc:241 +msgid "Found deleted record ID in state map! " +msgstr "" + +#: src/barry_sync.cc:246 +msgid "found DELETE change" +msgstr "" + +#: src/barry_sync.cc:367 +msgid "vcard30 found in barry-sync" +msgstr "" + +#: src/barry_sync.cc:386 +msgid "contact initialize OK" +msgstr "" + +#: src/barry_sync.cc:573 +msgid "Unable to get config." +msgstr "" + +#: src/barry_sync.cc:616 +msgid "Process Ressource options..." +msgstr "" + +#: src/barry_sync.cc:622 +msgid "No sync Calendar" +msgstr "" + +#: src/barry_sync.cc:630 +msgid "No sync Contact" +msgstr "" + +#: src/barry_sync.cc:638 +msgid "No sync Journal" +msgstr "" + +#: src/barry_sync.cc:646 +msgid "No sync Todo" +msgstr "" + +#: src/barry_sync.cc:654 src/barry_sync.cc:726 +#, c-format +msgid "Unable to allocate memory for controller: %s" +msgstr "" + +#: src/barry_sync.cc:659 +#, c-format +msgid "exception: %s" +msgstr "" + +#: src/barry_sync.cc:707 +#, c-format +msgid "Unable to find PIN %x" +msgstr "" + +#: src/barry_sync.cc:711 +msgid "connecting..." +msgstr "" + +#: src/barry_sync.cc:715 +msgid "connected !" +msgstr "" + +#: src/barry_sync.cc:721 +msgid "connect success" +msgstr "" + +#: src/barry_sync.cc:840 +msgid "unable to get commit function pointer" +msgstr "" + +#: src/barry_sync.cc:848 +msgid "unable to get sync object that matches change type" +msgstr "" + +#: src/barry_sync.cc:855 +msgid "This object type is disabled in the barry-sync config" +msgstr "" + +#: src/barry_sync.cc:880 +#, c-format +msgid "uid from change: %s" +msgstr "" + +#: src/barry_sync.cc:887 src/barry_sync.cc:888 +#, c-format +msgid "Unable to extract a valid record ID from: %s" +msgstr "" + +#: src/barry_sync.cc:897 +#, c-format +msgid "unable to get state table index for RecordId: %lu" +msgstr "" + +#: src/barry_sync.cc:927 +#, c-format +msgid "CommitData() for ADDED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:940 +#, c-format +msgid "CommitData() for MODIFIED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:948 +msgid "Unknown change type" +msgstr "" + +#: src/barry_sync.cc:1117 +#, c-format +msgid "Barry OpenSync plugin v%s for the Blackberry handheld" +msgstr "" + +#: src/barry_sync.cc:1118 +msgid "" +"Plugin to synchronize note, task, calendar and contact entries on USB " +"Blackberry handhelds" +msgstr "" + +#: src/environment.cc:91 +msgid "Tried to use empty Connector" +msgstr "" + +#: src/environment.cc:165 +#, c-format +msgid "Clearing dirty flag for db %u, index %u" +msgstr "" + +#: src/environment.cc:202 +#, c-format +msgid "osync_change_get_objtype returns %s" +msgstr "" + +#: src/environment.cc:205 +msgid "return calendar object" +msgstr "" + +#: src/environment.cc:210 +msgid "return contact object" +msgstr "" + +#: src/environment.cc:215 +msgid "return journal object" +msgstr "" + +#: src/environment.cc:220 +msgid "return todo object" +msgstr "" + +#: src/environment.cc:225 +msgid "return none" +msgstr "" + +#: src/vcard.cc:73 src/vcard.cc:100 +#, c-format +msgid "ERROR: vcard:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vcard.cc:146 src/vevent.cc:164 src/vjournal.cc:151 src/vtodo.cc:152 +msgid "Can't use recommended recordId, generating new one." +msgstr "" + +#: src/vcard.cc:158 src/vevent.cc:176 src/vjournal.cc:163 src/vtodo.cc:164 +msgid "unable to parse change data for new RecordId: " +msgstr "" + +#: src/vcard.cc:161 src/vevent.cc:179 src/vjournal.cc:166 src/vtodo.cc:167 +msgid "data: " +msgstr "" + +#: src/vcard.cc:170 src/vevent.cc:202 src/vjournal.cc:175 src/vtodo.cc:176 +msgid "adding record" +msgstr "" + +#: src/vcard.cc:174 src/vevent.cc:206 src/vjournal.cc:179 +msgid "setting record" +msgstr "" + +#: src/vcard.cc:176 src/vevent.cc:208 src/vjournal.cc:181 +msgid "clearing dirty flag" +msgstr "" + +#: src/vevent.cc:78 src/vevent.cc:118 +#, c-format +msgid "ERROR: vevent:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vjournal.cc:77 src/vjournal.cc:105 +#, c-format +msgid "ERROR: vjournal:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vtodo.cc:78 src/vtodo.cc:106 +#, c-format +msgid "ERROR: vtodo:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vtodo.cc:201 +msgid "deleting task record" +msgstr "" + +#: src/vtodo.cc:203 +msgid "re-adding task record" +msgstr "" diff --git a/opensync-plugin-0.4x/po/fr.po b/opensync-plugin-0.4x/po/fr.po new file mode 100644 index 00000000..256bbf16 --- /dev/null +++ b/opensync-plugin-0.4x/po/fr.po @@ -0,0 +1,240 @@ +# French translations for barry-opensync-plugin-0-4x package. +# Copyright (C) 2012 Net Direct, Inc. +# This file is distributed under the same license as the barry-opensync-plugin-0-4x package. +# Chris Frey , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: barry-opensync-plugin-0-4x 0.18.4\n" +"Report-Msgid-Bugs-To: http://netdirect.ca/barry\n" +"POT-Creation-Date: 2012-07-26 23:23-0400\n" +"PO-Revision-Date: 2012-07-26 23:23-0400\n" +"Last-Translator: Chris Frey \n" +"Language-Team: French\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: src/barry_sync.cc:93 +msgid "Error converting string to unsigned long: " +msgstr "" + +#: src/barry_sync.cc:135 +msgid "GetChanges: slow sync request detected" +msgstr "" + +#: src/barry_sync.cc:139 +msgid "GetChanges: slow sync error: " +msgstr "" + +#: src/barry_sync.cc:178 +#, c-format +msgid "change record ID: %s" +msgstr "" + +#: src/barry_sync.cc:241 +msgid "Found deleted record ID in state map! " +msgstr "" + +#: src/barry_sync.cc:246 +msgid "found DELETE change" +msgstr "" + +#: src/barry_sync.cc:367 +msgid "vcard30 found in barry-sync" +msgstr "" + +#: src/barry_sync.cc:386 +msgid "contact initialize OK" +msgstr "" + +#: src/barry_sync.cc:573 +msgid "Unable to get config." +msgstr "" + +#: src/barry_sync.cc:616 +msgid "Process Ressource options..." +msgstr "" + +#: src/barry_sync.cc:622 +msgid "No sync Calendar" +msgstr "" + +#: src/barry_sync.cc:630 +msgid "No sync Contact" +msgstr "" + +#: src/barry_sync.cc:638 +msgid "No sync Journal" +msgstr "" + +#: src/barry_sync.cc:646 +msgid "No sync Todo" +msgstr "" + +#: src/barry_sync.cc:654 src/barry_sync.cc:726 +#, c-format +msgid "Unable to allocate memory for controller: %s" +msgstr "" + +#: src/barry_sync.cc:659 +#, c-format +msgid "exception: %s" +msgstr "" + +#: src/barry_sync.cc:707 +#, c-format +msgid "Unable to find PIN %x" +msgstr "" + +#: src/barry_sync.cc:711 +msgid "connecting..." +msgstr "" + +#: src/barry_sync.cc:715 +msgid "connected !" +msgstr "" + +#: src/barry_sync.cc:721 +msgid "connect success" +msgstr "" + +#: src/barry_sync.cc:840 +msgid "unable to get commit function pointer" +msgstr "" + +#: src/barry_sync.cc:848 +msgid "unable to get sync object that matches change type" +msgstr "" + +#: src/barry_sync.cc:855 +msgid "This object type is disabled in the barry-sync config" +msgstr "" + +#: src/barry_sync.cc:880 +#, c-format +msgid "uid from change: %s" +msgstr "" + +#: src/barry_sync.cc:887 src/barry_sync.cc:888 +#, c-format +msgid "Unable to extract a valid record ID from: %s" +msgstr "" + +#: src/barry_sync.cc:897 +#, c-format +msgid "unable to get state table index for RecordId: %lu" +msgstr "" + +#: src/barry_sync.cc:927 +#, c-format +msgid "CommitData() for ADDED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:940 +#, c-format +msgid "CommitData() for MODIFIED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:948 +msgid "Unknown change type" +msgstr "" + +#: src/barry_sync.cc:1117 +#, c-format +msgid "Barry OpenSync plugin v%s for the Blackberry handheld" +msgstr "" + +#: src/barry_sync.cc:1118 +msgid "" +"Plugin to synchronize note, task, calendar and contact entries on USB " +"Blackberry handhelds" +msgstr "" + +#: src/environment.cc:91 +msgid "Tried to use empty Connector" +msgstr "" + +#: src/environment.cc:165 +#, c-format +msgid "Clearing dirty flag for db %u, index %u" +msgstr "" + +#: src/environment.cc:202 +#, c-format +msgid "osync_change_get_objtype returns %s" +msgstr "" + +#: src/environment.cc:205 +msgid "return calendar object" +msgstr "" + +#: src/environment.cc:210 +msgid "return contact object" +msgstr "" + +#: src/environment.cc:215 +msgid "return journal object" +msgstr "" + +#: src/environment.cc:220 +msgid "return todo object" +msgstr "" + +#: src/environment.cc:225 +msgid "return none" +msgstr "" + +#: src/vcard.cc:73 src/vcard.cc:100 +#, c-format +msgid "ERROR: vcard:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vcard.cc:146 src/vevent.cc:164 src/vjournal.cc:151 src/vtodo.cc:152 +msgid "Can't use recommended recordId, generating new one." +msgstr "" + +#: src/vcard.cc:158 src/vevent.cc:176 src/vjournal.cc:163 src/vtodo.cc:164 +msgid "unable to parse change data for new RecordId: " +msgstr "" + +#: src/vcard.cc:161 src/vevent.cc:179 src/vjournal.cc:166 src/vtodo.cc:167 +msgid "data: " +msgstr "" + +#: src/vcard.cc:170 src/vevent.cc:202 src/vjournal.cc:175 src/vtodo.cc:176 +msgid "adding record" +msgstr "" + +#: src/vcard.cc:174 src/vevent.cc:206 src/vjournal.cc:179 +msgid "setting record" +msgstr "" + +#: src/vcard.cc:176 src/vevent.cc:208 src/vjournal.cc:181 +msgid "clearing dirty flag" +msgstr "" + +#: src/vevent.cc:78 src/vevent.cc:118 +#, c-format +msgid "ERROR: vevent:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vjournal.cc:77 src/vjournal.cc:105 +#, c-format +msgid "ERROR: vjournal:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vtodo.cc:78 src/vtodo.cc:106 +#, c-format +msgid "ERROR: vtodo:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vtodo.cc:201 +msgid "deleting task record" +msgstr "" + +#: src/vtodo.cc:203 +msgid "re-adding task record" +msgstr "" diff --git a/opensync-plugin-0.4x/po/insert-header.sin b/opensync-plugin-0.4x/po/insert-header.sin new file mode 100644 index 00000000..b26de01f --- /dev/null +++ b/opensync-plugin-0.4x/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/opensync-plugin-0.4x/po/quot.sed b/opensync-plugin-0.4x/po/quot.sed new file mode 100644 index 00000000..0122c463 --- /dev/null +++ b/opensync-plugin-0.4x/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff --git a/opensync-plugin-0.4x/po/remove-potcdate.sin b/opensync-plugin-0.4x/po/remove-potcdate.sin new file mode 100644 index 00000000..2436c49e --- /dev/null +++ b/opensync-plugin-0.4x/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/opensync-plugin-0.4x/src/Makefile.am b/opensync-plugin-0.4x/src/Makefile.am index c860f6b0..f227e9f9 100644 --- a/opensync-plugin-0.4x/src/Makefile.am +++ b/opensync-plugin-0.4x/src/Makefile.am @@ -3,6 +3,11 @@ configdir=@OPENSYNC_CONFIGDIR@ #formatsdir=@OPENSYNC_FORMATSDIR@ opensyncheaderdir=@OPENSYNC_HEADERDIR@ +# To use gettext +datadir = @datadir@ +localedir = $(datadir)/locale +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ + INCLUDES = @TREE_BUILD_CXXFLAGS@ @GLIB2_CFLAGS@ @OPENSYNC4X_CFLAGS@ @BARRY_CFLAGS@ @BARRYSYNC_CFLAGS@ LIBS = @TREE_BUILD_LDFLAGS@ @GLIB2_LIBS@ @OPENSYNC4X_LIBS@ @BARRY_LIBS@ @BARRYSYNC_LIBS@ @@ -21,6 +26,8 @@ EXTRA_DIST = barry_sync.h dist_config_DATA = barry-sync +noinst_HEADERS = i18n.h gettext.h + opensyncheader_HEADER = barry_sync.h barry_sync_LTLIBRARIES = barry_sync.la diff --git a/opensync-plugin-0.4x/src/barry_sync.cc b/opensync-plugin-0.4x/src/barry_sync.cc index b3c01d9a..61715a81 100644 --- a/opensync-plugin-0.4x/src/barry_sync.cc +++ b/opensync-plugin-0.4x/src/barry_sync.cc @@ -42,6 +42,7 @@ #include #include #include +#include "i18n.h" typedef Barry::vSmartPtr AutoOSyncList; @@ -90,7 +91,7 @@ std::string GenerateHash(OSyncHashTable *hashtable, errno = 0; hashcount = strtoul(hash, NULL, 10); if( errno ) - throw std::runtime_error("Error converting string to unsigned long: " + std::string(hash)); + throw std::runtime_error(_("Error converting string to unsigned long: ") + std::string(hash)); } hashcount += (dirty ? 1 : 0); @@ -132,11 +133,11 @@ void GetChanges(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx // check if slow sync has been requested if (slow_sync) { - trace.log("GetChanges: slow sync request detected"); + trace.log(_("GetChanges: slow sync request detected")); if( !osync_hashtable_slowsync(hashtable, &error) ) { std::ostringstream oss; - oss << "GetChanges: slow sync error: " << osync_error_print(&error); + oss << _("GetChanges: slow sync error: ") << osync_error_print(&error); osync_error_unref(&error); trace.log(oss.str().c_str()); @@ -175,7 +176,7 @@ void GetChanges(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx // setup change, just enough for hashtable use osync_change_set_uid(change, uid.c_str()); - trace.logf("change record ID: %s", uid.c_str()); + trace.logf(_("change record ID: %s"), uid.c_str()); std::string hash = GenerateHash(hashtable, uid, state.Dirty); osync_change_set_hash(change, hash.c_str()); @@ -238,12 +239,12 @@ void GetChanges(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx for( ; i != table.StateMap.end(); ++i ) { if( i->second.RecordId == recordId ) { - throw std::runtime_error("Found deleted record ID in state map! " + std::string(uid)); + throw std::runtime_error(_("Found deleted record ID in state map! ") + std::string(uid)); } } // register a DELETE, no data - trace.log("found DELETE change"); + trace.log(_("found DELETE change")); OSyncChange *change = osync_change_new(&error); if( !change ) { @@ -364,7 +365,7 @@ static bool barry_contact_initialize(BarryEnvironment *env, OSyncPluginInfo *inf OSyncObjFormatSink *objformatsink = (OSyncObjFormatSink *) r->data; if(!strcmp("vcard30", osync_objformat_sink_get_objformat(objformatsink))) { - trace.log("vcard30 found in barry-sync"); + trace.log(_("vcard30 found in barry-sync")); hasObjFormat = true; break; } @@ -383,7 +384,7 @@ static bool barry_contact_initialize(BarryEnvironment *env, OSyncPluginInfo *inf osync_objtype_sink_enable_hashtable(sink, TRUE); - trace.log("contact initialize OK"); + trace.log(_("contact initialize OK")); return true; } @@ -570,7 +571,7 @@ static void *initialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError * OSyncPluginConfig *config = osync_plugin_info_get_config(info); if (!config) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to get config."); + osync_error_set(error, OSYNC_ERROR_GENERIC, _("Unable to get config.")); delete env; @@ -613,13 +614,13 @@ static void *initialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError * /* * Process Ressource options */ - trace.log("Process Ressource options..."); + trace.log(_("Process Ressource options...")); if (barry_calendar_initialize(env, info, error)) { env->m_CalendarSync.m_Sync = true; } else { - trace.log("No sync Calendar"); + trace.log(_("No sync Calendar")); env->m_CalendarSync.m_Sync = false; } @@ -627,7 +628,7 @@ static void *initialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError * env->m_ContactsSync.m_Sync = true; } else { - trace.log("No sync Contact"); + trace.log(_("No sync Contact")); env->m_ContactsSync.m_Sync = false; } @@ -635,7 +636,7 @@ static void *initialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError * env->m_JournalSync.m_Sync = true; } else { - trace.log("No sync Journal"); + trace.log(_("No sync Journal")); env->m_JournalSync.m_Sync = false; } @@ -643,7 +644,7 @@ static void *initialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError * env->m_TodoSync.m_Sync = true; } else { - trace.log("No sync Todo"); + trace.log(_("No sync Todo")); env->m_TodoSync.m_Sync = false; } @@ -651,12 +652,12 @@ static void *initialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError * } // Don't let exceptions escape to the C modules catch( std::bad_alloc &ba ) { - trace.logf("Unable to allocate memory for controller: %s", ba.what()); + trace.logf(_("Unable to allocate memory for controller: %s"), ba.what()); delete env; return NULL; } catch( std::exception &e ) { - trace.logf("exception: %s", e.what()); + trace.logf(_("exception: %s"), e.what()); delete env; return NULL; } @@ -704,26 +705,26 @@ static void connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext Barry::Probe probe; int nIndex = probe.FindActive(env->m_pin); if( nIndex == -1 ) { - osync_context_report_error(ctx, OSYNC_ERROR_NO_CONNECTION, "Unable to find PIN %x", env->m_pin); + osync_context_report_error(ctx, OSYNC_ERROR_NO_CONNECTION, _("Unable to find PIN %x"), env->m_pin); return; } - trace.log("connecting..."); + trace.log(_("connecting...")); env->Connect(probe.Get(nIndex)); - trace.log("connected !"); + trace.log(_("connected !")); } // Success! osync_context_report_success(ctx); - trace.log("connect success"); + trace.log(_("connect success")); } // Don't let exceptions escape to the C modules catch( std::bad_alloc &ba ) { osync_context_report_error(ctx, OSYNC_ERROR_NO_CONNECTION, - "Unable to allocate memory for controller: %s", ba.what()); + _("Unable to allocate memory for controller: %s"), ba.what()); } catch( std::exception &e ) { osync_context_report_error(ctx, OSYNC_ERROR_NO_CONNECTION, @@ -837,7 +838,7 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncCo CommitData_t CommitData = GetCommitFunction(change); if( !CommitData ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "unable to get commit function pointer"); + _("unable to get commit function pointer")); return; } @@ -845,14 +846,14 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncCo DatabaseSyncState *pSync = env->GetSyncObject(change); if( !pSync ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "unable to get sync object that matches change type"); + _("unable to get sync object that matches change type")); return; } // is syncing turned on for this type? if( !pSync->m_Sync ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "This object type is disabled in the barry-sync config"); + _("This object type is disabled in the barry-sync config")); return; } @@ -877,15 +878,15 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncCo else { // extract RecordId from change's UID, const char *uid = osync_change_get_uid(change); - trace.logf("uid from change: %s", uid); + trace.logf(_("uid from change: %s"), uid); // convert existing UID string to RecordId if( strlen(uid) == 0 || sscanf(uid, "%lu", &RecordId) != 1 || RecordId == 0) { - trace.logf("Unable to extract a valid record ID from: %s", uid); - osync_context_report_error(ctx, OSYNC_ERROR_IO_ERROR, "Unable to extract a valid record ID from: %s", uid); + trace.logf(_("Unable to extract a valid record ID from: %s"), uid); + osync_context_report_error(ctx, OSYNC_ERROR_IO_ERROR, _("Unable to extract a valid record ID from: %s"), uid); return; } @@ -894,7 +895,7 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncCo // modifying if( !table.GetIndex(RecordId, &StateIndex) ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "unable to get state table index for RecordId: %lu", + _("unable to get state table index for RecordId: %lu"), RecordId); return; } @@ -924,7 +925,7 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncCo status = (*CommitData)(env, dbId, StateIndex, RecordId, plain, true, errmsg); if( !status ) { - trace.logf("CommitData() for ADDED state returned false: %s", errmsg.c_str()); + trace.logf(_("CommitData() for ADDED state returned false: %s"), errmsg.c_str()); osync_context_report_error(ctx, OSYNC_ERROR_PARAMETER, "%s", errmsg.c_str()); return; } @@ -937,7 +938,7 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncCo status = (*CommitData)(env, dbId, StateIndex, RecordId, plain, false, errmsg); if( !status ) { - trace.logf("CommitData() for MODIFIED state returned false: %s", errmsg.c_str()); + trace.logf(_("CommitData() for MODIFIED state returned false: %s"), errmsg.c_str()); osync_context_report_error(ctx, OSYNC_ERROR_PARAMETER, "%s", errmsg.c_str()); return; } @@ -945,7 +946,7 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncCo break; default: - trace.log("Unknown change type"); + trace.log(_("Unknown change type")); break; } @@ -1096,6 +1097,15 @@ osync_bool get_sync_info(OSyncPluginEnv *env, OSyncError **error) { Trace trace("get_sync_info"); + static bool i18n_initialized = false; + if( !i18n_initialized ) { + // initialize i18n gettext directory + // the rest is done in i18n.h + bindtextdomain(PACKAGE, LOCALEDIR); + + i18n_initialized = true; + } + // Create a new OpenSync plugin OSyncPlugin *plugin = osync_plugin_new(error); if( !plugin ) { @@ -1105,8 +1115,8 @@ osync_bool get_sync_info(OSyncPluginEnv *env, OSyncError **error) // Describe our plugin osync_plugin_set_name(plugin, "barry-sync"); - osync_plugin_set_longname(plugin, "Barry OpenSync plugin v" PACKAGE_VERSION " for the Blackberry handheld"); - osync_plugin_set_description(plugin, "Plugin to synchronize note, task, calendar and contact entries on USB Blackberry handhelds"); + osync_plugin_set_longname(plugin, Barry::string_vprintf(_("Barry OpenSync plugin v%s for the Blackberry handheld"), PACKAGE_VERSION).c_str()); + osync_plugin_set_description(plugin, _("Plugin to synchronize note, task, calendar and contact entries on USB Blackberry handhelds")); // Set the callback functions osync_plugin_set_initialize_func(plugin, initialize); diff --git a/opensync-plugin-0.4x/src/environment.cc b/opensync-plugin-0.4x/src/environment.cc index b921a912..5f0f7a61 100644 --- a/opensync-plugin-0.4x/src/environment.cc +++ b/opensync-plugin-0.4x/src/environment.cc @@ -35,6 +35,7 @@ #include #include #include +#include "i18n.h" using namespace Barry; @@ -88,7 +89,7 @@ BarryEnvironment::~BarryEnvironment() void BarryEnvironment::DoConnect() { if( !m_con.get() ) - throw std::logic_error("Tried to use empty Connector"); + throw std::logic_error(_("Tried to use empty Connector")); m_con->Connect(); @@ -162,7 +163,7 @@ void BarryEnvironment::ClearDirtyFlags(Barry::RecordStateTable &table, Barry::RecordStateTable::StateMapType::const_iterator i = table.StateMap.begin(); for( ; i != table.StateMap.end(); ++i ) { if( i->second.Dirty ) { - trace.logf("Clearing dirty flag for db %u, index %u", + trace.logf(_("Clearing dirty flag for db %u, index %u"), dbId, i->first); m_con->GetDesktop().ClearDirty(dbId, i->first); } @@ -199,30 +200,30 @@ DatabaseSyncState* BarryEnvironment::GetSyncObject(OSyncChange *change) const char *name = osync_change_get_objtype(change); - trace.logf("osync_change_get_objtype returns %s", name); + trace.logf(_("osync_change_get_objtype returns %s"), name); if( strcmp(name, "event") == 0 ) { - trace.log("return calendar object"); + trace.log(_("return calendar object")); return &m_CalendarSync; } else if( strcmp(name, "contact") == 0 ) { - trace.log("return contact object"); + trace.log(_("return contact object")); return &m_ContactsSync; } else if( strcmp(name, "note") == 0 ) { - trace.log("return journal object"); + trace.log(_("return journal object")); return &m_JournalSync; } else if( strcmp(name, "todo") == 0 ) { - trace.log("return todo object"); + trace.log(_("return todo object")); return &m_TodoSync; } - trace.log("return none"); + trace.log(_("return none")); return 0; } diff --git a/opensync-plugin-0.4x/src/gettext.h b/opensync-plugin-0.4x/src/gettext.h new file mode 100644 index 00000000..209921e6 --- /dev/null +++ b/opensync-plugin-0.4x/src/gettext.h @@ -0,0 +1,271 @@ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc. + + 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 2, 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 + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by + the gettext() and ngettext() macros. This is an alternative to calling + textdomain(), and is useful for libraries. */ +# ifdef DEFAULT_TEXT_DOMAIN +# undef gettext +# define gettext(Msgid) \ + dgettext (DEFAULT_TEXT_DOMAIN, Msgid) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) +# endif + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include + , which chokes if dcgettext is defined as a macro. So include + it now, to make later inclusions of a NOP. */ +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 \ + ? ((void) (Msgid2), (const char *) (Msgid1)) \ + : ((void) (Msgid1), (const char *) (Msgid2))) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) \ + ((void) (Domainname), (const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) \ + ((void) (Domainname), (const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +/* The separator between msgctxt and msgid in a .mo file. */ +#define GETTEXT_CONTEXT_GLUE "\004" + +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a + MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be + short and rarely need to change. + The letter 'p' stands for 'particular' or 'special'. */ +#ifdef DEFAULT_TEXT_DOMAIN +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#else +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#endif +#define dpgettext(Domainname, Msgctxt, Msgid) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) +#ifdef DEFAULT_TEXT_DOMAIN +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#else +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#endif +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +pgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + int category) +{ + const char *translation = dcgettext (domain, msg_ctxt_id, category); + if (translation == msg_ctxt_id) + return msgid; + else + return translation; +} + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +npgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + const char *translation = + dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + if (translation == msg_ctxt_id || translation == msgid_plural) + return (n == 1 ? msgid : msgid_plural); + else + return translation; +} + +/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID + can be arbitrary expressions. But for string literals these macros are + less efficient than those above. */ + +#include + +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ + (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ + /* || __STDC_VERSION__ >= 199901L */ ) + +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS +#include +#endif + +#define pgettext_expr(Msgctxt, Msgid) \ + dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ + dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcgettext (domain, msg_ctxt_id, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (translation != msg_ctxt_id) + return translation; + } + return msgid; +} + +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcnpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (!(translation == msg_ctxt_id || translation == msgid_plural)) + return translation; + } + return (n == 1 ? msgid : msgid_plural); +} + +#endif /* _LIBGETTEXT_H */ diff --git a/opensync-plugin-0.4x/src/i18n.h b/opensync-plugin-0.4x/src/i18n.h new file mode 100644 index 00000000..4143655a --- /dev/null +++ b/opensync-plugin-0.4x/src/i18n.h @@ -0,0 +1,40 @@ +/// +/// \file i18n.h +/// Common internationalization defines, via gettext +/// NOTE! This is a private header, not to be installed! +/// + +/* + Copyright (C) 2009, Nicolas VIVIEN + Copyright (C) 2009-2012, Net Direct Inc. (http://www.netdirect.ca/) + + 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 2 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 in the COPYING file at the + root directory of this project for more details. +*/ + +#ifndef __BARRY_OSPLUGIN4X_I18N_H__ +#define __BARRY_OSPLUGIN4X_I18N_H__ + +#include +#include + +// Set the DEFAULT_TEXT_DOMAIN so that gettext.h uses dgettext() +// instead of gettext(). This way we don't have to call textdomain() +// and hope that nobody changes it on us later. +#define DEFAULT_TEXT_DOMAIN PACKAGE +#include "gettext.h" + +#define _(String) gettext (String) +#define N_(String) String + +#endif + diff --git a/opensync-plugin-0.4x/src/vcard.cc b/opensync-plugin-0.4x/src/vcard.cc index fbe81102..a8533bad 100644 --- a/opensync-plugin-0.4x/src/vcard.cc +++ b/opensync-plugin-0.4x/src/vcard.cc @@ -27,6 +27,7 @@ #include #include #include +#include "i18n.h" using namespace Barry::Sync; @@ -70,7 +71,7 @@ bool VCardConverter::ParseData(const char *data) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vcard:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vcard:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); return false; } @@ -97,7 +98,7 @@ void VCardConverter::operator()(const Barry::Contact &rec) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vcard:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vcard:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); } } @@ -143,7 +144,7 @@ bool VCardConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, newRecordId = recordId; } else { - trace.log("Can't use recommended recordId, generating new one."); + trace.log(_("Can't use recommended recordId, generating new one.")); newRecordId = env->m_ContactsSync.m_Table.MakeNewRecordId(); } } @@ -155,9 +156,10 @@ bool VCardConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, VCardConverter convert(newRecordId); if( !convert.ParseData(data) ) { std::ostringstream oss; - oss << "unable to parse change data for new RecordId: " + oss << _("unable to parse change data for new RecordId: ") << newRecordId - << " (" << convert.GetLastError() << ") data: " << data; + << " (" << convert.GetLastError() << ") " + << _("data: ") << data; errmsg = oss.str(); trace.log(errmsg.c_str()); return false; @@ -166,13 +168,13 @@ bool VCardConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, Barry::RecordBuilder builder(convert); if( add ) { - trace.log("adding record"); + trace.log(_("adding record")); env->GetDesktop()->AddRecord(dbId, builder); } else { - trace.log("setting record"); + trace.log(_("setting record")); env->GetDesktop()->SetRecord(dbId, StateIndex, builder); - trace.log("clearing dirty flag"); + trace.log(_("clearing dirty flag")); env->GetDesktop()->ClearDirty(dbId, StateIndex); } diff --git a/opensync-plugin-0.4x/src/vevent.cc b/opensync-plugin-0.4x/src/vevent.cc index eaa98601..5781ef16 100644 --- a/opensync-plugin-0.4x/src/vevent.cc +++ b/opensync-plugin-0.4x/src/vevent.cc @@ -31,6 +31,7 @@ #include #include #include +#include "i18n.h" using namespace Barry::Sync; @@ -75,7 +76,7 @@ bool VEventConverter::ParseData(const char *data) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vevent:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vevent:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); return false; } @@ -115,7 +116,7 @@ void VEventConverter::operator()(const Barry::Calendar &rec) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vevent:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vevent:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); } } @@ -161,7 +162,7 @@ bool VEventConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, newRecordId = recordId; } else { - trace.log("Can't use recommended recordId, generating new one."); + trace.log(_("Can't use recommended recordId, generating new one.")); newRecordId = env->m_CalendarSync.m_Table.MakeNewRecordId(); } } @@ -173,9 +174,10 @@ bool VEventConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, VEventConverter convert(newRecordId); if( !convert.ParseData(data) ) { std::ostringstream oss; - oss << "unable to parse change data for new RecordId: " + oss << _("unable to parse change data for new RecordId: ") << newRecordId - << " (" << convert.GetLastError() << ") data: " << data; + << " (" << convert.GetLastError() << ") " + << _("data: ") << data; errmsg = oss.str(); trace.log(errmsg.c_str()); return false; @@ -198,13 +200,13 @@ bool VEventConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, Barry::RecordBuilder builder(convert); if( add ) { - trace.log("adding record"); + trace.log(_("adding record")); env->GetDesktop()->AddRecord(dbId, builder); } else { - trace.log("setting record"); + trace.log(_("setting record")); env->GetDesktop()->SetRecord(dbId, StateIndex, builder); - trace.log("clearing dirty flag"); + trace.log(_("clearing dirty flag")); env->GetDesktop()->ClearDirty(dbId, StateIndex); } diff --git a/opensync-plugin-0.4x/src/vjournal.cc b/opensync-plugin-0.4x/src/vjournal.cc index eac8d701..ce9535b8 100644 --- a/opensync-plugin-0.4x/src/vjournal.cc +++ b/opensync-plugin-0.4x/src/vjournal.cc @@ -30,6 +30,7 @@ #include #include #include +#include "i18n.h" using namespace Barry::Sync; @@ -74,7 +75,7 @@ bool VJournalConverter::ParseData(const char *data) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vjournal:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vjournal:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); return false; } @@ -102,7 +103,7 @@ void VJournalConverter::operator()(const Barry::Memo &rec) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vjournal:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vjournal:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); } } @@ -148,7 +149,7 @@ bool VJournalConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbI newRecordId = recordId; } else { - trace.log("Can't use recommended recordId, generating new one."); + trace.log(_("Can't use recommended recordId, generating new one.")); newRecordId = env->m_JournalSync.m_Table.MakeNewRecordId(); } } @@ -160,9 +161,10 @@ bool VJournalConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbI VJournalConverter convert(newRecordId); if( !convert.ParseData(data) ) { std::ostringstream oss; - oss << "unable to parse change data for new RecordId: " + oss << _("unable to parse change data for new RecordId: ") << newRecordId - << " (" << convert.GetLastError() << ") data: " << data; + << " (" << convert.GetLastError() << ") " + << _("data: ") << data; errmsg = oss.str(); trace.log(errmsg.c_str()); return false; @@ -171,13 +173,13 @@ bool VJournalConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbI Barry::RecordBuilder builder(convert); if( add ) { - trace.log("adding record"); + trace.log(_("adding record")); env->GetDesktop()->AddRecord(dbId, builder); } else { - trace.log("setting record"); + trace.log(_("setting record")); env->GetDesktop()->SetRecord(dbId, StateIndex, builder); - trace.log("clearing dirty flag"); + trace.log(_("clearing dirty flag")); env->GetDesktop()->ClearDirty(dbId, StateIndex); } diff --git a/opensync-plugin-0.4x/src/vtodo.cc b/opensync-plugin-0.4x/src/vtodo.cc index 2f7c372c..d69c1de1 100644 --- a/opensync-plugin-0.4x/src/vtodo.cc +++ b/opensync-plugin-0.4x/src/vtodo.cc @@ -31,6 +31,7 @@ #include #include #include +#include "i18n.h" using namespace Barry::Sync; @@ -75,7 +76,7 @@ bool VTodoConverter::ParseData(const char *data) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vtodo:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vtodo:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); return false; } @@ -103,7 +104,7 @@ void VTodoConverter::operator()(const Barry::Task &rec) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vtodo:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vtodo:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); } } @@ -149,7 +150,7 @@ bool VTodoConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, newRecordId = recordId; } else { - trace.log("Can't use recommended recordId, generating new one."); + trace.log(_("Can't use recommended recordId, generating new one.")); newRecordId = env->m_TodoSync.m_Table.MakeNewRecordId(); } } @@ -161,9 +162,10 @@ bool VTodoConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, VTodoConverter convert(newRecordId); if( !convert.ParseData(data) ) { std::ostringstream oss; - oss << "unable to parse change data for new RecordId: " + oss << _("unable to parse change data for new RecordId: ") << newRecordId - << " (" << convert.GetLastError() << ") data: " << data; + << " (" << convert.GetLastError() << ") " + << _("data: ") << data; errmsg = oss.str(); trace.log(errmsg.c_str()); return false; @@ -172,7 +174,7 @@ bool VTodoConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, Barry::RecordBuilder builder(convert); if( add ) { - trace.log("adding record"); + trace.log(_("adding record")); env->GetDesktop()->AddRecord(dbId, builder); } else { @@ -197,9 +199,9 @@ bool VTodoConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, // dirty flag step, and leave it for FinishSync() in // barry_sync... :-) // - trace.log("deleting task record"); + trace.log(_("deleting task record")); env->GetDesktop()->DeleteRecord(dbId, StateIndex); - trace.log("re-adding task record"); + trace.log(_("re-adding task record")); env->GetDesktop()->AddRecord(dbId, builder); } diff --git a/opensync-plugin/Makefile.am b/opensync-plugin/Makefile.am index 3fd39678..dfae9c6e 100644 --- a/opensync-plugin/Makefile.am +++ b/opensync-plugin/Makefile.am @@ -1,6 +1,6 @@ ACLOCAL_FLAGS = -I m4 -SUBDIRS = src +SUBDIRS = po . src EXTRA_DIST = \ buildgen.sh \ diff --git a/opensync-plugin/buildgen.sh b/opensync-plugin/buildgen.sh index 069e24b5..c1c11aaa 100755 --- a/opensync-plugin/buildgen.sh +++ b/opensync-plugin/buildgen.sh @@ -10,6 +10,7 @@ if [ "$1" = "clean" ] ; then config.sub \ configure depcomp install-sh ltmain.sh missing \ src/Makefile.in INSTALL \ + config.rpath \ config.h.in~ else autoreconf -if diff --git a/opensync-plugin/configure.ac b/opensync-plugin/configure.ac index bd3dc545..4add94c6 100644 --- a/opensync-plugin/configure.ac +++ b/opensync-plugin/configure.ac @@ -8,6 +8,10 @@ AC_CONFIG_AUX_DIR([.]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE(foreign) +AM_GNU_GETTEXT([external]) +# this is the verion of gettext, not barry +AM_GNU_GETTEXT_VERSION([0.18.1]) + AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_STDC @@ -48,6 +52,7 @@ AC_SUBST(OPENSYNC_HEADERDIR) ## Here are the headers that a user interface may n AC_OUTPUT([ Makefile +po/Makefile.in src/Makefile ]) diff --git a/opensync-plugin/po/ChangeLog b/opensync-plugin/po/ChangeLog new file mode 100644 index 00000000..5e8a606a --- /dev/null +++ b/opensync-plugin/po/ChangeLog @@ -0,0 +1,12 @@ +2009-11-19 gettextize + + * Makefile.in.in: New file, from gettext-0.17. + * boldquot.sed: New file, from gettext-0.17. + * en@boldquot.header: New file, from gettext-0.17. + * en@quot.header: New file, from gettext-0.17. + * insert-header.sin: New file, from gettext-0.17. + * quot.sed: New file, from gettext-0.17. + * remove-potcdate.sin: New file, from gettext-0.17. + * Rules-quot: New file, from gettext-0.17. + * POTFILES.in: New file. + diff --git a/opensync-plugin/po/LINGUAS b/opensync-plugin/po/LINGUAS new file mode 100644 index 00000000..d76295fe --- /dev/null +++ b/opensync-plugin/po/LINGUAS @@ -0,0 +1,4 @@ +# Set of available languages. +fr +es + diff --git a/opensync-plugin/po/Makevars b/opensync-plugin/po/Makevars new file mode 100644 index 00000000..3f2062f2 --- /dev/null +++ b/opensync-plugin/po/Makevars @@ -0,0 +1,44 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Net Direct, Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +# +# See the "contact" page from the URL below: +MSGID_BUGS_ADDRESS = http://netdirect.ca/barry + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = + diff --git a/opensync-plugin/po/POTFILES.in b/opensync-plugin/po/POTFILES.in new file mode 100644 index 00000000..9c142bab --- /dev/null +++ b/opensync-plugin/po/POTFILES.in @@ -0,0 +1,7 @@ +# List of source files which contain translatable strings. +src/barry_sync.cc +src/environment.cc +src/idmap.cc +src/vcard.cc +src/vevent.cc + diff --git a/opensync-plugin/po/README b/opensync-plugin/po/README new file mode 100644 index 00000000..9ee88a2d --- /dev/null +++ b/opensync-plugin/po/README @@ -0,0 +1,26 @@ +HOWTO to add a new language or update translation +================================================= + +To add a new language +--------------------- + +Sample to add spanish language + + $ cd /po + $ msginit --locale=es --input=barry.pot + $ echo "es" >> LINGUAS + $ make update-po + +Then, send to barry team your work. + +To update translation +--------------------- + +You have to only edit a ".po" file. + + $ cd /po + $ vi es.po + $ make update-po + +Then, send to barry team your work. + diff --git a/opensync-plugin/po/Rules-quot b/opensync-plugin/po/Rules-quot new file mode 100644 index 00000000..af524879 --- /dev/null +++ b/opensync-plugin/po/Rules-quot @@ -0,0 +1,47 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/opensync-plugin/po/barry-opensync-plugin.pot b/opensync-plugin/po/barry-opensync-plugin.pot new file mode 100644 index 00000000..eae604a6 --- /dev/null +++ b/opensync-plugin/po/barry-opensync-plugin.pot @@ -0,0 +1,175 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Net Direct, Inc. +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: barry-opensync-plugin 0.18.4\n" +"Report-Msgid-Bugs-To: http://netdirect.ca/barry\n" +"POT-Creation-Date: 2012-07-26 23:21-0400\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" + +#: src/barry_sync.cc:75 +msgid "GetChanges: slow sync request detected, clearing cache and id map" +msgstr "" + +#: src/barry_sync.cc:102 +msgid "found an ADDED change" +msgstr "" + +#: src/barry_sync.cc:110 +msgid "found a MODIFIED change" +msgstr "" + +#: src/barry_sync.cc:115 +msgid "no change detected" +msgstr "" + +#: src/barry_sync.cc:125 +#, c-format +msgid "change record ID: %s" +msgstr "" + +#: src/barry_sync.cc:162 +msgid "found DELETE change" +msgstr "" + +#: src/barry_sync.cc:223 +msgid "Error saving calendar cache" +msgstr "" + +#: src/barry_sync.cc:231 +msgid "Error saving calendar id map" +msgstr "" + +#: src/barry_sync.cc:261 +#, c-format +msgid "Unable to get config data: %s" +msgstr "" + +#: src/barry_sync.cc:292 +#, c-format +msgid "Unable to allocate memory for environment: %s" +msgstr "" + +#: src/barry_sync.cc:318 +#, c-format +msgid "Unable to find PIN %lx" +msgstr "" + +#: src/barry_sync.cc:331 +#, c-format +msgid "Unable to allocate memory for controller: %s" +msgstr "" + +#: src/barry_sync.cc:384 +msgid "unable to get commit function pointer" +msgstr "" + +#: src/barry_sync.cc:392 +msgid "unable to get sync object that matches change type" +msgstr "" + +#: src/barry_sync.cc:399 +msgid "This object type is disabled in the barry-sync config" +msgstr "" + +#: src/barry_sync.cc:417 +msgid "uid from change object is blank!" +msgstr "" + +#: src/barry_sync.cc:428 +#, c-format +msgid "unable to get state table index for RecordId: %lu" +msgstr "" + +#: src/barry_sync.cc:449 +#, c-format +msgid "CommitData() for ADDED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:461 +#, c-format +msgid "CommitData() for MODIFIED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:469 src/barry_sync.cc:470 +msgid "Unknown change type" +msgstr "" + +#: src/environment.cc:146 +#, c-format +msgid "found existing uid in map: %lu" +msgstr "" + +#: src/environment.cc:157 +msgid "parsed uid already exists in map, skipping" +msgstr "" + +#: src/environment.cc:166 +#, c-format +msgid "made new record id: %lu" +msgstr "" + +#: src/environment.cc:191 +msgid "Tried to use empty Connector" +msgstr "" + +#: src/environment.cc:240 +#, c-format +msgid "Clearing dirty flag for db %u, index %u" +msgstr "" + +#: src/environment.cc:321 +msgid "calendar syncing enabled" +msgstr "" + +#: src/environment.cc:326 +msgid "contacts syncing enabled" +msgstr "" + +#: src/environment.cc:331 +msgid "using password from config file" +msgstr "" + +#: src/vcard.cc:74 src/vcard.cc:101 +#, c-format +msgid "ERROR: vcard:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vcard.cc:147 src/vevent.cc:161 +msgid "Can't use recommended recordId, generating new one." +msgstr "" + +#: src/vcard.cc:159 src/vevent.cc:173 +msgid "unable to parse change data for new RecordId: " +msgstr "" + +#: src/vcard.cc:162 src/vevent.cc:176 +msgid "data: " +msgstr "" + +#: src/vcard.cc:171 src/vevent.cc:200 +msgid "adding record" +msgstr "" + +#: src/vcard.cc:175 src/vevent.cc:204 +msgid "setting record" +msgstr "" + +#: src/vcard.cc:177 src/vevent.cc:206 +msgid "clearing dirty flag" +msgstr "" + +#: src/vevent.cc:74 src/vevent.cc:115 +#, c-format +msgid "ERROR: vevent:Barry::ConvertError exception: %s" +msgstr "" diff --git a/opensync-plugin/po/boldquot.sed b/opensync-plugin/po/boldquot.sed new file mode 100644 index 00000000..4b937aa5 --- /dev/null +++ b/opensync-plugin/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff --git a/opensync-plugin/po/en@boldquot.header b/opensync-plugin/po/en@boldquot.header new file mode 100644 index 00000000..fedb6a06 --- /dev/null +++ b/opensync-plugin/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/opensync-plugin/po/en@quot.header b/opensync-plugin/po/en@quot.header new file mode 100644 index 00000000..a9647fc3 --- /dev/null +++ b/opensync-plugin/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/opensync-plugin/po/es.po b/opensync-plugin/po/es.po new file mode 100644 index 00000000..b92c86cf --- /dev/null +++ b/opensync-plugin/po/es.po @@ -0,0 +1,175 @@ +# Spanish translations for barry-opensync-plugin package. +# Copyright (C) 2012 Net Direct, Inc. +# This file is distributed under the same license as the barry-opensync-plugin package. +# Chris Frey , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: barry-opensync-plugin 0.18.4\n" +"Report-Msgid-Bugs-To: http://netdirect.ca/barry\n" +"POT-Creation-Date: 2012-07-26 23:21-0400\n" +"PO-Revision-Date: 2012-07-26 23:22-0400\n" +"Last-Translator: Chris Frey \n" +"Language-Team: Spanish\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/barry_sync.cc:75 +msgid "GetChanges: slow sync request detected, clearing cache and id map" +msgstr "" + +#: src/barry_sync.cc:102 +msgid "found an ADDED change" +msgstr "" + +#: src/barry_sync.cc:110 +msgid "found a MODIFIED change" +msgstr "" + +#: src/barry_sync.cc:115 +msgid "no change detected" +msgstr "" + +#: src/barry_sync.cc:125 +#, c-format +msgid "change record ID: %s" +msgstr "" + +#: src/barry_sync.cc:162 +msgid "found DELETE change" +msgstr "" + +#: src/barry_sync.cc:223 +msgid "Error saving calendar cache" +msgstr "" + +#: src/barry_sync.cc:231 +msgid "Error saving calendar id map" +msgstr "" + +#: src/barry_sync.cc:261 +#, c-format +msgid "Unable to get config data: %s" +msgstr "" + +#: src/barry_sync.cc:292 +#, c-format +msgid "Unable to allocate memory for environment: %s" +msgstr "" + +#: src/barry_sync.cc:318 +#, c-format +msgid "Unable to find PIN %lx" +msgstr "" + +#: src/barry_sync.cc:331 +#, c-format +msgid "Unable to allocate memory for controller: %s" +msgstr "" + +#: src/barry_sync.cc:384 +msgid "unable to get commit function pointer" +msgstr "" + +#: src/barry_sync.cc:392 +msgid "unable to get sync object that matches change type" +msgstr "" + +#: src/barry_sync.cc:399 +msgid "This object type is disabled in the barry-sync config" +msgstr "" + +#: src/barry_sync.cc:417 +msgid "uid from change object is blank!" +msgstr "" + +#: src/barry_sync.cc:428 +#, c-format +msgid "unable to get state table index for RecordId: %lu" +msgstr "" + +#: src/barry_sync.cc:449 +#, c-format +msgid "CommitData() for ADDED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:461 +#, c-format +msgid "CommitData() for MODIFIED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:469 src/barry_sync.cc:470 +msgid "Unknown change type" +msgstr "" + +#: src/environment.cc:146 +#, c-format +msgid "found existing uid in map: %lu" +msgstr "" + +#: src/environment.cc:157 +msgid "parsed uid already exists in map, skipping" +msgstr "" + +#: src/environment.cc:166 +#, c-format +msgid "made new record id: %lu" +msgstr "" + +#: src/environment.cc:191 +msgid "Tried to use empty Connector" +msgstr "" + +#: src/environment.cc:240 +#, c-format +msgid "Clearing dirty flag for db %u, index %u" +msgstr "" + +#: src/environment.cc:321 +msgid "calendar syncing enabled" +msgstr "" + +#: src/environment.cc:326 +msgid "contacts syncing enabled" +msgstr "" + +#: src/environment.cc:331 +msgid "using password from config file" +msgstr "" + +#: src/vcard.cc:74 src/vcard.cc:101 +#, c-format +msgid "ERROR: vcard:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vcard.cc:147 src/vevent.cc:161 +msgid "Can't use recommended recordId, generating new one." +msgstr "" + +#: src/vcard.cc:159 src/vevent.cc:173 +msgid "unable to parse change data for new RecordId: " +msgstr "" + +#: src/vcard.cc:162 src/vevent.cc:176 +msgid "data: " +msgstr "" + +#: src/vcard.cc:171 src/vevent.cc:200 +msgid "adding record" +msgstr "" + +#: src/vcard.cc:175 src/vevent.cc:204 +msgid "setting record" +msgstr "" + +#: src/vcard.cc:177 src/vevent.cc:206 +msgid "clearing dirty flag" +msgstr "" + +#: src/vevent.cc:74 src/vevent.cc:115 +#, c-format +msgid "ERROR: vevent:Barry::ConvertError exception: %s" +msgstr "" diff --git a/opensync-plugin/po/fr.po b/opensync-plugin/po/fr.po new file mode 100644 index 00000000..3170ca55 --- /dev/null +++ b/opensync-plugin/po/fr.po @@ -0,0 +1,175 @@ +# French translations for barry-opensync-plugin package. +# Copyright (C) 2012 Net Direct, Inc. +# This file is distributed under the same license as the barry-opensync-plugin package. +# Chris Frey , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: barry-opensync-plugin 0.18.4\n" +"Report-Msgid-Bugs-To: http://netdirect.ca/barry\n" +"POT-Creation-Date: 2012-07-26 23:21-0400\n" +"PO-Revision-Date: 2012-07-26 23:23-0400\n" +"Last-Translator: Chris Frey \n" +"Language-Team: French\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: src/barry_sync.cc:75 +msgid "GetChanges: slow sync request detected, clearing cache and id map" +msgstr "" + +#: src/barry_sync.cc:102 +msgid "found an ADDED change" +msgstr "" + +#: src/barry_sync.cc:110 +msgid "found a MODIFIED change" +msgstr "" + +#: src/barry_sync.cc:115 +msgid "no change detected" +msgstr "" + +#: src/barry_sync.cc:125 +#, c-format +msgid "change record ID: %s" +msgstr "" + +#: src/barry_sync.cc:162 +msgid "found DELETE change" +msgstr "" + +#: src/barry_sync.cc:223 +msgid "Error saving calendar cache" +msgstr "" + +#: src/barry_sync.cc:231 +msgid "Error saving calendar id map" +msgstr "" + +#: src/barry_sync.cc:261 +#, c-format +msgid "Unable to get config data: %s" +msgstr "" + +#: src/barry_sync.cc:292 +#, c-format +msgid "Unable to allocate memory for environment: %s" +msgstr "" + +#: src/barry_sync.cc:318 +#, c-format +msgid "Unable to find PIN %lx" +msgstr "" + +#: src/barry_sync.cc:331 +#, c-format +msgid "Unable to allocate memory for controller: %s" +msgstr "" + +#: src/barry_sync.cc:384 +msgid "unable to get commit function pointer" +msgstr "" + +#: src/barry_sync.cc:392 +msgid "unable to get sync object that matches change type" +msgstr "" + +#: src/barry_sync.cc:399 +msgid "This object type is disabled in the barry-sync config" +msgstr "" + +#: src/barry_sync.cc:417 +msgid "uid from change object is blank!" +msgstr "" + +#: src/barry_sync.cc:428 +#, c-format +msgid "unable to get state table index for RecordId: %lu" +msgstr "" + +#: src/barry_sync.cc:449 +#, c-format +msgid "CommitData() for ADDED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:461 +#, c-format +msgid "CommitData() for MODIFIED state returned false: %s" +msgstr "" + +#: src/barry_sync.cc:469 src/barry_sync.cc:470 +msgid "Unknown change type" +msgstr "" + +#: src/environment.cc:146 +#, c-format +msgid "found existing uid in map: %lu" +msgstr "" + +#: src/environment.cc:157 +msgid "parsed uid already exists in map, skipping" +msgstr "" + +#: src/environment.cc:166 +#, c-format +msgid "made new record id: %lu" +msgstr "" + +#: src/environment.cc:191 +msgid "Tried to use empty Connector" +msgstr "" + +#: src/environment.cc:240 +#, c-format +msgid "Clearing dirty flag for db %u, index %u" +msgstr "" + +#: src/environment.cc:321 +msgid "calendar syncing enabled" +msgstr "" + +#: src/environment.cc:326 +msgid "contacts syncing enabled" +msgstr "" + +#: src/environment.cc:331 +msgid "using password from config file" +msgstr "" + +#: src/vcard.cc:74 src/vcard.cc:101 +#, c-format +msgid "ERROR: vcard:Barry::ConvertError exception: %s" +msgstr "" + +#: src/vcard.cc:147 src/vevent.cc:161 +msgid "Can't use recommended recordId, generating new one." +msgstr "" + +#: src/vcard.cc:159 src/vevent.cc:173 +msgid "unable to parse change data for new RecordId: " +msgstr "" + +#: src/vcard.cc:162 src/vevent.cc:176 +msgid "data: " +msgstr "" + +#: src/vcard.cc:171 src/vevent.cc:200 +msgid "adding record" +msgstr "" + +#: src/vcard.cc:175 src/vevent.cc:204 +msgid "setting record" +msgstr "" + +#: src/vcard.cc:177 src/vevent.cc:206 +msgid "clearing dirty flag" +msgstr "" + +#: src/vevent.cc:74 src/vevent.cc:115 +#, c-format +msgid "ERROR: vevent:Barry::ConvertError exception: %s" +msgstr "" diff --git a/opensync-plugin/po/insert-header.sin b/opensync-plugin/po/insert-header.sin new file mode 100644 index 00000000..b26de01f --- /dev/null +++ b/opensync-plugin/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/opensync-plugin/po/quot.sed b/opensync-plugin/po/quot.sed new file mode 100644 index 00000000..0122c463 --- /dev/null +++ b/opensync-plugin/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff --git a/opensync-plugin/po/remove-potcdate.sin b/opensync-plugin/po/remove-potcdate.sin new file mode 100644 index 00000000..2436c49e --- /dev/null +++ b/opensync-plugin/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/opensync-plugin/src/Makefile.am b/opensync-plugin/src/Makefile.am index 444af64d..285b1be6 100644 --- a/opensync-plugin/src/Makefile.am +++ b/opensync-plugin/src/Makefile.am @@ -3,6 +3,11 @@ configdir=@OPENSYNC_CONFIGDIR@ #formatsdir=@OPENSYNC_FORMATSDIR@ opensyncheaderdir=@OPENSYNC_HEADERDIR@ +# To use gettext +datadir = @datadir@ +localedir = $(datadir)/locale +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ + INCLUDES = @TREE_BUILD_CXXFLAGS@ @GLIB2_CFLAGS@ @OPENSYNC2X_CFLAGS@ @BARRY_CFLAGS@ @BARRYSYNC_CFLAGS@ LIBS = @TREE_BUILD_LDFLAGS@ @GLIB2_LIBS@ @OPENSYNC2X_LIBS@ @BARRY_LIBS@ @BARRYSYNC_LIBS@ @@ -21,6 +26,8 @@ EXTRA_DIST = barry_sync.h dist_config_DATA = barry-sync +noinst_HEADERS = i18n.h gettext.h + opensyncheader_HEADER = barry_sync.h barry_sync_LTLIBRARIES = barry_sync.la diff --git a/opensync-plugin/src/barry_sync.cc b/opensync-plugin/src/barry_sync.cc index dda3bf8e..622448d5 100644 --- a/opensync-plugin/src/barry_sync.cc +++ b/opensync-plugin/src/barry_sync.cc @@ -28,6 +28,7 @@ #include "vcard.h" #include "trace.h" #include "config.h" +#include "i18n.h" #include #include #include @@ -72,7 +73,7 @@ void GetChanges(OSyncContext *ctx, BarryEnvironment *env, // check if slow sync has been requested, and if so, empty the // cache and id map and start fresh if( osync_member_get_slow_sync(env->member, ObjTypeName) ) { - trace.log("GetChanges: slow sync request detected, clearing cache and id map"); + trace.log(_("GetChanges: slow sync request detected, clearing cache and id map")); cache.clear(); map.clear(); } @@ -99,7 +100,7 @@ void GetChanges(OSyncContext *ctx, BarryEnvironment *env, DatabaseSyncState::cache_type::const_iterator c = cache.find(state.RecordId); if( c == cache.end() ) { // not in cache, this is a new item - trace.log("found an ADDED change"); + trace.log(_("found an ADDED change")); change = osync_change_new(); osync_change_set_changetype(change, CHANGE_ADDED); } @@ -107,12 +108,12 @@ void GetChanges(OSyncContext *ctx, BarryEnvironment *env, // in the cache... dirty? if( state.Dirty ) { // modified - trace.log("found a MODIFIED change"); + trace.log(_("found a MODIFIED change")); change = osync_change_new(); osync_change_set_changetype(change, CHANGE_MODIFIED); } else { - trace.log("no change detected"); + trace.log(_("no change detected")); } } @@ -122,7 +123,7 @@ void GetChanges(OSyncContext *ctx, BarryEnvironment *env, osync_change_set_objformat_string(change, FormatName); osync_change_set_uid(change, uid.c_str()); - trace.logf("change record ID: %s", uid.c_str()); + trace.logf(_("change record ID: %s"), uid.c_str()); // Now you can set the data for the object // Set the last argument to FALSE if the real data @@ -159,7 +160,7 @@ void GetChanges(OSyncContext *ctx, BarryEnvironment *env, // check if not found... if( i == table.StateMap.end() ) { // register a DELETE, no data - trace.log("found DELETE change"); + trace.log(_("found DELETE change")); OSyncChange *change = osync_change_new(); osync_change_set_changetype(change, CHANGE_DELETED); @@ -220,7 +221,7 @@ bool FinishSync(OSyncContext *ctx, BarryEnvironment *env, DatabaseSyncState *pSy // update the cache if( !pSync->SaveCache() ) { osync_context_report_error(ctx, OSYNC_ERROR_IO_ERROR, - "Error saving calendar cache"); + _("Error saving calendar cache")); return false; } @@ -228,7 +229,7 @@ bool FinishSync(OSyncContext *ctx, BarryEnvironment *env, DatabaseSyncState *pSy pSync->CleanupMap(); if( !pSync->SaveMap() ) { osync_context_report_error(ctx, OSYNC_ERROR_IO_ERROR, - "Error saving calendar id map"); + _("Error saving calendar id map")); return false; } @@ -258,7 +259,7 @@ static void *initialize(OSyncMember *member, OSyncError **error) char *configdata; int configsize; if (!osync_member_get_config(member, &configdata, &configsize, error)) { - osync_error_update(error, "Unable to get config data: %s", + osync_error_update(error, _("Unable to get config data: %s"), osync_error_print(error)); delete env; return NULL; @@ -289,7 +290,7 @@ static void *initialize(OSyncMember *member, OSyncError **error) } // Don't let C++ exceptions escape to the C code catch( std::bad_alloc &ba ) { - osync_error_update(error, "Unable to allocate memory for environment: %s", ba.what()); + osync_error_update(error, _("Unable to allocate memory for environment: %s"), ba.what()); delete env; return NULL; } @@ -315,7 +316,7 @@ static void connect(OSyncContext *ctx) Barry::Probe probe; int nIndex = probe.FindActive(env->m_pin); if( nIndex == -1 ) { - osync_context_report_error(ctx, OSYNC_ERROR_NO_CONNECTION, "Unable to find PIN %lx", env->m_pin); + osync_context_report_error(ctx, OSYNC_ERROR_NO_CONNECTION, _("Unable to find PIN %lx"), env->m_pin); return; } @@ -328,7 +329,7 @@ static void connect(OSyncContext *ctx) // Don't let exceptions escape to the C modules catch( std::bad_alloc &ba ) { osync_context_report_error(ctx, OSYNC_ERROR_INITIALIZATION, - "Unable to allocate memory for controller: %s", ba.what()); + _("Unable to allocate memory for controller: %s"), ba.what()); } catch( std::exception &e ) { osync_context_report_error(ctx, OSYNC_ERROR_INITIALIZATION, @@ -381,7 +382,7 @@ static osync_bool commit_change(OSyncContext *ctx, OSyncChange *change) CommitData_t CommitData = GetCommitFunction(change); if( !CommitData ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "unable to get commit function pointer"); + _("unable to get commit function pointer")); return false; } @@ -389,14 +390,14 @@ static osync_bool commit_change(OSyncContext *ctx, OSyncChange *change) DatabaseSyncState *pSync = env->GetSyncObject(change); if( !pSync ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "unable to get sync object that matches change type"); + _("unable to get sync object that matches change type")); return false; } // is syncing turned on for this type? if( !pSync->m_Sync ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "This object type is disabled in the barry-sync config"); + _("This object type is disabled in the barry-sync config")); return false; } @@ -414,7 +415,7 @@ static osync_bool commit_change(OSyncContext *ctx, OSyncChange *change) trace.logf("uid from change: %s", uid); if( strlen(uid) == 0 ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "uid from change object is blank!"); + _("uid from change object is blank!")); } unsigned long RecordId = pSync->GetMappedRecordId(uid); @@ -425,7 +426,7 @@ static osync_bool commit_change(OSyncContext *ctx, OSyncChange *change) if( osync_change_get_changetype(change) != CHANGE_ADDED ) { if( !table.GetIndex(RecordId, &StateIndex) ) { osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, - "unable to get state table index for RecordId: %lu", + _("unable to get state table index for RecordId: %lu"), RecordId); return false; } @@ -446,7 +447,7 @@ static osync_bool commit_change(OSyncContext *ctx, OSyncChange *change) status = (*CommitData)(env, dbId, StateIndex, RecordId, osync_change_get_data(change), true, errmsg); if( !status ) { - trace.logf("CommitData() for ADDED state returned false: %s", errmsg.c_str()); + trace.logf(_("CommitData() for ADDED state returned false: %s"), errmsg.c_str()); osync_context_report_error(ctx, OSYNC_ERROR_PARAMETER, "%s", errmsg.c_str()); map.UnmapUid(uid); return false; @@ -458,7 +459,7 @@ static osync_bool commit_change(OSyncContext *ctx, OSyncChange *change) status = (*CommitData)(env, dbId, StateIndex, RecordId, osync_change_get_data(change), false, errmsg); if( !status ) { - trace.logf("CommitData() for MODIFIED state returned false: %s", errmsg.c_str()); + trace.logf(_("CommitData() for MODIFIED state returned false: %s"), errmsg.c_str()); osync_context_report_error(ctx, OSYNC_ERROR_PARAMETER, "%s", errmsg.c_str()); map.UnmapUid(uid); return false; @@ -466,8 +467,8 @@ static osync_bool commit_change(OSyncContext *ctx, OSyncChange *change) break; default: - trace.log("Unknown change type"); - osync_debug("barry-sync", 0, "Unknown change type"); + trace.log(_("Unknown change type")); + osync_debug("barry-sync", 0, _("Unknown change type")); break; } @@ -544,9 +545,20 @@ void get_info(OSyncEnv *env) { Trace trace("get_info"); + static bool i18n_initialized = false; + if( !i18n_initialized ) { + // initialize i18n gettext directory + // the rest is done in i18n.h + bindtextdomain(PACKAGE, LOCALEDIR); + + i18n_initialized = true; + } + // Create first plugin OSyncPluginInfo *info = osync_plugin_new_info(env); + // not translation for these strings, as I think they are const, + // and the info struct relies on their existence info->name = "barry-sync"; info->longname = "Barry OpenSync plugin v" PACKAGE_VERSION " for the Blackberry handheld"; info->description = "Plugin to synchronize calendar and contact entries on USB Blackberry handhelds"; diff --git a/opensync-plugin/src/environment.cc b/opensync-plugin/src/environment.cc index 81cba7c5..518818db 100644 --- a/opensync-plugin/src/environment.cc +++ b/opensync-plugin/src/environment.cc @@ -28,6 +28,7 @@ #include #include #include +#include "i18n.h" using namespace Barry; @@ -143,7 +144,7 @@ unsigned long DatabaseSyncState::GetMappedRecordId(const std::string &uid) // if already in map, use the matching rid idmap::const_iterator it; if( m_IdMap.UidExists(uid, &it) ) { - trace.logf("found existing uid in map: %lu", it->second); + trace.logf(_("found existing uid in map: %lu"), it->second); return it->second; } @@ -154,7 +155,7 @@ unsigned long DatabaseSyncState::GetMappedRecordId(const std::string &uid) if( m_IdMap.Map(uid, RecordId) != m_IdMap.end() ) return RecordId; - trace.logf("parsed uid already exists in map, skipping"); + trace.logf(_("parsed uid already exists in map, skipping")); } // create one of our own, if we get here... @@ -163,7 +164,7 @@ unsigned long DatabaseSyncState::GetMappedRecordId(const std::string &uid) RecordId = m_Table.MakeNewRecordId(); } while( m_IdMap.Map(uid, RecordId) == m_IdMap.end() ); - trace.logf("made new record id: %lu", RecordId); + trace.logf(_("made new record id: %lu"), RecordId); return RecordId; } @@ -188,7 +189,7 @@ BarryEnvironment::~BarryEnvironment() void BarryEnvironment::DoConnect() { if( !m_con.get() ) - throw std::logic_error("Tried to use empty Connector"); + throw std::logic_error(_("Tried to use empty Connector")); m_con->Connect(); @@ -237,7 +238,7 @@ void BarryEnvironment::ClearDirtyFlags(Barry::RecordStateTable &table, Barry::RecordStateTable::StateMapType::const_iterator i = table.StateMap.begin(); for( ; i != table.StateMap.end(); ++i ) { if( i->second.Dirty ) { - trace.logf("Clearing dirty flag for db %u, index %u", + trace.logf(_("Clearing dirty flag for db %u, index %u"), dbId, i->first); m_con->GetDesktop().ClearDirty(dbId, i->first); } @@ -318,17 +319,17 @@ void BarryEnvironment::ParseConfig(const char *data, int size) if( cal ) { m_CalendarSync.m_Sync = true; - trace.log("calendar syncing enabled"); + trace.log(_("calendar syncing enabled")); } if( con ) { m_ContactsSync.m_Sync = true; - trace.log("contacts syncing enabled"); + trace.log(_("contacts syncing enabled")); } } else if ( key == "Password" ) { ils >> m_password; - trace.log("using password from config file"); + trace.log(_("using password from config file")); } } } diff --git a/opensync-plugin/src/gettext.h b/opensync-plugin/src/gettext.h new file mode 100644 index 00000000..209921e6 --- /dev/null +++ b/opensync-plugin/src/gettext.h @@ -0,0 +1,271 @@ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc. + + 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 2, 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 + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by + the gettext() and ngettext() macros. This is an alternative to calling + textdomain(), and is useful for libraries. */ +# ifdef DEFAULT_TEXT_DOMAIN +# undef gettext +# define gettext(Msgid) \ + dgettext (DEFAULT_TEXT_DOMAIN, Msgid) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) +# endif + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include + , which chokes if dcgettext is defined as a macro. So include + it now, to make later inclusions of a NOP. */ +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 \ + ? ((void) (Msgid2), (const char *) (Msgid1)) \ + : ((void) (Msgid1), (const char *) (Msgid2))) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) \ + ((void) (Domainname), (const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) \ + ((void) (Domainname), (const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +/* The separator between msgctxt and msgid in a .mo file. */ +#define GETTEXT_CONTEXT_GLUE "\004" + +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a + MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be + short and rarely need to change. + The letter 'p' stands for 'particular' or 'special'. */ +#ifdef DEFAULT_TEXT_DOMAIN +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#else +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#endif +#define dpgettext(Domainname, Msgctxt, Msgid) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) +#ifdef DEFAULT_TEXT_DOMAIN +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#else +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#endif +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +pgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + int category) +{ + const char *translation = dcgettext (domain, msg_ctxt_id, category); + if (translation == msg_ctxt_id) + return msgid; + else + return translation; +} + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +npgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + const char *translation = + dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + if (translation == msg_ctxt_id || translation == msgid_plural) + return (n == 1 ? msgid : msgid_plural); + else + return translation; +} + +/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID + can be arbitrary expressions. But for string literals these macros are + less efficient than those above. */ + +#include + +#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ + (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ + /* || __STDC_VERSION__ >= 199901L */ ) + +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS +#include +#endif + +#define pgettext_expr(Msgctxt, Msgid) \ + dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ + dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcgettext (domain, msg_ctxt_id, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (translation != msg_ctxt_id) + return translation; + } + return msgid; +} + +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcnpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (!(translation == msg_ctxt_id || translation == msgid_plural)) + return translation; + } + return (n == 1 ? msgid : msgid_plural); +} + +#endif /* _LIBGETTEXT_H */ diff --git a/opensync-plugin/src/i18n.h b/opensync-plugin/src/i18n.h new file mode 100644 index 00000000..6c268717 --- /dev/null +++ b/opensync-plugin/src/i18n.h @@ -0,0 +1,40 @@ +/// +/// \file i18n.h +/// Common internationalization defines, via gettext +/// NOTE! This is a private header, not to be installed! +/// + +/* + Copyright (C) 2009, Nicolas VIVIEN + Copyright (C) 2009-2012, Net Direct Inc. (http://www.netdirect.ca/) + + 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 2 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 in the COPYING file at the + root directory of this project for more details. +*/ + +#ifndef __BARRY_OSPLUGIN_I18N_H__ +#define __BARRY_OSPLUGIN_I18N_H__ + +#include +#include + +// Set the DEFAULT_TEXT_DOMAIN so that gettext.h uses dgettext() +// instead of gettext(). This way we don't have to call textdomain() +// and hope that nobody changes it on us later. +#define DEFAULT_TEXT_DOMAIN PACKAGE +#include "gettext.h" + +#define _(String) gettext (String) +#define N_(String) String + +#endif + diff --git a/opensync-plugin/src/vcard.cc b/opensync-plugin/src/vcard.cc index f99d3f74..f133d4f2 100644 --- a/opensync-plugin/src/vcard.cc +++ b/opensync-plugin/src/vcard.cc @@ -28,6 +28,7 @@ #include #include #include +#include "i18n.h" using namespace Barry::Sync; @@ -71,7 +72,7 @@ bool VCardConverter::ParseData(const char *data) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vcard:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vcard:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); return false; } @@ -98,7 +99,7 @@ void VCardConverter::operator()(const Barry::Contact &rec) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vcard:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vcard:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); } } @@ -144,7 +145,7 @@ bool VCardConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, newRecordId = recordId; } else { - trace.log("Can't use recommended recordId, generating new one."); + trace.log(_("Can't use recommended recordId, generating new one.")); newRecordId = env->m_ContactsSync.m_Table.MakeNewRecordId(); } } @@ -156,9 +157,10 @@ bool VCardConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, VCardConverter convert(newRecordId); if( !convert.ParseData(data) ) { std::ostringstream oss; - oss << "unable to parse change data for new RecordId: " + oss << _("unable to parse change data for new RecordId: ") << newRecordId - << " (" << convert.GetLastError() << ") data: " << data; + << " (" << convert.GetLastError() << ") " + << _("data: ") << data; errmsg = oss.str(); trace.log(errmsg.c_str()); return false; @@ -167,13 +169,13 @@ bool VCardConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, Barry::RecordBuilder builder(convert); if( add ) { - trace.log("adding record"); + trace.log(_("adding record")); env->GetDesktop()->AddRecord(dbId, builder); } else { - trace.log("setting record"); + trace.log(_("setting record")); env->GetDesktop()->SetRecord(dbId, StateIndex, builder); - trace.log("clearing dirty flag"); + trace.log(_("clearing dirty flag")); env->GetDesktop()->ClearDirty(dbId, StateIndex); } diff --git a/opensync-plugin/src/vevent.cc b/opensync-plugin/src/vevent.cc index 68ea539c..b6e71914 100644 --- a/opensync-plugin/src/vevent.cc +++ b/opensync-plugin/src/vevent.cc @@ -27,6 +27,7 @@ #include #include #include +#include "i18n.h" using namespace Barry::Sync; @@ -71,7 +72,7 @@ bool VEventConverter::ParseData(const char *data) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vevent:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vevent:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); return false; } @@ -112,7 +113,7 @@ void VEventConverter::operator()(const Barry::Calendar &rec) } catch( Barry::ConvertError &ce ) { - trace.logf("ERROR: vevent:Barry::ConvertError exception: %s", ce.what()); + trace.logf(_("ERROR: vevent:Barry::ConvertError exception: %s"), ce.what()); m_last_errmsg = ce.what(); } } @@ -158,7 +159,7 @@ bool VEventConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, newRecordId = recordId; } else { - trace.log("Can't use recommended recordId, generating new one."); + trace.log(_("Can't use recommended recordId, generating new one.")); newRecordId = env->m_CalendarSync.m_Table.MakeNewRecordId(); } } @@ -170,9 +171,10 @@ bool VEventConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, VEventConverter convert(newRecordId); if( !convert.ParseData(data) ) { std::ostringstream oss; - oss << "unable to parse change data for new RecordId: " + oss << _("unable to parse change data for new RecordId: ") << newRecordId - << " (" << convert.GetLastError() << ") data: " << data; + << " (" << convert.GetLastError() << ") " + << _("data: ") << data; errmsg = oss.str(); trace.log(errmsg.c_str()); return false; @@ -196,13 +198,13 @@ bool VEventConverter::CommitRecordData(BarryEnvironment *env, unsigned int dbId, Barry::RecordBuilder builder(convert); if( add ) { - trace.log("adding record"); + trace.log(_("adding record")); env->GetDesktop()->AddRecord(dbId, builder); } else { - trace.log("setting record"); + trace.log(_("setting record")); env->GetDesktop()->SetRecord(dbId, StateIndex, builder); - trace.log("clearing dirty flag"); + trace.log(_("clearing dirty flag")); env->GetDesktop()->ClearDirty(dbId, StateIndex); } diff --git a/po/POTFILES.in b/po/POTFILES.in index 1500db22..97a5af21 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,92 +1,114 @@ # List of source files which contain translatable strings. -src/data.cc -src/r_task.cc -src/r_memo.cc -src/router.cc -src/m_mode_base.cc -src/pppfilter.cc -src/r_command.cc -src/common.cc -src/j_message.cc -src/error.cc -src/strnlen.c -src/ldif.cc -src/r_recordstate.cc -src/sha1.cc -src/r_sms.cc -src/j_manager.cc -src/threadwrap.cc -src/r_servicebook.cc -src/iconv.cc -src/m_desktop.cc -src/m_raw_channel.cc -src/record.cc -src/dp_codinfo.cc -src/time.cc +src/a_alxparser.cc +src/a_application.cc +src/a_codsection.cc +src/a_library.cc +src/a_osloader.cc +src/backup.cc +src/base64.cc src/bmp.cc +src/builder.cc src/cod.cc +src/common.cc +src/configfile.cc +src/configfileunix.cc +src/configfilewin32.cc +src/connector.cc +src/controller.cc +src/data.cc src/dataqueue.cc -src/log.cc +src/dp_codinfo.cc +src/dp_parser.cc +src/error.cc +src/fifoargs.cc +src/getpwuidandroid.cc +src/iconv.cc +src/iconvwin.cc +src/j_jdwp.cc +src/j_manager.cc +src/j_message.cc +src/j_record.cc src/j_server.cc -src/r_calllog.cc -src/controller.cc +src/ldif.cc +src/ldifio.cc +src/log.cc +src/m_desktop.cc src/m_ipmodem.cc -src/r_timezone.cc -src/m_serial.cc -src/r_dbdb.cc -src/r_folder.cc +src/m_javaloader.cc src/m_jvmdebug.cc -src/r_calendar.cc -src/j_record.cc +src/m_mode_base.cc +src/m_raw_channel.cc +src/m_serial.cc +src/mimeio.cc +src/packet.cc +src/parser.cc +src/pin.cc +src/pipe.cc +src/pppfilter.cc +src/probe.cc src/protocol.cc -src/usbwrap.cc +src/r_bookmark.cc +src/r_calendar.cc +src/r_calllog.cc +src/r_command.cc src/r_contact.cc -src/dp_parser.cc -src/probe.cc -src/packet.cc -src/socket.cc -src/m_javaloader.cc -src/version.cc -src/base64.cc -src/j_jdwp.cc -src/r_recur_base.cc +src/r_cstore.cc +src/r_dbdb.cc +src/r_folder.cc +src/r_hhagent.cc +src/r_memo.cc src/r_message_base.cc +src/r_recordstate.cc +src/r_recur_base.cc +src/r_servicebook.cc +src/r_sms.cc +src/r_task.cc +src/r_timezone.cc +src/record.cc +src/restore.cc +src/router.cc +src/sha1.cc +src/socket.cc +src/tarfile-ops-nt.cc +src/tarfile.cc +src/threadwrap.cc +src/time.cc src/tzwrapper.cc -src/vformat.c +src/usbwrap.cc +src/usbwrap_libusb.cc +src/usbwrap_libusb_1_0.cc src/vbase.cc src/vcard.cc +src/version.cc src/vevent.cc src/vjournal.cc src/vtodo.cc +src/xmlparser.cc -opensync-plugin/src/vcard.cc -opensync-plugin/src/vevent.cc -opensync-plugin/src/idmap.cc -opensync-plugin/src/barry_sync.cc -opensync-plugin/src/environment.cc - -opensync-plugin-0.4x/src/vcard.cc -opensync-plugin-0.4x/src/vjournal.cc -opensync-plugin-0.4x/src/vevent.cc -opensync-plugin-0.4x/src/barry_sync.cc -opensync-plugin-0.4x/src/vtodo.cc -opensync-plugin-0.4x/src/environment.cc - -tools/brimtrans.cc -tools/bjvmdebug.cc -tools/bjdwp.cc +tools/balxparse.cc tools/bcharge.cc +tools/bcharge_libusb_1_0.cc tools/bdptest.cc +tools/bfuse.cc +tools/bidentify.cc +tools/bio.cc +tools/bjavaloader.cc +tools/bjdwp.cc +tools/bjvmdebug.cc tools/bktrans.cc +tools/boostwrap.cc +tools/brawchannel.cc tools/brecsum.cc -tools/btranslate.cc tools/breset.cc -tools/bidentify.cc -tools/pppob.cc +tools/breset_libusb_1_0.cc +tools/brimtrans.cc tools/bs11nread.cc +tools/btarcmp.cc +tools/btardump.cc tools/btool.cc -tools/bfuse.cc +tools/btranslate.cc +tools/bwatch.cc +tools/pppob.cc tools/upldif.cc -tools/bjavaloader.cc -tools/brawchannel.cc +tools/util.cc -- 2.11.4.GIT