From 7ec2ef011782d6991007ecbfde3cd6fdcf1c3dd0 Mon Sep 17 00:00:00 2001 From: Radoslaw Czerski Date: Tue, 11 Aug 2015 15:36:41 +0200 Subject: [PATCH] [tutorial][Base-utils] Ulocale tutorial improved. Change-Id: Ifece7ccf6e9c30facdb1817d33d3417a0ba0f169 Signed-off-by: Radoslaw Czerski Signed-off-by: Jakub Siewierski --- .../html/native/base/i18n_tutorial_n.htm | 72 ++++++++++++++++++++-- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/org.tizen.tutorials/html/native/base/i18n_tutorial_n.htm b/org.tizen.tutorials/html/native/base/i18n_tutorial_n.htm index 84f8787..7330c12 100644 --- a/org.tizen.tutorials/html/native/base/i18n_tutorial_n.htm +++ b/org.tizen.tutorials/html/native/base/i18n_tutorial_n.htm @@ -506,15 +506,74 @@ i18n_udate_destroy(date_format);
  • To manage locale information:
      -
    • To get the language associated with a locale, use the i18n_ulocale_get_language() function. Provide the locale symbol (such as "en_US" or "ko_KR" - the supported locales are defined in the API as I18N_ULOCALE_*), a buffer to the language code, the size of the buffer, and a variable to store the actual length of the language code. +
    • To get the language code associated with a locale, use the i18n_ulocale_get_language() function. Provide the: +
      • Locale symbol (such as "en_US" or "ko_KR" - the supported locales are defined in the API as I18N_ULOCALE_*)
      • +
      • Buffer for the language code
      • +
      • The size of the buffer
      • +
      • Variable to store the actual length of the language code
      • +
      -#define BUFLEN 400
      -
       char language[BUFLEN];
       int lang_len;
       i18n_ulocale_get_language(I18N_ULOCALE_GERMANY, language, BUFLEN, &lang_len);
       
    • +
    • To get the language ISO-3 code for the specified locale, use the i18n_ulocale_get_language() function. The argument is the locale. +
      const char *language_iso = i18n_ulocale_get_iso3_language(I18N_ULOCALE_GERMANY);
      +
      +
    • + +
    • To get the full name of language for the specified locale, use the i18n_ulocale_get_display_language() function. The parameters are: +
        +
      • Locale to get the full language name of
      • +
      • Locale to localize the language name (specifies the language of the obtained name)
      • +
      • Buffer for the name
      • +
      • Size of the buffer
      • +
      • Variable to store the actual size of the language name
      • +
      +
      +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, &lang_len);
      +
      +

      In this example, the name of the "fr_CA" locale is obtained in German.

    • + +
    • To get the line orientation for the specified locale, use the i18n_ulocale_get_line_orientation() function. + The parameters are: +
        +
      • Locale to get the line orientation of
      • +
      • Variable to store the returned orientation
      • +
      +
      +char *locale = I18N_ULOCALE_ENGLISH;
      +i18n_ulocale_layout_type_e type;
      +i18n_ulocale_get_line_orientation(locale, &type);
      +
    • + +
    • To get the character orientation for the specified locale, use the i18n_ulocale_get_character_orientation() function. + The parameters are:
        +
      • Locale to get the character orientation of
      • +
      • Variable to store the returned orientation
      • +
      +
      +char *locale = I18N_ULOCALE_ENGLISH;
      +i18n_ulocale_layout_type_e type;
      +i18n_ulocale_get_character_orientation(locale, &type);
      +
    • + +
    • To get the variant code for the specified locale, use the i18n_ulocale_get_variant() function. The parameters are: +
        +
      • Locale to get the variant code of
      • +
      • Buffer for the variant
      • +
      • Size of the buffer
      • +
      +
      +char *locale = I18N_ULOCALE_ENGLISH;
      +char *variant = malloc(sizeof(char) * BUFLEN);
      +int32_t variant_len = i18n_ulocale_get_variant(locale, variant, BUFLEN);
      +

      The function returns the actual size of the variant

    • +
    • To get a full name for the specified locale, use the i18n_ulocale_get_display_name() function. The parameters are:
      • Locale to get the full name of
      • @@ -534,10 +593,11 @@ i18n_ulocale_get_display_name(I18N_ULOCALE_CANADA_FRENCH, I18N_ULOCALE_GERMANY,
         char *locale;
         i18n_ulocale_get_default(&locale);
        -
        -

        To set the default locale, use the i18n_ulocale_set_default() function.

        + +
      • To set the default locale, use the i18n_ulocale_set_default() function.
        -i18n_ulocale_set_default(I18N_ULOCALE_KOREA);
    • +i18n_ulocale_set_default(I18N_ULOCALE_KOREA); +
  • Managing Numbers

    -- 2.7.4