<!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"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Boost.Locale: Getting information about the current locale</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<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>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</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><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){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> &ndash; 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> &ndash; 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> &ndash; 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> &ndash; 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> &ndash; 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> &ndash; a fast way to check whether the encoding is UTF-8.</li>
</ul>
<p>For example:</p>
<div class="fragment"><div class="line">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;</div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->

    <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>
