Permalink
Browse files

FreeBSD: use setlocale instead of std::locale

  • Loading branch information...
1 parent 5b1032a commit 168137790fbe165dfe76da33d5a86c21f2ca13b9 Fneufneu committed with spiff Feb 1, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 xbmc/LangInfo.cpp
View
@@ -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
{
@@ -174,6 +184,7 @@ void CLangInfo::CRegion::SetGlobalLocale()
}
locale::global(current_locale);
+#endif
CLog::Log(LOGINFO, "global locale set to %s", strLocale.c_str());
}

0 comments on commit 1681377

Please sign in to comment.