From 633e4c63df19087cb10c8dff8852b1334b3e5cb0 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 3 Apr 2015 20:44:10 +0200 Subject: [PATCH] Added french translation --- .gitignore | 1 + Makefile.am | 5 ++-- configure.ac | 4 ++- po/LINGUAS | 1 + po/Makevars | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ po/POTFILES.in | 2 ++ po/fr.po | 68 +++++++++++++++++++++++++++++++++++++++++++ src/main.c | 7 +++++ 8 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 po/LINGUAS create mode 100644 po/Makevars create mode 100644 po/POTFILES.in create mode 100644 po/fr.po diff --git a/.gitignore b/.gitignore index a807c71..c1f4e54 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ !*.h !*.rst !samples/tests/*.sh +!*.po !LICENSE !HEADER diff --git a/Makefile.am b/Makefile.am index 378f18e..884ff44 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = dependencies/csptr samples +AM_CPPFLAGS = -DLOCALEDIR='"$(localedir)"' +SUBDIRS = po dependencies/csptr samples lib_LTLIBRARIES = libcriterion.la @@ -19,7 +20,7 @@ libcriterion_la_LDFLAGS = $(COVERAGE_LDFLAGS) # dirty but unless someone has a better alternative... libcriterion_la_LIBADD = dependencies/csptr/src/libcsptr_la-*.lo -EXTRA_DIST = LICENSE +EXTRA_DIST = config.rpath LICENSE subdirincludedir = $(includedir)/criterion/ subdirinclude_HEADERS = \ diff --git a/configure.ac b/configure.ac index d095e15..da028eb 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,8 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_SUBST([LIBTOOL_DEPS]) +AM_GNU_GETTEXT([external]) + AC_ARG_ENABLE([gcov], [AS_HELP_STRING([--enable-gcov], [Compile the project with converage enabled])], @@ -31,7 +33,7 @@ AC_ARG_ENABLE([gcov], []) AC_CONFIG_HEADERS([src/config.h]) -AC_CONFIG_FILES([Makefile samples/Makefile]) +AC_CONFIG_FILES([Makefile samples/Makefile po/Makefile.in]) AC_CONFIG_SUBDIRS([dependencies/csptr]) diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..527e861 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +fr diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..70daf30 --- /dev/null +++ b/po/Makevars @@ -0,0 +1,78 @@ +# 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 = Franklin "Snaipe" Mathieu + +# This tells whether or not to prepend "GNU " prefix to the package +# name that gets inserted into the header of the $(DOMAIN).pot file. +# Possible values are "yes", "no", or empty. If it is empty, try to +# detect it automatically by scanning the files in $(top_srcdir) for +# "GNU packagename" string. +PACKAGE_GNU = no + +# 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. +MSGID_BUGS_ADDRESS = + +# 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 = + +# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' +# context. Possible values are "yes" and "no". Set this to yes if the +# package uses functions taking also a message context, like pgettext(), or +# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. +USE_MSGCTXT = no + +# These options get passed to msgmerge. +# Useful options are in particular: +# --previous to keep previous msgids of translated messages, +# --quiet to reduce the verbosity. +MSGMERGE_OPTIONS = + +# These options get passed to msginit. +# If you want to disable line wrapping when writing PO files, add +# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and +# MSGINIT_OPTIONS. +MSGINIT_OPTIONS = + +# This tells whether or not to regenerate a PO file when $(DOMAIN).pot +# has changed. Possible values are "yes" and "no". Set this to no if +# the POT file is checked in the repository and the version control +# program ignores timestamps. +PO_DEPENDS_ON_POT = yes + +# This tells whether or not to forcibly update $(DOMAIN).pot and +# regenerate PO files on "make dist". Possible values are "yes" and +# "no". Set this to no if the POT file and PO files are maintained +# externally. +DIST_DEPENDS_ON_UPDATE_PO = yes diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..d9d2b16 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,2 @@ +# List of source files which contain translatable strings. +src/log/normal.c diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..f2a909b --- /dev/null +++ b/po/fr.po @@ -0,0 +1,68 @@ +# French translations for criterion package +# Traductions françaises du paquet criterion. +# Copyright (C) 2015 Franklin "Snaipe" Mathieu +# This file is distributed under the same license as the criterion package. +# , 2015. +# +msgid "" +msgstr "" +"Project-Id-Version: criterion 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-04-03 17:57+0200\n" +"PO-Revision-Date: 2015-04-03 17:58+0200\n" +"Last-Translator: \n" +"Language-Team: French\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: src/log/normal.c:38 +#, c-format +msgid "Criterion v%s\n" +msgstr "Criterion v%s\n" + +#: src/log/normal.c:42 +#, c-format +msgid "%1$s::%2$s\n" +msgstr "%1$s::%2$s\n" + +#: src/log/normal.c:68 +#, c-format +msgid "%1$s::%2$s: Test is disabled\n" +msgstr "%1$s::%2$s: Le test est désactivé\n" + +#: src/log/normal.c:69 +#, c-format +msgid "%1$s::%2$s: Suite is disabled\n" +msgstr "%1$s::%2$s: La suite est désactivée\n" + +#: src/log/normal.c:80 +#, c-format +msgid "" +"%1$sSynthesis: Tested: %2$s%3$lu%4$s | Passing: %5$s%6$lu%7$s | Failing: %8$s" +"%9$lu%10$s | Crashing: %11$s%12$lu%13$s %14$s\n" +msgstr "" +"%1$sSynthèse: Testés: %2$s%3$lu%4$s | Validés: %5$s%6$lu%7$s | Échoués: %8$s" +"%9$lu%10$s | Plantages: %11$s%12$lu%13$s %14$s\n" + +#: src/log/normal.c:99 +#, c-format +msgid "%1$s%2$s%3$s:%4$s%5$d%6$s: Assertion failed: %7$s\n" +msgstr "%1$s%2$s%3$s:%4$s%5$d%6$s: Échec d'assertion: %7$s\n" + +#: src/log/normal.c:105 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: src/log/normal.c:112 +#, c-format +msgid "%1$s%2$s%3$s:%4$s%5$u%6$s: Unexpected signal caught below this line!\n" +msgstr "%1$s%2$s%3$s:%4$s%5$u%6$s: Un signal inattendu a été reçu après cette ligne!\n" + +#: src/log/normal.c:116 +#, c-format +msgid "%1$s::%2$s: CRASH!\n" +msgstr "%1$s::%2$s: PLANTAGE!\n" diff --git a/src/main.c b/src/main.c index f263fd5..ada2b99 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,10 @@ #include "runner.h" #include "config.h" +#ifdef I18N +# include +#endif + # define VERSION_MSG "Tests compiled with Criterion v" VERSION "\n" # define USAGE \ @@ -120,6 +124,9 @@ int main(int argc, char *argv[]) { }; setlocale(LC_ALL, ""); +#ifdef I18N + textdomain (PACKAGE "-test"); +#endif criterion_options = (struct criterion_options) { .always_succeed = !strcmp("1", getenv("CRITERION_ALWAYS_SUCCEED") ?: "0"),