19 |
* along with WinPT; if not, write to the Free Software Foundation, |
* along with WinPT; if not, write to the Free Software Foundation, |
20 |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
*/ |
*/ |
|
/* x-todo-status: OK */ |
|
22 |
|
|
23 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
24 |
#include <config.h> |
#include <config.h> |
36 |
#include "wptTypes.h" |
#include "wptTypes.h" |
37 |
#include "wptNLS.h" |
#include "wptNLS.h" |
38 |
|
|
|
|
|
39 |
/* Missing W32 functions. */ |
/* Missing W32 functions. */ |
40 |
static char * |
static char * |
41 |
stpcpy( char *a,const char *b ) |
w32_stpcpy (char *a,const char *b) |
42 |
{ |
{ |
43 |
while( *b ) |
while (*b) |
44 |
*a++ = *b++; |
*a++ = *b++; |
45 |
*a = 0; |
*a = 0; |
46 |
return (char*)a; |
return (char*)a; |
47 |
} |
} |
48 |
|
|
49 |
|
|
50 |
/* The magic number of the GNU message catalog format. */ |
/* The magic number of the GNU message catalog format. */ |
51 |
#define MAGIC 0x950412de |
#define MAGIC 0x950412de |
52 |
#define MAGIC_SWAPPED 0xde120495 |
#define MAGIC_SWAPPED 0xde120495 |
238 |
|
|
239 |
dir = strdup( nls_dir ); |
dir = strdup( nls_dir ); |
240 |
if( dir && (buf= (char *)malloc(strlen(dir)+strlen(filename)+1+3+1)) ) { |
if( dir && (buf= (char *)malloc(strlen(dir)+strlen(filename)+1+3+1)) ) { |
241 |
strcpy(stpcpy(stpcpy(stpcpy( buf, dir),"/"), filename),".mo"); |
strcpy(w32_stpcpy(w32_stpcpy(w32_stpcpy( buf, dir),"/"), filename),".mo"); |
242 |
domain = load_domain( buf ); |
domain = load_domain( buf ); |
243 |
free(buf); |
free(buf); |
244 |
} |
} |
341 |
return msgid; |
return msgid; |
342 |
} /* gettext */ |
} /* gettext */ |
343 |
|
|
344 |
|
/* Map the user specific language ID to a |
345 |
|
gettext conform language string. |
346 |
|
Example: LANG_GERMAN -> "de" */ |
347 |
|
const char* |
348 |
|
get_gettext_langid (void) |
349 |
|
{ |
350 |
|
struct { |
351 |
|
const char *id; |
352 |
|
int langid; |
353 |
|
} lang_table[] = { |
354 |
|
{"de", LANG_GERMAN}, |
355 |
|
{NULL, 0}, |
356 |
|
}; |
357 |
|
LANGID lang; |
358 |
|
int i; |
359 |
|
|
360 |
|
lang = GetUserDefaultLangID (); |
361 |
|
|
362 |
|
for (i=0; lang_table[i].id; i++) { |
363 |
|
if (PRIMARYLANGID (lang) == lang_table[i].langid) |
364 |
|
return lang_table[i].id; |
365 |
|
} |
366 |
|
return NULL; |
367 |
|
} |
368 |
|
|
369 |
|
|
370 |
/* XXX: this has to be placed in a .c file but not here */ |
/* XXX: this has to be placed in a .c file but not here */ |
371 |
#include <shlobj.h> |
#include <shlobj.h> |