Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / identify / locale.c
blob6fca3d3ea600730d67b5a8370d919524eb059ee8
1 /*
2 * Copyright (c) 2010-2011 Matthias Rustler
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
22 * $Id$
25 #include <aros/symbolsets.h>
26 #include <exec/types.h>
27 #include <proto/locale.h>
29 #define CATCOMP_ARRAY
30 #include "strings.h"
32 #define CATALOG_NAME "System/Libs/Identify.catalog"
33 #define CATALOG_VERSION 1
35 /*** Variables **************************************************************/
36 static struct Catalog *catalog;
39 /*** Functions **************************************************************/
40 /* Main *********************************************************************/
41 CONST_STRPTR _(ULONG id)
43 ULONG arridx;
45 // we have defined message IDs in the *.cd file, so we must first search
46 // for the ID in the array
47 for
49 arridx = 0;
50 arridx < sizeof (CatCompArray) / sizeof (struct CatCompArrayType) - 1;
51 arridx++
54 if (CatCompArray[arridx].cca_ID == id)
56 break;
60 if (LocaleBase != NULL && catalog != NULL)
62 return GetCatalogStr(catalog, id, CatCompArray[arridx].cca_Str);
64 else
66 return CatCompArray[arridx].cca_Str;
70 /* Setup ********************************************************************/
71 BOOL Locale_Initialize(VOID)
73 if (LocaleBase != NULL)
75 catalog = OpenCatalog
77 NULL, CATALOG_NAME, OC_Version, CATALOG_VERSION, TAG_DONE
80 else
82 catalog = NULL;
85 return TRUE;
88 VOID Locale_Deinitialize(VOID)
90 if(LocaleBase != NULL && catalog != NULL) CloseCatalog(catalog);
93 ADD2INIT(Locale_Initialize, 90);
94 ADD2EXIT(Locale_Deinitialize, 90);