/[zanavi_public1]/navit/navit/main.c
ZANavi

Contents of /navit/navit/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Mon Feb 4 17:41:59 2013 UTC (6 years, 7 months ago) by zoff99
File MIME type: text/plain
File size: 15918 byte(s)
new map version, lots of fixes and experimental new features
1 /**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 /**
21 * Navit, a modular navigation system.
22 * Copyright (C) 2005-2008 Navit Team
23 *
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU General Public License
26 * version 2 as published by the Free Software Foundation.
27 *
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU General Public License for more details.
32 *
33 * You should have received a copy of the GNU General Public License
34 * along with this program; if not, write to the
35 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
36 * Boston, MA 02110-1301, USA.
37 */
38
39 #include <locale.h>
40 #include <stdlib.h>
41 #include <stdio.h>
42 #include <string.h>
43 #include <signal.h>
44 #include <glib.h>
45 #include <sys/types.h>
46
47 #include "config.h"
48
49 #ifdef HAVE_UNISTD_H
50 #include <unistd.h>
51 #endif
52
53 #ifndef _WIN32
54 #include <sys/wait.h>
55 #include <signal.h>
56 #endif
57
58 #include "file.h"
59 #include "debug.h"
60 #include "main.h"
61 #include "navit.h"
62 #include "gui.h"
63 #include "item.h"
64 #include "xmlconfig.h"
65 #include "coord.h"
66 #include "route.h"
67 #include "navigation.h"
68 #include "event.h"
69 #include "callback.h"
70 #include "navit_nls.h"
71 #include "util.h"
72 #if HAVE_API_WIN32_BASE
73 #include <windows.h>
74 #include <winbase.h>
75 #endif
76
77 #ifdef HAVE_API_WIN32_CE
78 #include "libc.h"
79 #endif
80
81 struct map_data *map_data_default;
82
83 struct callback_list *cbl;
84
85 #ifdef HAVE_API_WIN32
86 void
87 setenv(char *var, char *val, int overwrite)
88 {
89 char *str=g_strdup_printf("%s=%s",var,val);
90 if (overwrite || !getenv(var))
91 putenv(str);
92 g_free(str);
93 }
94 #endif
95
96 /*
97 * environment_vars[][0:name,1-3:mode]
98 * ':' replaced with NAVIT_PREFIX
99 * '::' replaced with NAVIT_PREFIX and LIBDIR
100 * '~' replaced with HOME
101 */
102 static char *environment_vars[][5] = { { "NAVIT_LIBDIR", ":", "::/navit", ":\\lib", ":/lib" }, { "NAVIT_SHAREDIR", ":", ":/share/navit", ":", ":/share" }, { "NAVIT_LOCALEDIR", ":/../locale", ":/share/locale", ":\\locale", ":/locale" }, { "NAVIT_USER_DATADIR", ":", "~/.navit", ":\\data", ":/home" },
103 #if 1
104 { "NAVIT_LOGFILE", NULL, NULL, ":\\navit.log", NULL },
105 #endif
106 { "NAVIT_LIBPREFIX", "*/.libs/", NULL, NULL, NULL }, { NULL, NULL, NULL, NULL, NULL }, };
107
108 static void main_setup_environment(int mode)
109 {
110 int i = 0;
111 char *var, *val, *homedir;
112 while ((var = environment_vars[i][0]))
113 {
114 val = environment_vars[i][mode + 1];
115 if (val)
116 {
117 switch (val[0])
118 {
119 case ':':
120 if (val[1] == ':')
121 val = g_strdup_printf("%s/%s%s", getenv("NAVIT_PREFIX"), LIBDIR + sizeof(PREFIX), val + 2);
122 else
123 val = g_strdup_printf("%s%s", getenv("NAVIT_PREFIX"), val + 1);
124 break;
125 case '~':
126 homedir = getenv("HOME");
127 if (!homedir)
128 homedir = "./";
129 val = g_strdup_printf("%s%s", homedir, val + 1);
130 break;
131 default:
132 val = g_strdup(val);
133 break;
134 }
135 setenv(var, val, 0);
136 g_free(val);
137 }
138 i++;
139 }
140 }
141
142 #ifdef HAVE_API_WIN32_BASE
143 char *nls_table[][3]=
144 {
145 // NLS Table compiled by Nick "Number6" Geoghegan
146 // Not an exhaustive list, but supports 99% of all languages in Windows
147 //{"LANGNAME", "CTRYNAME", "Language Code"},
148
149 { "AFK", "ZAF", "af_ZA"}, // Afrikaans (South Africa)
150
151 { "SQI", "ALB", "sq_AL"}, // Albanian (Albania)
152
153 { "AMH", "ETH", "am_ET"}, // Amharic (Ethiopia)
154
155 { "ARG", "DZA", "ar_DZ"}, // Arabic (Algeria)
156
157 { "ARH", "BHR", "ar_BH"}, // Arabic (Bahrain)
158
159 { "ARE", "EGY", "ar_EG"}, // Arabic (Egypt)
160
161 { "ARI", "IRQ", "ar_IQ"}, // Arabic (Iraq)
162
163 { "ARJ", "JOR", "ar_JO"}, // Arabic (Jordan)
164
165 { "ARK", "KWT", "ar_KW"}, // Arabic (Kuwait)
166
167 { "ARB", "LBN", "ar_LB"}, // Arabic (Lebanon)
168
169 { "ARL", "LBY", "ar_LY"}, // Arabic (Libya)
170
171 { "ARM", "MAR", "ar_MA"}, // Arabic (Morocco)
172
173 { "ARO", "OMN", "ar_OM"}, // Arabic (Oman)
174
175 { "ARQ", "QAT", "ar_QA"}, // Arabic (Qatar)
176
177 { "ARA", "SAU", "ar_SA"}, // Arabic (Saudi Arabia)
178
179 { "ARS", "SYR", "ar_SY"}, // Arabic (Syria)
180
181 { "ART", "TUN", "ar_TN"}, // Arabic (Tunisia)
182
183 { "ARU", "ARE", "ar_AE"}, // Arabic (U.A.E.)
184
185 { "ARY", "YEM", "ar_YE"}, // Arabic (Yemen)
186
187 { "HYE", "ARM", "hy_AM"}, // Armenian (Armenia)
188
189 { "ASM", "IND", "as_IN"}, // Assamese (India)
190
191 { "BAS", "RUS", "ba_RU"}, // Bashkir (Russia)
192
193 { "EUQ", "ESP", "eu_ES"}, // Basque (Basque)
194
195 { "BEL", "BLR", "be_BY"}, // Belarusian (Belarus)
196
197 { "BNG", "BDG", "bn_BD"}, // Bengali (Bangladesh)
198
199 { "BNG", "IND", "bn_IN"}, // Bengali (India)
200
201 { "BRE", "FRA", "br_FR"}, // Breton (France)
202
203 { "BGR", "BGR", "bg_BG"}, // Bulgarian (Bulgaria)
204
205 { "CAT", "ESP", "ca_ES"}, // Catalan (Catalan)
206
207 { "ZHH", "HKG", "zh_HK"}, // Chinese (Hong Kong S.A.R.)
208
209 { "ZHM", "MCO", "zh_MO"}, // Chinese (Macao S.A.R.)
210
211 { "CHS", "CHN", "zh_CN"}, // Chinese (People's Republic of China)
212
213 { "ZHI", "SGP", "zh_SG"}, // Chinese (Singapore)
214
215 { "CHT", "TWN", "zh_TW"}, // Chinese (Taiwan)
216
217 { "COS", "FRA", "co_FR"}, // Corsican (France)
218
219 { "HRV", "HRV", "hr_HR"}, // Croatian (Croatia)
220
221 { "HRB", "BIH", "hr_BA"}, // Croatian (Latin, Bosnia and Herzegovina)
222
223 { "CSY", "CZE", "cs_CZ"}, // Czech (Czech Republic)
224
225 { "DAN", "DNK", "da_DK"}, // Danish (Denmark)
226
227 { "NLB", "BEL", "nl_BE"}, // Dutch (Belgium)
228
229 { "NLD", "NLD", "nl_NL"}, // Dutch (Netherlands)
230
231 { "ENA", "AUS", "en_AU"}, // English (Australia)
232
233 { "ENL", "BLZ", "en_BZ"}, // English (Belize)
234
235 { "ENC", "CAN", "en_CA"}, // English (Canada)
236
237 { "ENB", "CAR", "en_CB"}, // English (Caribbean)
238
239 { "ENN", "IND", "en_IN"}, // English (India)
240
241 { "ENI", "IRL", "en_IE"}, // English (Ireland)
242
243 { "ENJ", "JAM", "en_JM"}, // English (Jamaica)
244
245 { "ENM", "MYS", "en_MY"}, // English (Malaysia)
246
247 { "ENZ", "NZL", "en_NZ"}, // English (New Zealand)
248
249 { "ENP", "PHL", "en_PH"}, // English (Republic of the Philippines)
250
251 { "ENE", "SGP", "en_SG"}, // English (Singapore)
252
253 { "ENS", "ZAF", "en_ZA"}, // English (South Africa)
254
255 { "ENT", "TTO", "en_TT"}, // English (Trinidad and Tobago)
256
257 { "ENG", "GBR", "en_GB"}, // English (United Kingdom)
258
259 { "ENU", "USA", "en_US"}, // English (United States)
260
261 { "ENW", "ZWE", "en_ZW"}, // English (Zimbabwe)
262
263 { "ETI", "EST", "et_EE"}, // Estonian (Estonia)
264
265 { "FOS", "FRO", "fo_FO"}, // Faroese (Faroe Islands)
266
267 { "FIN", "FIN", "fi_FI"}, // Finnish (Finland)
268
269 { "FRB", "BEL", "fr_BE"}, // French (Belgium)
270
271 { "FRC", "CAN", "fr_CA"}, // French (Canada)
272
273 { "FRA", "FRA", "fr_FR"}, // French (France)
274
275 { "FRL", "LUX", "fr_LU"}, // French (Luxembourg)
276
277 { "FRM", "MCO", "fr_MC"}, // French (Principality of Monaco)
278
279 { "FRS", "CHE", "fr_CH"}, // French (Switzerland)
280
281 { "FYN", "NLD", "fy_NL"}, // Frisian (Netherlands)
282
283 { "GLC", "ESP", "gl_ES"}, // Galician (Galician)
284
285 { "KAT", "GEO", "ka_GE"}, // Georgian (Georgia)
286
287 { "DEA", "AUT", "de_AT"}, // German (Austria)
288
289 { "DEU", "DEU", "de_DE"}, // German (Germany)
290
291 { "DEC", "LIE", "de_LI"}, // German (Liechtenstein)
292
293 { "DEL", "LUX", "de_LU"}, // German (Luxembourg)
294
295 { "DES", "CHE", "de_CH"}, // German (Switzerland)
296
297 { "ELL", "GRC", "el_GR"}, // Greek (Greece)
298
299 { "KAL", "GRL", "kl_GL"}, // Greenlandic (Greenland)
300
301 { "GUJ", "IND", "gu_IN"}, // Gujarati (India)
302
303 { "HEB", "ISR", "he_IL"}, // Hebrew (Israel)
304
305 { "HIN", "IND", "hi_IN"}, // Hindi (India)
306
307 { "HUN", "HUN", "hu_HU"}, // Hungarian (Hungary)
308
309 { "ISL", "ISL", "is_IS"}, // Icelandic (Iceland)
310
311 { "IBO", "NGA", "ig_NG"}, // Igbo (Nigeria)
312
313 { "IND", "IDN", "id_ID"}, // Indonesian (Indonesia)
314
315 { "IRE", "IRL", "ga_IE"}, // Irish (Ireland)
316
317 { "XHO", "ZAF", "xh_ZA"}, // isiXhosa (South Africa)
318
319 { "ZUL", "ZAF", "zu_ZA"}, // isiZulu (South Africa)
320
321 { "ITA", "ITA", "it_IT"}, // Italian (Italy)
322
323 { "ITS", "CHE", "it_CH"}, // Italian (Switzerland)
324
325 { "JPN", "JPN", "ja_JP"}, // Japanese (Japan)
326
327 { "KDI", "IND", "kn_IN"}, // Kannada (India)
328
329 { "KKZ", "KAZ", "kk_KZ"}, // Kazakh (Kazakhstan)
330
331 { "KHM", "KHM", "km_KH"}, // Khmer (Cambodia)
332
333 { "KIN", "RWA", "rw_RW"}, // Kinyarwanda (Rwanda)
334
335 { "SWK", "KEN", "sw_KE"}, // Kiswahili (Kenya)
336
337 { "KOR", "KOR", "ko_KR"}, // Korean (Korea)
338
339 { "KYR", "KGZ", "ky_KG"}, // Kyrgyz (Kyrgyzstan)
340
341 { "LAO", "LAO", "lo_LA"}, // Lao (Lao P.D.R.)
342
343 { "LVI", "LVA", "lv_LV"}, // Latvian (Latvia)
344
345 { "LTH", "LTU", "lt_LT"}, // Lithuanian (Lithuania)
346
347 { "LBX", "LUX", "lb_LU"}, // Luxembourgish (Luxembourg)
348
349 { "MKI", "MKD", "mk_MK"}, // Macedonian (Former Yugoslav Republic of Macedonia)
350
351 { "MSB", "BRN", "ms_BN"}, // Malay (Brunei Darussalam)
352
353 { "MSL", "MYS", "ms_MY"}, // Malay (Malaysia)
354
355 { "MYM", "IND", "ml_IN"}, // Malayalam (India)
356
357 { "MLT", "MLT", "mt_MT"}, // Maltese (Malta)
358
359 { "MRI", "NZL", "mi_NZ"}, // Maori (New Zealand)
360
361 { "MAR", "IND", "mr_IN"}, // Marathi (India)
362
363 { "MON", "MNG", "mn_MN"}, // Mongolian (Cyrillic, Mongolia)
364
365 { "NEP", "NEP", "ne_NP"}, // Nepali (Nepal)
366
367 { "NOR", "NOR", "nb_NO"}, // Norwegian, Bokmå(Norway)
368
369 { "NON", "NOR", "nn_NO"}, // Norwegian, Nynorsk (Norway)
370
371 { "OCI", "FRA", "oc_FR"}, // Occitan (France)
372
373 { "ORI", "IND", "or_IN"}, // Oriya (India)
374
375 { "PAS", "AFG", "ps_AF"}, // Pashto (Afghanistan)
376
377 { "FAR", "IRN", "fa_IR"}, // Persian
378
379 { "PLK", "POL", "pl_PL"}, // Polish (Poland)
380
381 { "PTB", "BRA", "pt_BR"}, // Portuguese (Brazil)
382
383 { "PTG", "PRT", "pt_PT"}, // Portuguese (Portugal)
384
385 { "PAN", "IND", "pa_IN"}, // Punjabi (India)
386
387 { "ROM", "ROM", "ro_RO"}, // Romanian (Romania)
388
389 { "RMC", "CHE", "rm_CH"}, // Romansh (Switzerland)
390
391 { "RUS", "RUS", "ru_RU"}, // Russian (Russia)
392
393 { "SMG", "FIN", "se_FI"}, // Sami, Northern (Finland)
394
395 { "SME", "NOR", "se_NO"}, // Sami, Northern (Norway)
396
397 { "SMF", "SWE", "se_SE"}, // Sami, Northern (Sweden)
398
399 { "SAN", "IND", "sa_IN"}, // Sanskrit (India)
400
401 { "TSN", "ZAF", "tn_ZA"}, // Setswana (South Africa)
402
403 { "SIN", "LKA", "si_LK"}, // Sinhala (Sri Lanka)
404
405 { "SKY", "SVK", "sk_SK"}, // Slovak (Slovakia)
406
407 { "SLV", "SVN", "sl_SI"}, // Slovenian (Slovenia)
408
409 { "ESS", "ARG", "es_AR"}, // Spanish (Argentina)
410
411 { "ESB", "BOL", "es_BO"}, // Spanish (Bolivia)
412
413 { "ESL", "CHL", "es_CL"}, // Spanish (Chile)
414
415 { "ESO", "COL", "es_CO"}, // Spanish (Colombia)
416
417 { "ESC", "CRI", "es_CR"}, // Spanish (Costa Rica)
418
419 { "ESD", "DOM", "es_DO"}, // Spanish (Dominican Republic)
420
421 { "ESF", "ECU", "es_EC"}, // Spanish (Ecuador)
422
423 { "ESE", "SLV", "es_SV"}, // Spanish (El Salvador)
424
425 { "ESG", "GTM", "es_GT"}, // Spanish (Guatemala)
426
427 { "ESH", "HND", "es_HN"}, // Spanish (Honduras)
428
429 { "ESM", "MEX", "es_MX"}, // Spanish (Mexico)
430
431 { "ESI", "NIC", "es_NI"}, // Spanish (Nicaragua)
432
433 { "ESA", "PAN", "es_PA"}, // Spanish (Panama)
434
435 { "ESZ", "PRY", "es_PY"}, // Spanish (Paraguay)
436
437 { "ESR", "PER", "es_PE"}, // Spanish (Peru)
438
439 { "ESU", "PRI", "es_PR"}, // Spanish (Puerto Rico)
440
441 { "ESN", "ESP", "es_ES"}, // Spanish (Spain)
442
443 { "EST", "USA", "es_US"}, // Spanish (United States)
444
445 { "ESY", "URY", "es_UY"}, // Spanish (Uruguay)
446
447 { "ESV", "VEN", "es_VE"}, // Spanish (Venezuela)
448
449 { "SVF", "FIN", "sv_FI"}, // Swedish (Finland)
450
451 { "SVE", "SWE", "sv_SE"}, // Swedish (Sweden)
452
453 { "TAM", "IND", "ta_IN"}, // Tamil (India)
454
455 { "TTT", "RUS", "tt_RU"}, // Tatar (Russia)
456
457 { "TEL", "IND", "te_IN"}, // Telugu (India)
458
459 { "THA", "THA", "th_TH"}, // Thai (Thailand)
460
461 { "BOB", "CHN", "bo_CN"}, // Tibetan (PRC)
462
463 { "TRK", "TUR", "tr_TR"}, // Turkish (Turkey)
464
465 { "TUK", "TKM", "tk_TM"}, // Turkmen (Turkmenistan)
466
467 { "UIG", "CHN", "ug_CN"}, // Uighur (PRC)
468
469 { "UKR", "UKR", "uk_UA"}, // Ukrainian (Ukraine)
470
471 { "URD", "PAK", "ur_PK"}, // Urdu (Islamic Republic of Pakistan)
472
473 { "VIT", "VNM", "vi_VN"}, // Vietnamese (Vietnam)
474
475 { "CYM", "GBR", "cy_GB"}, // Welsh (United Kingdom)
476
477 { "WOL", "SEN", "wo_SN"}, // Wolof (Senegal)
478
479 { "III", "CHN", "ii_CN"}, // Yi (PRC)
480
481 { "YOR", "NGA", "yo_NG"}, // Yoruba (Nigeria)
482
483 { NULL,NULL,NULL}, // Default - Can't find the language / Language not listed above
484 };
485
486 static void
487 win_set_nls(void)
488 {
489 char country[32],lang[32];
490 int i=0;
491
492 #ifdef HAVE_API_WIN32_CE
493 wchar_t wcountry[32],wlang[32];
494 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, wlang, sizeof(wlang));
495 WideCharToMultiByte(CP_ACP,0,wlang,-1,lang,sizeof(lang),NULL,NULL);
496 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, wcountry, sizeof(wcountry));
497 WideCharToMultiByte(CP_ACP,0,wcountry,-1,country,sizeof(country),NULL,NULL);
498 #else
499 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, lang, sizeof(lang));
500 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, country, sizeof(country));
501 #endif
502 while (nls_table[i][0])
503 {
504 if (!strcmp(nls_table[i][0], lang) && !(strcmp(nls_table[i][1], country)))
505 {
506 dbg(1,"Setting LANG=%s for Lang %s Country %s\n",nls_table[i][2], lang, country);
507 setenv("LANG",nls_table[i][2],0);
508 return;
509 }
510 i++;
511 }
512 dbg(1,"Lang %s Country %s not found\n",lang,country);
513 }
514 #endif
515
516 void main_init(const char *program)
517 {
518 char *s;
519 #ifdef _UNICODE /* currently for wince */
520 wchar_t wfilename[MAX_PATH + 1];
521 #endif
522
523 spawn_process_init();
524
525 cbl = callback_list_new();
526 #ifdef HAVE_API_WIN32_BASE
527 win_set_nls();
528 #endif
529 setenv("LC_NUMERIC", "C", 1);
530 setlocale(LC_ALL, "");
531 setlocale(LC_NUMERIC, "C");
532 #if !defined _WIN32 && !defined _WIN32_WCE
533 if (file_exists("navit.c") || file_exists("navit.o") || file_exists("navit.lo") || file_exists("version.h"))
534 {
535 char buffer[PATH_MAX];
536 printf("Running from source directory\n");
537 getcwd(buffer, PATH_MAX); /* libc of navit returns "dummy" */
538 setenv("NAVIT_PREFIX", buffer, 0);
539 main_setup_environment(0);
540 }
541 else
542 {
543 if (!getenv("NAVIT_PREFIX"))
544 {
545 int l;
546 int progpath_len;
547 char *progpath = "/bin/navit";
548 l = strlen(program);
549 progpath_len = strlen(progpath);
550 if (l > progpath_len && !strcmp(program + l - progpath_len, progpath))
551 {
552 s = g_strdup(program);
553 s[l - progpath_len] = '\0';
554 if (strcmp(s, PREFIX))
555 {
556 // printf("setting '%s' to '%s'\n", "NAVIT_PREFIX", s);
557 }
558 setenv("NAVIT_PREFIX", s, 0);
559 g_free(s);
560 }
561 else
562 setenv("NAVIT_PREFIX", PREFIX, 0);
563 }
564 #ifdef HAVE_API_ANDROID
565 main_setup_environment(3);
566 #else
567 main_setup_environment(1);
568 #endif
569 }
570
571 #else /* _WIN32 || _WIN32_WCE */
572 if (!getenv("NAVIT_PREFIX"))
573 {
574 char filename[MAX_PATH + 1],
575 *end;
576
577 *filename = '\0';
578 #ifdef _UNICODE /* currently for wince */
579 if (GetModuleFileNameW(NULL, wfilename, MAX_PATH))
580 {
581 wcstombs(filename, wfilename, MAX_PATH);
582 #else
583 if (GetModuleFileName(NULL, filename, MAX_PATH))
584 {
585 #endif
586 end = strrchr(filename, L'\\'); /* eliminate the file name which is on the right side */
587 if(end)
588 *end = '\0';
589 }
590 setenv("NAVIT_PREFIX", filename, 0);
591 }
592 if (!getenv("HOME"))
593 setenv("HOME", getenv("NAVIT_PREFIX"), 0);
594 main_setup_environment(2);
595 #endif /* _WIN32 || _WIN32_WCE */
596
597 if (getenv("LC_ALL"))
598 dbg(0, "Warning: LC_ALL is set, this might lead to problems (e.g. strange positions from GPS)\n");
599 s = getenv("NAVIT_WID");
600 if (s)
601 {
602 setenv("SDL_WINDOWID", s, 0);
603 }
604 }
605
606 void main_init_nls(void)
607 {
608 #ifdef ENABLE_NLS
609 #ifdef FORCE_LOCALE
610 #define STRINGIFY2(x) #x
611 #define STRINGIFY(x) STRINGIFY2(x)
612 setlocale(LC_MESSAGES,STRINGIFY(FORCE_LOCALE));
613 #endif
614 bindtextdomain(PACKAGE, getenv("NAVIT_LOCALEDIR"));
615 bind_textdomain_codeset (PACKAGE, "UTF-8");
616 textdomain(PACKAGE);
617 #endif
618 }

   
Visit the ZANavi Wiki