From 09795a01ef859f072920de9df974d1b03b9ab9a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 28 Dec 2016 20:24:50 +0100 Subject: New upstream version 4.2.4a --- app/bin/i18n.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'app/bin/i18n.c') 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 #include -/* - * Initialize gettext environment. +/** + * Initialize gettext environment. By default, the language files are installed + * in \share\locale\ + * The install dir is derived from the library directory by removing the last + * directory in the path (xtrkcad) + * Directory layout on Windows is: + * \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); -- cgit v1.2.3