1/* 2 * Copyright 2010-2011, 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 13U_NAMESPACE_USE 14 15 16namespace BPrivate { 17namespace Libroot { 18 19 20ICUMessagesData::ICUMessagesData(pthread_key_t tlsKey) 21 : inherited(tlsKey) 22{ 23} 24 25 26void 27ICUMessagesData::Initialize(LocaleMessagesDataBridge* dataBridge) 28{ 29 fPosixLanginfo = dataBridge->posixLanginfo; 30} 31 32 33status_t 34ICUMessagesData::SetTo(const Locale& locale, const char* posixLocaleName) 35{ 36 status_t result = inherited::SetTo(locale, posixLocaleName); 37 38 // TODO: open the "POSIX" catalog and fetch the translations from there! 39 40 return result; 41} 42 43 44status_t 45ICUMessagesData::SetToPosix() 46{ 47 status_t result = inherited::SetToPosix(); 48 49 strcpy(fYesExpression, fPosixLanginfo[YESEXPR]); 50 strcpy(fNoExpression, fPosixLanginfo[NOEXPR]); 51 52 return result; 53} 54 55 56const char* 57ICUMessagesData::GetLanginfo(int index) 58{ 59 switch(index) { 60 case YESEXPR: 61 return fYesExpression; 62 case NOEXPR: 63 return fNoExpression; 64 default: 65 return ""; 66 } 67} 68 69 70} // namespace Libroot 71} // namespace BPrivate 72