28
31
*********************************************/
30
33
/*==================================================
34
* llgettext_set_default_localedir -- save LOCALEDIR
35
*================================================*/
37
llgettext_set_default_localedir (CNSTRING localeDir)
39
strupdate(>_defLocaleDir, localeDir);
41
/*==================================================
31
42
* llgettext_init -- initialize gettext with initially
43
* desired codeset. This may be changed later by user
44
* options, but this is initial best guess.
45
* domain: [IN] package domain (eg, "lifelines")
46
* codeset: [IN] codeset to use
33
47
*================================================*/
35
49
llgettext_init (CNSTRING domain, CNSTRING codeset)
40
52
/* until we have an internal codeset (which is until we open a database)
41
53
we want output in display codeset */
42
set_gettext_codeset(PACKAGE, gui_codeset_out);
54
set_gettext_codeset(domain, codeset);
44
/* allow run-time specification of locale directory */
45
/* (LOCALEDIR is compile-time) */
46
e = getlloptstr("LocaleDir", "");
48
bindtextdomain(PACKAGE, e);
49
locales_notify_language_change(); /* TODO: is this necessary ? 2002-09-29, Perry */
56
update_textdomain_localedir(domain, "Ui");
52
58
#else /* ENABLE_NLS */
55
61
#endif /* ENABLE_NLS */
63
/*==================================================
64
* update_textdomain_localedir --
65
* call bindtextdomain with current localedir
66
* domain: [IN] package domain (eg, "lifelines")
67
* prefix: [IN] "Ui" or "Rpt"
68
*================================================*/
70
update_textdomain_localedir (CNSTRING domain, CNSTRING prefix)
72
STRING newLocaleDir = 0;
73
char keyname[30] = ""; /* eg, "UiLocaleDir" */
74
/* allow run-time specification of locale directory */
76
/* Default to compile-time specified (LOCALEDIR) */
77
newLocaleDir = gt_defLocaleDir;
79
/* Check for config setting for LocaleDir */
80
newLocaleDir = getlloptstr("LocaleDir", newLocaleDir);
82
/* Check for Ui or Rpt specific setting, eg, UiLocaleDir */
83
if (prefix && prefix[0]) {
84
snprintf(keyname, sizeof(keyname), "%sLocaleDir", prefix);
85
newLocaleDir = getlloptstr(keyname, newLocaleDir);
89
/* ll_bindtextdomain is caching; it will only submit
90
real changes to gettext version */
91
ll_bindtextdomain(domain, newLocaleDir);
94
/*=================================
95
* ll_bindtextdomain -- interceptor for bindtextdomain calls
96
* to send ui callbacks
97
*===============================*/
99
ll_bindtextdomain (CNSTRING domain, CNSTRING localeDir)
102
STRING oldLocaleDir = 0;
104
if (!gt_localeDirs) {
105
gt_localeDirs = create_table_str();
107
/* skip if already set */
108
oldLocaleDir = valueof_str(gt_localeDirs, domain);
109
if (eqstr_ex(oldLocaleDir, localeDir))
111
insert_table_str(gt_localeDirs, domain, localeDir);
113
bindtextdomain(domain, localeDir);
114
locales_notify_language_change();
115
#endif /* ENABLE_NLS */
57
117
/*=================================
58
118
* init_win32_gettext_shim --
59
119
* Handle user-specified iconv dll path