Fixed a typo.
[AROS.git] / workbench / tools / HDToolBox / locale.c
blob0c88000bfe415aa7199383e0a1f27d944433e6bd
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define CATCOMP_ARRAY
7 #include <proto/exec.h>
8 #include <proto/locale.h>
9 #include <proto/alib.h>
10 #include <libraries/locale.h>
11 #include "strings.h"
13 #include "locale.h"
15 /*********************************************************************************************/
17 struct Catalog *catalog;
18 struct Locale *locale;
20 void InitLocale(STRPTR catname, ULONG version)
22 #ifdef __AROS__
23 LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library", 39);
24 #else
25 LocaleBase = (struct Library *)OpenLibrary("locale.library", 39);
26 #endif
27 if (LocaleBase)
29 catalog = OpenCatalog(NULL, catname, OC_Version, version, TAG_DONE);
30 locale = OpenLocale(NULL);
34 /*********************************************************************************************/
36 void CleanupLocale(void)
38 if (locale) CloseLocale(locale);
39 if (catalog) CloseCatalog(catalog);
40 if (LocaleBase) CloseLibrary((struct Library *)LocaleBase);
43 /*********************************************************************************************/
45 CONST_STRPTR MSG(ULONG id)
47 CONST_STRPTR retval;
49 if (catalog)
51 retval = GetCatalogStr(catalog, id, CatCompArray[id].cca_Str);
52 } else {
53 retval = CatCompArray[id].cca_Str;
56 return retval;
59 CONST_STRPTR MSG_STD(ULONG id) {
60 CONST_STRPTR retval;
62 if (locale)
64 retval = GetLocaleStr(locale, id);
66 else
68 retval = "Error";
70 return retval;
73 /*********************************************************************************************/