Added i18n initialization

This commit is contained in:
Snaipe 2015-04-01 20:42:21 +02:00
parent beb9b64eb1
commit 24a20253c5
3 changed files with 13 additions and 0 deletions

View file

@ -51,6 +51,8 @@ libcriterion_la_SOURCES = \
src/options.c \
src/timer.c \
src/timer.h \
src/i18n.c \
src/i18n.h \
src/ordered-set.c \
src/main.c

8
src/i18n.c Normal file
View file

@ -0,0 +1,8 @@
#include "i18n.h"
#ifdef I18N
__attribute__ ((constructor))
void init_i18n(void) {
bindtextdomain (PACKAGE, LOCALEDIR);
}
#endif

View file

@ -26,6 +26,7 @@
#include <criterion/options.h>
#include <criterion/ordered-set.h>
#include <stdio.h>
#include <locale.h>
#include <getopt.h>
#include <csptr/smart_ptr.h>
#include "runner.h"
@ -118,6 +119,8 @@ int main(int argc, char *argv[]) {
{0, 0, 0, 0 }
};
setlocale(LC_ALL, "");
criterion_options = (struct criterion_options) {
.always_succeed = !strcmp("1", getenv("CRITERION_ALWAYS_SUCCEED") ?: "0"),
.no_early_exit = !strcmp("1", getenv("CRITERION_NO_EARLY_EXIT") ?: "0"),