Skip to content

Commit

Permalink
FreeBSD: use setlocale instead of std::locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Fneufneu authored and spiff committed May 10, 2011
1 parent 5b1032a commit 1681377
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xbmc/LangInfo.cpp
Expand Up @@ -159,6 +159,16 @@ void CLangInfo::CRegion::SetGlobalLocale()
// decimal separator is changed depending of the current language
// (ie. "," in French or Dutch instead of "."). This breaks atof() and
// others similar functions.
#if defined(__FreeBSD__)
// on FreeBSD libstdc++ is compiled with "generic" locale support
if (setlocale(LC_COLLATE, strLocale.c_str()) == NULL
|| setlocale(LC_CTYPE, strLocale.c_str()) == NULL)
{
strLocale = "C";
setlocale(LC_COLLATE, strLocale.c_str());
setlocale(LC_CTYPE, strLocale.c_str());
}
#else
locale current_locale = locale::classic(); // C-Locale
try
{
Expand All @@ -174,6 +184,7 @@ void CLangInfo::CRegion::SetGlobalLocale()
}

locale::global(current_locale);
#endif
CLog::Log(LOGINFO, "global locale set to %s", strLocale.c_str());
}

Expand Down

0 comments on commit 1681377

Please sign in to comment.