UNPKG

boost-react-native-bundle

Version:

Boost library as in https://sourceforge.net/projects/boost/files/boost/1.57.0/

104 lines (86 loc) 4.85 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>Boost.Locale: Getting information about the current locale</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="boost-small.png"/></td> <td style="padding-left: 0.5em;"> <div id="projectname">Boost.Locale </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.6.1 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('locale_information.html',''); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <div class="title">Getting information about the current locale </div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><p>The <code>std::locale::name</code> function provides very limited information about a locale. Such a name is platform- and compiler-dependent, and is useless for Boost.Locale. There is no way to change it, so for all locales created by Boost.Locale, <code>name()</code> returns the same value as <code>name()</code> for <code>std::locale::classic()</code>.</p> <p>Thus an additional facet was created, giving more precise information: <a class="el" href="classboost_1_1locale_1_1info.html" title="a facet that holds general information about locale">boost::locale::info</a>. It has the following member functions:</p> <ul> <li><a class="el" href="classboost_1_1locale_1_1info.html#af8181bf226f369548c030220932323b9">std::string name()</a> -- the full name of the locale, for example <code>en_US.UTF-8</code> </li> <li><a class="el" href="classboost_1_1locale_1_1info.html#a7c56b9df3aba82649afc66c06192c7df">std::string language()</a> -- the ISO-639 language code of the current locale, for example "en".</li> <li><a class="el" href="classboost_1_1locale_1_1info.html#a249c20e36da6827a8dc8b12a8342a7dc">std::string country()</a> -- the ISO-3199 country code of the current locale, for example "US".</li> <li><a class="el" href="classboost_1_1locale_1_1info.html#a2e949e4362c8f0195e2a645fe875f1b4">std::string variant()</a> -- the variant of current locale, for example "euro".</li> <li><a class="el" href="classboost_1_1locale_1_1info.html#a1979a5d7b90604c45e856a139c68f5ba">std::string encoding()</a> -- the encoding used for <code>char</code> based strings, for example "UTF-8"</li> <li><a class="el" href="classboost_1_1locale_1_1info.html#aafbbb5c291f60ce6fc3bc056859ba181">bool utf8()</a> -- a fast way to check whether the encoding is UTF-8.</li> </ul> <p>For example:</p> <div class="fragment"><pre class="fragment"> cout &lt;&lt; <span class="stringliteral">&quot;The language code is &quot;</span> &lt;&lt; std::use_facet&lt;boost::locale::info&gt;(some_locale).language() &lt;&lt; endl; </pre></div> </div></div><!-- contents --> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="index.html">Boost.Locale</a> </li> <li class="navelem"><a class="el" href="using_boost_locale.html">Using Boost.Locale</a> </li> <li class="footer"> &copy; Copyright 2009-2012 Artyom Beilis, Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License</a>, Version 1.0. </li> </ul> </div> </body> </html>