[tutorial][Base-utils] Ulocale tutorial improved.
authorRadoslaw Czerski <r.czerski@samsung.com>
Tue, 11 Aug 2015 13:36:41 +0000 (15:36 +0200)
committerJakub Siewierski <j.siewierski@samsung.com>
Wed, 12 Aug 2015 14:12:42 +0000 (16:12 +0200)
Change-Id: Ifece7ccf6e9c30facdb1817d33d3417a0ba0f169
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
Signed-off-by: Jakub Siewierski <j.siewierski@samsung.com>
org.tizen.tutorials/html/native/base/i18n_tutorial_n.htm

index 84f8787..7330c12 100644 (file)
@@ -506,15 +506,74 @@ i18n_udate_destroy(date_format);
 </pre></li>
 <li>To manage locale information:
 <ul>
-<li>To get the language associated with a locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_language()</span> function. Provide the locale symbol (such as &quot;en_US&quot; or &quot;ko_KR&quot; - the supported locales are defined in the API as <span style="font-family: Courier New,Courier,monospace">I18N_ULOCALE_*</span>), a buffer to the language code, the size of the buffer, and a variable to store the actual length of the language code.
+<li>To get the language code associated with a locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_language()</span> function. Provide the:
+<ul><li>Locale symbol (such as &quot;en_US&quot; or &quot;ko_KR&quot; - the supported locales are defined in the API as <span style="font-family: Courier New,Courier,monospace">I18N_ULOCALE_*</span>)</li>
+<li>Buffer for the language code</li>
+<li>The size of the buffer</li>
+<li>Variable to store the actual length of the language code</li>
+</ul>
 <pre class="prettyprint">
-#define BUFLEN 400
-
 char language[BUFLEN];
 int lang_len;
 i18n_ulocale_get_language(I18N_ULOCALE_GERMANY, language, BUFLEN, &amp;lang_len);
 </pre></li>
 
+<li>To get the language ISO-3 code for the specified locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_language()</span> function. The argument is the locale.
+<pre class="prettyprint">const char *language_iso = i18n_ulocale_get_iso3_language(I18N_ULOCALE_GERMANY);
+</pre>
+</li>
+
+<li>To get the full name of language for the specified locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_display_language()</span> function. The parameters are:
+<ul>
+       <li>Locale to get the full language name of</li>
+       <li>Locale to localize the language name (specifies the language of the obtained name)</li>
+       <li>Buffer for the name</li>
+       <li>Size of the buffer</li>
+       <li>Variable to store the actual size of the language name</li>
+</ul>
+<pre class="prettyprint">
+char *locale = I18N_ULOCALE_FRENCH;
+i18n_uchar language_name[BUFLEN];
+int lang_len;
+i18n_ulocale_get_display_language(locale, I18N_ULOCALE_GERMANY, language_name, BUFLEN, &amp;lang_len);
+</pre>
+<p>In this example, the name of the &quot;fr_CA&quot; locale is obtained in German.</p></li>
+
+<li>To get the line orientation for the specified locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_line_orientation()</span> function.
+ The  parameters are:
+ <ul>
+ <li>Locale to get the line orientation of</li>
+ <li>Variable to store the returned orientation</li>
+ </ul>
+ <pre class="prettyprint">
+char *locale = I18N_ULOCALE_ENGLISH;
+i18n_ulocale_layout_type_e type;
+i18n_ulocale_get_line_orientation(locale, &amp;type);
+</pre></li>
+
+<li>To get the character orientation for the specified locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_character_orientation()</span> function.
+   The parameters are:<ul>
+ <li>Locale to get the character orientation of</li>
+ <li>Variable to store the returned orientation</li>
+ </ul>
+ <pre class="prettyprint">
+char *locale = I18N_ULOCALE_ENGLISH;
+i18n_ulocale_layout_type_e type;
+i18n_ulocale_get_character_orientation(locale, &amp;type);
+</pre></li>
+
+<li>To get the variant code for the specified locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_variant()</span> function. The parameters are:
+<ul>
+       <li>Locale to get the variant code of</li>
+       <li>Buffer for the variant</li>
+       <li>Size of the buffer</li>
+</ul>
+<pre class="prettyprint">
+char *locale = I18N_ULOCALE_ENGLISH;
+char *variant = malloc(sizeof(char) * BUFLEN);
+int32_t variant_len = i18n_ulocale_get_variant(locale, variant, BUFLEN);
+</pre><p>The function returns the actual size of the variant</p></li>
+
 <li>To get a full name for the specified locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_get_display_name()</span> function. The parameters are:
 <ul>
        <li>Locale to get the full name of</li>
@@ -534,10 +593,11 @@ i18n_ulocale_get_display_name(I18N_ULOCALE_CANADA_FRENCH, I18N_ULOCALE_GERMANY,
 <pre class="prettyprint">
 char *locale;
 i18n_ulocale_get_default(&amp;locale);
-</pre>
-<p>To set the default locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_set_default()</span> function.</p>
+</pre></li>
+<li>To set the default locale, use the <span style="font-family: Courier New,Courier,monospace">i18n_ulocale_set_default()</span> function.
 <pre class="prettyprint">
-i18n_ulocale_set_default(I18N_ULOCALE_KOREA);</pre></li></ul></li>
+i18n_ulocale_set_default(I18N_ULOCALE_KOREA);</pre></li>
+</ul></li>
 </ol>
 
 <h2 id="numbers" name="numbers">Managing Numbers</h2>