summaryrefslogtreecommitdiff
path: root/app/bin/i18n.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-12-28 20:24:50 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-12-28 20:24:50 +0100
commit09795a01ef859f072920de9df974d1b03b9ab9a4 (patch)
tree4d05907fc37f1bd781e506f5e196f7435aeec0ab /app/bin/i18n.c
parent5b4163d8c76b03f0d31b09866aa4bd06b4d8d804 (diff)
New upstream version 4.2.4aupstream/4.2.4a
Diffstat (limited to 'app/bin/i18n.c')
-rw-r--r--app/bin/i18n.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/app/bin/i18n.c b/app/bin/i18n.c
index 92c68cf..ff4e28d 100644
--- a/app/bin/i18n.c
+++ b/app/bin/i18n.c
@@ -1,4 +1,7 @@
-/* XTrkCad - Model Railroad CAD
+/** \file i18n.c
+ * Internationalization stuff
+ *
+ * XTrkCad - Model Railroad CAD
* Copyright (C) 2007 Mikko Nissinen
*
* This program is free software; you can redistribute it and/or modify
@@ -22,21 +25,38 @@
#include <locale.h>
#include <stdio.h>
-/*
- * Initialize gettext environment.
+/**
+ * Initialize gettext environment. By default, the language files are installed
+ * in <install_dir>\share\locale\<language>
+ * The install dir is derived from the library directory by removing the last
+ * directory in the path (xtrkcad)
+ * Directory layout on Windows is:
+ * <install_dir>\bin\
+ * \share\xtrkcad
+ * \locale
*/
void InitGettext( void )
{
#ifdef XTRKCAD_USE_GETTEXT
char directory[2048];
+
setlocale(LC_ALL, "");
-#ifdef XTRKCAD_CMAKE_BUILD
- strcpy(directory, XTRKCAD_INSTALL_PREFIX);
- strcat(directory, "/share");
-#else
+
+#ifdef WINDOWS
+ // build the correct directory path
strcpy(directory, wGetAppLibDir());
-#endif
- strcat(directory, "/locale");
+ strcat( directory, "/../locale" );
+ _fullpath( directory, directory, 2048 );
+#else
+ #ifdef XTRKCAD_CMAKE_BUILD
+ strcpy(directory, XTRKCAD_INSTALL_PREFIX);
+ strcat(directory, "/share");
+ #else
+ strcpy(directory, wGetAppLibDir());
+ #endif
+ strcat(directory, "/locale");
+#endif
+ // initialize gettext
bindtextdomain(XTRKCAD_PACKAGE, directory);
bind_textdomain_codeset(XTRKCAD_PACKAGE, "UTF-8");
textdomain(XTRKCAD_PACKAGE);