Release 950620
[wine] / misc / ole2nls.c
1 /*
2  *      OLE2NLS library
3  *
4  *      Copyright 1995  Martin von Loewis
5  */
6
7 /*      At the moment, these are only empty stubs.
8  */
9
10 #include <string.h>
11 #include "windows.h"
12 #include "ole.h"
13 #include "winnls.h"
14 #include "stddebug.h"
15 #include "debug.h"
16
17 /***********************************************************************
18  *           GetUserDefaultLCID       (OLE2NLS.1)
19  */
20 DWORD WINAPI GetUserDefaultLCID()
21 {
22 /* Default sorting, neutral sublanguage */
23 #if #LANG(En)
24         return 9;
25 #elif #LANG(De)
26         return 7;
27 #elif #LANG(No)
28         return 0x14;
29 #else
30         /* Neutral language */
31         return 0;
32 #endif
33 }
34
35 /***********************************************************************
36  *         GetSystemDefaultLCID       (OLE2NLS.2)
37  */
38 DWORD WINAPI GetSystemDefaultLCID()
39 {
40         return GetUserDefaultLCID();
41 }
42
43 /***********************************************************************
44  *         GetUserDefaultLangID       (OLE2NLS.3)
45  */
46 WORD WINAPI GetUserDefaultLangID()
47 {
48         return (WORD)GetUserDefaultLCID();
49 }
50
51 /***********************************************************************
52  *         GetSystemDefaultLangID     (OLE2NLS.4)
53  */
54 WORD WINAPI GetSystemDefaultLangID()
55 {
56         return GetUserDefaultLangID();
57 }
58
59 /***********************************************************************
60  *         GetLocaleInfoA             (OLE2NLS.5)
61  * Is the last parameter really WORD for Win16?
62  */
63 int WINAPI GetLocaleInfoA(DWORD lcid,DWORD LCType,LPSTR buf,WORD len)
64 {
65         char *retString;
66     int retLen;
67     dprintf_ole(stddeb,"GetLocaleInfoA(%8lX,%8lX,%p,%4X)\n",
68                         lcid,LCType,buf,len);
69         /* Wine is supporting only the default locale */
70         if(lcid!=GetUserDefaultLCID())
71         {
72                 dprintf_ole(stdnimp,"GetLocaleInfoA: Unknown locale\n");
73                 return 0;
74         }
75         /* As an option, we could obtain the value from win.ini.
76            This would not match the Wine compile-time option.
77            Also, not all identifiers are available from win.ini */
78         retString=0;
79         retLen=0;
80         /* If we are through all of this, retLen should not be zero anymore.
81            If it is, the value is not supported */
82 #define LOCVAL(type,value)      if(type==LCType)                        \
83                                                                 {retLen=strlen(value)+1;\
84                                                                  retString=value;       \
85                                                                 }
86 #define UNSUPPORTED(type)   if(type==lcid)retString=#type;
87
88 /* I really wish I would know a better way to do this */
89 UNSUPPORTED(LOCALE_ILANGUAGE)
90 UNSUPPORTED(LOCALE_SLANGUAGE)
91 UNSUPPORTED(LOCALE_SENGLANGUAGE)
92 UNSUPPORTED(LOCALE_SABBREVLANGNAME)
93 UNSUPPORTED(LOCALE_SNATIVELANGNAME)
94 UNSUPPORTED(LOCALE_ICOUNTRY)
95 UNSUPPORTED(LOCALE_SCOUNTRY)
96 UNSUPPORTED(LOCALE_SENGCOUNTRY)
97 UNSUPPORTED(LOCALE_SABBREVCTRYNAME)
98 UNSUPPORTED(LOCALE_SNATIVECTRYNAME)
99 UNSUPPORTED(LOCALE_IDEFAULTLANGUAGE)
100 UNSUPPORTED(LOCALE_IDEFAULTCOUNTRY)
101 UNSUPPORTED(LOCALE_IDEFAULTCODEPAGE)
102 UNSUPPORTED(LOCALE_IDEFAULTANSICODEPAGE)
103 UNSUPPORTED(LOCALE_SLIST)
104 UNSUPPORTED(LOCALE_IMEASURE)
105 UNSUPPORTED(LOCALE_SDECIMAL)
106 UNSUPPORTED(LOCALE_STHOUSAND)
107 UNSUPPORTED(LOCALE_SGROUPING)
108 UNSUPPORTED(LOCALE_IDIGITS)
109 UNSUPPORTED(LOCALE_ILZERO)
110 UNSUPPORTED(LOCALE_INEGNUMBER)
111 UNSUPPORTED(LOCALE_SNATIVEDIGITS)
112 UNSUPPORTED(LOCALE_SCURRENCY)
113 UNSUPPORTED(LOCALE_SINTLSYMBOL)
114 UNSUPPORTED(LOCALE_SMONDECIMALSEP)
115 UNSUPPORTED(LOCALE_SMONTHOUSANDSEP)
116 UNSUPPORTED(LOCALE_SMONGROUPING)
117 UNSUPPORTED(LOCALE_ICURRDIGITS)
118 UNSUPPORTED(LOCALE_IINTLCURRDIGITS)
119 UNSUPPORTED(LOCALE_ICURRENCY)
120 UNSUPPORTED(LOCALE_INEGCURR)
121 UNSUPPORTED(LOCALE_SDATE)
122 UNSUPPORTED(LOCALE_STIME)
123 UNSUPPORTED(LOCALE_SSHORTDATE)
124 UNSUPPORTED(LOCALE_SLONGDATE)
125 UNSUPPORTED(LOCALE_STIMEFORMAT)
126 UNSUPPORTED(LOCALE_IDATE)
127 UNSUPPORTED(LOCALE_ILDATE)
128 UNSUPPORTED(LOCALE_ITIME)
129 UNSUPPORTED(LOCALE_ITIMEMARKPOSN)
130 UNSUPPORTED(LOCALE_ICENTURY)
131 UNSUPPORTED(LOCALE_ITLZERO)
132 UNSUPPORTED(LOCALE_IDAYLZERO)
133 UNSUPPORTED(LOCALE_IMONLZERO)
134 UNSUPPORTED(LOCALE_S1159)
135 UNSUPPORTED(LOCALE_S2359)
136 UNSUPPORTED(LOCALE_ICALENDARTYPE)
137 UNSUPPORTED(LOCALE_IOPTIONALCALENDAR)
138 UNSUPPORTED(LOCALE_IFIRSTDAYOFWEEK)
139 UNSUPPORTED(LOCALE_IFIRSTWEEKOFYEAR)
140 UNSUPPORTED(LOCALE_SDAYNAME1)
141 UNSUPPORTED(LOCALE_SDAYNAME2)
142 UNSUPPORTED(LOCALE_SDAYNAME3)
143 UNSUPPORTED(LOCALE_SDAYNAME4)
144 UNSUPPORTED(LOCALE_SDAYNAME5)
145 UNSUPPORTED(LOCALE_SDAYNAME6)
146 UNSUPPORTED(LOCALE_SDAYNAME7)
147 UNSUPPORTED(LOCALE_SABBREVDAYNAME1)
148 UNSUPPORTED(LOCALE_SABBREVDAYNAME2)
149 UNSUPPORTED(LOCALE_SABBREVDAYNAME3)
150 UNSUPPORTED(LOCALE_SABBREVDAYNAME4)
151 UNSUPPORTED(LOCALE_SABBREVDAYNAME5)
152 UNSUPPORTED(LOCALE_SABBREVDAYNAME6)
153 UNSUPPORTED(LOCALE_SABBREVDAYNAME7)
154 UNSUPPORTED(LOCALE_SMONTHNAME1)
155 UNSUPPORTED(LOCALE_SMONTHNAME2)
156 UNSUPPORTED(LOCALE_SMONTHNAME3)
157 UNSUPPORTED(LOCALE_SMONTHNAME4)
158 UNSUPPORTED(LOCALE_SMONTHNAME5)
159 UNSUPPORTED(LOCALE_SMONTHNAME6)
160 UNSUPPORTED(LOCALE_SMONTHNAME7)
161 UNSUPPORTED(LOCALE_SMONTHNAME8)
162 UNSUPPORTED(LOCALE_SMONTHNAME9)
163 UNSUPPORTED(LOCALE_SMONTHNAME10)
164 UNSUPPORTED(LOCALE_SMONTHNAME11)
165 UNSUPPORTED(LOCALE_SMONTHNAME12)
166 UNSUPPORTED(LOCALE_SMONTHNAME13)
167 UNSUPPORTED(LOCALE_SABBREVMONTHNAME1)
168 UNSUPPORTED(LOCALE_SABBREVMONTHNAME2)
169 UNSUPPORTED(LOCALE_SABBREVMONTHNAME3)
170 UNSUPPORTED(LOCALE_SABBREVMONTHNAME4)
171 UNSUPPORTED(LOCALE_SABBREVMONTHNAME5)
172 UNSUPPORTED(LOCALE_SABBREVMONTHNAME6)
173 UNSUPPORTED(LOCALE_SABBREVMONTHNAME7)
174 UNSUPPORTED(LOCALE_SABBREVMONTHNAME8)
175 UNSUPPORTED(LOCALE_SABBREVMONTHNAME9)
176 UNSUPPORTED(LOCALE_SABBREVMONTHNAME10)
177 UNSUPPORTED(LOCALE_SABBREVMONTHNAME11)
178 UNSUPPORTED(LOCALE_SABBREVMONTHNAME12)
179 UNSUPPORTED(LOCALE_SABBREVMONTHNAME13)
180 UNSUPPORTED(LOCALE_SPOSITIVESIGN)
181 UNSUPPORTED(LOCALE_SNEGATIVESIGN)
182 UNSUPPORTED(LOCALE_IPOSSIGNPOSN)
183 UNSUPPORTED(LOCALE_INEGSIGNPOSN)
184 UNSUPPORTED(LOCALE_IPOSSYMPRECEDES)
185 UNSUPPORTED(LOCALE_IPOSSEPBYSPACE)
186 UNSUPPORTED(LOCALE_INEGSYMPRECEDES)
187 UNSUPPORTED(LOCALE_INEGSEPBYSPACE)
188
189 /* Now, the language specific definitions. They don't have to be
190    complete */
191 #if #LANG(De)
192 /* This definitions apply to Germany only. Users in Austria 
193    or Switzerland might want to modify them */
194 LOCVAL(LOCALE_ILANGUAGE,"9")
195 LOCVAL(LOCALE_SLANGUAGE,"Deutsch")
196 LOCVAL(LOCALE_SENGLANGUAGE,"German")
197 LOCVAL(LOCALE_SABBREVLANGNAME,"deu")
198 LOCVAL(LOCALE_SNATIVELANGNAME,"Deutsch")
199 LOCVAL(LOCALE_ICOUNTRY,"49")
200 LOCVAL(LOCALE_SCOUNTRY,"Deutschland")
201 LOCVAL(LOCALE_SENGCOUNTRY,"Deutschland")
202 LOCVAL(LOCALE_SABBREVCTRYNAME,"De")
203 LOCVAL(LOCALE_SNATIVECTRYNAME,"Deutschland")
204 LOCVAL(LOCALE_IDEFAULTLANGUAGE,"9")
205 LOCVAL(LOCALE_IDEFAULTCOUNTRY,"49")
206 /* Dunno
207 LOCVAL(LOCALE_IDEFAULTCODEPAGE)
208 LOCVAL(LOCALE_IDEFAULTANSICODEPAGE)
209 */
210 LOCVAL(LOCALE_SLIST,";")
211 LOCVAL(LOCALE_IMEASURE,"0")
212 LOCVAL(LOCALE_SDECIMAL,",")
213 LOCVAL(LOCALE_STHOUSAND,".")
214 /*
215 LOCVAL(LOCALE_SGROUPING)
216 */
217 LOCVAL(LOCALE_IDIGITS,"2")
218 LOCVAL(LOCALE_ILZERO,"1")
219 /*
220 LOCVAL(LOCALE_INEGNUMBER)
221 Is this "0123456789" ??
222 LOCVAL(LOCALE_SNATIVEDIGITS)
223 */
224 LOCVAL(LOCALE_SCURRENCY,"DM")
225 /*
226 LOCVAL(LOCALE_SINTLSYMBOL)
227 LOCVAL(LOCALE_SMONDECIMALSEP)
228 LOCVAL(LOCALE_SMONTHOUSANDSEP)
229 LOCVAL(LOCALE_SMONGROUPING)
230 */
231 LOCVAL(LOCALE_ICURRDIGITS,"2")
232 /*
233 LOCVAL(LOCALE_IINTLCURRDIGITS)
234 */
235 LOCVAL(LOCALE_ICURRENCY,"3")
236 LOCVAL(LOCALE_INEGCURR,"8")
237 LOCVAL(LOCALE_SDATE,".")
238 LOCVAL(LOCALE_STIME,":")
239 LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yyyy")
240 LOCVAL(LOCALE_SLONGDATEi,"ddd, d. MMMM yyyy")
241 /*
242 LOCVAL(LOCALE_STIMEFORMAT)
243 */
244 LOCVAL(LOCALE_IDATE,"1")
245 /*
246 LOCVAL(LOCALE_ILDATE)
247 */
248 LOCVAL(LOCALE_ITIME,"1")
249 /*
250 LOCVAL(LOCALE_ITIMEMARKPOSN)
251 LOCVAL(LOCALE_ICENTURY)
252 */
253 LOCVAL(LOCALE_ITLZERO,"1")
254 /*
255 LOCVAL(LOCALE_IDAYLZERO)
256 LOCVAL(LOCALE_IMONLZERO)
257 LOCVAL(LOCALE_S1159)
258 LOCVAL(LOCALE_S2359)
259 LOCVAL(LOCALE_ICALENDARTYPE)
260 LOCVAL(LOCALE_IOPTIONALCALENDAR)
261 LOCVAL(LOCALE_IFIRSTDAYOFWEEK)
262 LOCVAL(LOCALE_IFIRSTWEEKOFYEAR)
263 */
264 LOCVAL(LOCALE_SDAYNAME1,"Montag")
265 LOCVAL(LOCALE_SDAYNAME2,"Dienstag")
266 LOCVAL(LOCALE_SDAYNAME3,"Mittwoch")
267 LOCVAL(LOCALE_SDAYNAME4,"Donnerstag")
268 LOCVAL(LOCALE_SDAYNAME5,"Freitag")
269 LOCVAL(LOCALE_SDAYNAME6,"Sonnabend")
270 LOCVAL(LOCALE_SDAYNAME7,"Sonntag")
271 LOCVAL(LOCALE_SABBREVDAYNAME1,"Mo")
272 LOCVAL(LOCALE_SABBREVDAYNAME2,"Di")
273 LOCVAL(LOCALE_SABBREVDAYNAME3,"Mi")
274 LOCVAL(LOCALE_SABBREVDAYNAME4,"Do")
275 LOCVAL(LOCALE_SABBREVDAYNAME5,"Fr")
276 LOCVAL(LOCALE_SABBREVDAYNAME6,"Sa")
277 LOCVAL(LOCALE_SABBREVDAYNAME7,"So")
278 LOCVAL(LOCALE_SMONTHNAME1,"Januar")
279 LOCVAL(LOCALE_SMONTHNAME2,"Februar")
280 LOCVAL(LOCALE_SMONTHNAME3,"März")
281 LOCVAL(LOCALE_SMONTHNAME4,"April")
282 LOCVAL(LOCALE_SMONTHNAME5,"Mai")
283 LOCVAL(LOCALE_SMONTHNAME6,"Juni")
284 LOCVAL(LOCALE_SMONTHNAME7,"Juli")
285 LOCVAL(LOCALE_SMONTHNAME8,"August")
286 LOCVAL(LOCALE_SMONTHNAME9,"September")
287 LOCVAL(LOCALE_SMONTHNAME10,"Oktober")
288 LOCVAL(LOCALE_SMONTHNAME11,"November")
289 LOCVAL(LOCALE_SMONTHNAME12,"Dezember")
290 LOCVAL(LOCALE_SMONTHNAME13,"")
291 LOCVAL(LOCALE_SABBREVMONTHNAME1,"Jan")
292 LOCVAL(LOCALE_SABBREVMONTHNAME2,"Feb")
293 LOCVAL(LOCALE_SABBREVMONTHNAME3,"Mär")
294 LOCVAL(LOCALE_SABBREVMONTHNAME4,"Apr")
295 LOCVAL(LOCALE_SABBREVMONTHNAME5,"Mai")
296 LOCVAL(LOCALE_SABBREVMONTHNAME6,"Jun")
297 LOCVAL(LOCALE_SABBREVMONTHNAME7,"Jul")
298 LOCVAL(LOCALE_SABBREVMONTHNAME8,"Aug")
299 LOCVAL(LOCALE_SABBREVMONTHNAME9,"Sep")
300 LOCVAL(LOCALE_SABBREVMONTHNAME10,"Okt")
301 LOCVAL(LOCALE_SABBREVMONTHNAME11,"Nov")
302 LOCVAL(LOCALE_SABBREVMONTHNAME12,"Dez")
303 LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
304 /*
305 LOCVAL(LOCALE_SPOSITIVESIGN)
306 LOCVAL(LOCALE_SNEGATIVESIGN)
307 LOCVAL(LOCALE_IPOSSIGNPOSN)
308 LOCVAL(LOCALE_INEGSIGNPOSN)
309 LOCVAL(LOCALE_IPOSSYMPRECEDES)
310 LOCVAL(LOCALE_IPOSSEPBYSPACE)
311 LOCVAL(LOCALE_INEGSYMPRECEDES)
312 LOCVAL(LOCALE_INEGSEPBYSPACE)
313 */
314 #endif /* LANG(De) */
315
316 /*Insert other languages here*/
317
318
319
320         if(!retLen)
321         {
322                 if(!retString)fprintf(stderr,"Unkown LC type %lX\n",LCType);
323                 else fprintf(stderr,"'%s' not supported for your language.\n",
324                         retString);
325                 return 0;
326         }
327
328         if(retLen>len)retLen=len;
329         strncpy(buf,retString,len);
330         return retLen;
331 }