/* * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de * All rights reserved. Distributed under the terms of the MIT License. */ #include #include "LocaleBackend.h" #include using BPrivate::Libroot::gPosixLanginfo; using BPrivate::Libroot::GetCurrentLocaleBackend; using BPrivate::Libroot::LocaleBackend; using BPrivate::Libroot::LocaleBackendData; extern "C" char* nl_langinfo(nl_item item) { if (item < 0 || item >= _NL_LANGINFO_LAST) return const_cast(""); if (GetCurrentLocaleBackend() != NULL) return const_cast(GetCurrentLocaleBackend()->GetLanginfo(item)); return const_cast(gPosixLanginfo[item]); } extern "C" char* nl_langinfo_l(nl_item item, locale_t locale) { if (item < 0 || item >= _NL_LANGINFO_LAST) return const_cast(""); LocaleBackend* backend = ((LocaleBackendData*)locale)->backend; if (backend != NULL) return const_cast(backend->GetLanginfo(item)); return const_cast(gPosixLanginfo[item]); }