xref: /haiku/src/system/libroot/add-ons/icu/ICUMessagesData.cpp (revision c80809a3ab0b0a2ce53ea861a2b00ace24ff452d)
1 /*
2  * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "ICUMessagesData.h"
8 
9 #include <langinfo.h>
10 #include <string.h>
11 
12 
13 namespace BPrivate {
14 namespace Libroot {
15 
16 
17 void
18 ICUMessagesData::Initialize(LocaleMessagesDataBridge* dataBridge)
19 {
20 	fPosixLanginfo = dataBridge->posixLanginfo;
21 }
22 
23 
24 status_t
25 ICUMessagesData::SetTo(const Locale& locale, const char* posixLocaleName)
26 {
27 	status_t result = inherited::SetTo(locale, posixLocaleName);
28 
29 	// TODO: open the "POSIX" catalog and fetch the translations from there!
30 
31 	return result;
32 }
33 
34 
35 status_t
36 ICUMessagesData::SetToPosix()
37 {
38 	status_t result = inherited::SetToPosix();
39 
40 	strcpy(fYesExpression, fPosixLanginfo[YESEXPR]);
41 	strcpy(fNoExpression, fPosixLanginfo[NOEXPR]);
42 
43 	return result;
44 }
45 
46 
47 const char*
48 ICUMessagesData::GetLanginfo(int index)
49 {
50 	switch(index) {
51 		case YESEXPR:
52 			return fYesExpression;
53 		case NOEXPR:
54 			return fNoExpression;
55 		default:
56 			return "";
57 	}
58 }
59 
60 
61 }	// namespace Libroot
62 }	// namespace BPrivate
63