Created
January 11, 2016 23:36
-
-
Save lutter/b3929c6b9052bd7164a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <locale> | |
#include <boost/locale.hpp> | |
int main() { | |
boost::locale::generator gen; | |
std::locale loc = gen(""); | |
std::string lang = std::use_facet<boost::locale::info>(loc).language(); | |
std::string country = std::use_facet<boost::locale::info>(loc).country(); | |
std::cout << "Locale: " << loc.name() << std::endl; | |
std::cout << "Lang: " << lang << std::endl; | |
std::cout << "Country: " << country << std::endl; | |
return 0; | |
} | |
/* Compile with | |
opt/pl-build-tools/bin/g++ -std=c++11 -o loc -I /opt/pl-build-tools/include/ \ | |
-L /opt/pl-build-tools/lib -lboost_locale \ | |
-Wl,-rpath="/opt/pl-build-tools/lib" loc.cc | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment