[base-utils][ACR-1260][LocaleDisplayNames] Module implementation 81/184081/5 accepted/tizen/unified/20180802.134854 submit/tizen/20180802.001134
authorTomasz Bocheński <t.bochenski@partner.samsung.com>
Thu, 10 May 2018 14:30:45 +0000 (16:30 +0200)
committerHyunjee Kim <hj0426.kim@samsung.com>
Wed, 18 Jul 2018 02:50:36 +0000 (11:50 +0900)
Change-Id: I23f31a9ea16ecfd11d324294e3d26461c2c00239
Signed-off-by: Tomasz Bocheński <t.bochenski@partner.samsung.com>
packaging/capi-base-utils.spec
src/CMakeLists.txt
src/include/utils_i18n.h
src/include/utils_i18n_loc_disp_names.h [new file with mode: 0644]
src/include/utils_i18n_types.h
src/utils_i18n_loc_disp_names.cpp [new file with mode: 0644]

index 6db4c12..137f55f 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-base-utils
 Summary:    Base Utils
-Version:    3.0.4
+Version:    3.1.4
 Release:    1
 Group:      Base
 License:    Apache-2.0 and ICU
index 31832b6..dc2c980 100755 (executable)
@@ -46,6 +46,7 @@ SET(BASEUTILS_SRCS
     utils_i18n_date_interval.cpp
     utils_i18n_date_interval_format.cpp
     utils_i18n_simple_date_format.cpp
+    utils_i18n_loc_disp_names.cpp
 )
 
 ADD_LIBRARY(${target_name} SHARED ${BASEUTILS_SRCS}
@@ -99,5 +100,6 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_immutable_idx.h
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_date_interval.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_date_interval_format.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_simple_date_format.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_loc_disp_names.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pc_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
index aa4c458..956055b 100644 (file)
@@ -51,6 +51,7 @@
 #include <utils_i18n_date_interval.h>
 #include <utils_i18n_date_interval_format.h>
 #include <utils_i18n_simple_date_format.h>
+#include <utils_i18n_loc_disp_names.h>
 
 /**
  * @file utils_i18n.h
@@ -95,6 +96,7 @@ extern "C" {
  *       - date interval
  *       - date interval format
  *       - simple date format
+ *       - locale display names
  *
  *        This module provides flexible generation of number or date format patterns and helps you format and parse dates/number for any locale.
  * The i18n module provides various features based on data from ICU. The following table shows the version of ICU used in each Tizen platform.
@@ -252,6 +254,8 @@ extern "C" {
  * <tr>
  *     <td>@ref CAPI_BASE_UTILS_I18N_SIMPLE_DATE_FORMAT_MODULE</td>
  *     <td>The Simple Date Format module provides API for formatting and parsing dates in language-independent manner.</td>
+ *     <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *     <td>The locale display names module returns display names of Locales and components of Locales.</td>
  * </tr>
  * </table>
  *
@@ -4102,6 +4106,80 @@ extern "C" {
  *    <td>@ref CAPI_BASE_UTILS_I18N_SIMPLE_DATE_FORMAT_MODULE</td>
  *    <td>#i18n_simple_date_fmt_set_context</td>
  *    <td>setContext</td>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_create</td>
+ *    <td>createInstance</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_create_from_dialect</td>
+ *    <td>createInstance</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_create_from_context</td>
+ *    <td>createInstance</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_destroy</td>
+ *    <td>~LocaleDisplayNames</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_locale</td>
+ *    <td>getLocale</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_dialect_handling</td>
+ *    <td>getDialectHandling</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_context</td>
+ *    <td>getContext</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_loc_disp_name</td>
+ *    <td>localeDisplayName</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_language_disp_name</td>
+ *    <td>languageDisplayName</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_script_disp_name</td>
+ *    <td>scriptDisplayName</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_script_disp_name_with_script_code</td>
+ *    <td>scriptDisplayName</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_region_disp_name</td>
+ *    <td>regionDisplayName</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_variant_disp_name</td>
+ *    <td>variantDisplayName</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_key_disp_name</td>
+ *    <td>keyDisplayName</td>
+ * </tr>
+ * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE</td>
+ *    <td>#i18n_loc_disp_names_get_key_value_disp_name</td>
+ *    <td>keyValueDisplayName</td>
  * </tr>
  * </table>
  */
diff --git a/src/include/utils_i18n_loc_disp_names.h b/src/include/utils_i18n_loc_disp_names.h
new file mode 100644 (file)
index 0000000..bbefbac
--- /dev/null
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#ifndef __UTILS_I18N_LOC_DISP_NAMES_H__
+#define __UTILS_I18N_LOC_DISP_NAMES_H__
+
+#include <utils_i18n_types.h>
+
+/**
+ * @file utils_i18n_loc_disp_names.h
+ * @version 0.1
+ * @brief utils_i18n_loc_disp_names
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup CAPI_BASE_UTILS_I18N_MODULE
+ * @defgroup CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE Locale display names
+ * @brief The locale display names module returns display names of Locales and components
+ *        of Locales.
+ * @section CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE Required Header
+ *         \#include <utils_i18n.h>
+ *
+ * @section CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE_OVERVIEW Overview
+ * @details The locale display names module returns display names of Locales and components
+ *          of Locales.
+ */
+
+/**
+ * @addtogroup CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a default locale display names object.
+ * @since_tizen 5.0
+ * @remarks The created object should be released by the caller with the
+ *            i18n_loc_disp_name_destroy() function.
+ *
+ * @param[in]    locale            The display locale
+ * @param[out]   loc_disp_names    The created locale display names object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_create(const char *locale, i18n_loc_disp_names_h *loc_disp_names);
+
+/**
+ * @brief Creates a locale display names object for the given dialect handling.
+ * @since_tizen 5.0
+ * @remarks The created object should be released by the caller with the
+ *            i18n_loc_disp_name_destroy() function.
+ *
+ * @param[in]    locale           The display locale
+ * @param[in]    dialect          The dialect handling
+ * @param[out]   loc_disp_names   The created locale display names object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_create_from_dialect(const char *locale, i18n_udialect_handling_e dialect,
+                                               i18n_loc_disp_names_h *loc_disp_names);
+
+/**
+ * @brief Creates a locale display names object for given display contexts.
+ * @since_tizen 5.0
+ * @remarks The created object should be released by the caller with the
+ *            i18n_loc_disp_name_destroy() function.
+ *
+ * @param[in]    locale            The display locale
+ * @param[in]    contexts          Display contexts
+ * @param[in]    length            Number of items in the context list
+ * @param[out]   loc_disp_names    The created locale display names object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_create_from_context(const char *locale, i18n_udisplay_context_e *contexts,
+                                               int32_t length, i18n_loc_disp_names_h *loc_disp_names);
+
+/**
+ * @brief Destroys the locale display names object.
+ * @since_tizen 5.0
+ *
+ * @param[in]  loc_disp_names   The locale display names object to be destroyed
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ */
+int i18n_loc_disp_names_destroy(i18n_loc_disp_names_h loc_disp_names);
+
+/**
+ * @brief Gets the locale used by the given locale display names object to determinate
+          the display names.
+ * @since_tizen 5.0
+ * @remarks The returned locale should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names      The locale display names object
+ * @param[out]  locale              The display locale
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ */
+int i18n_loc_disp_names_get_locale(i18n_loc_disp_names_h loc_disp_names, char **locale);
+
+/**
+ * @brief Gets the dialect handling used by the given locale display names object.
+ * @since_tizen 5.0
+ *
+ * @param[in]   loc_disp_names      The locale display names object
+ * @param[out]  handling            The dialect handling
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ */
+int i18n_loc_disp_names_get_dialect_handling(i18n_loc_disp_names_h loc_disp_names,
+                                                i18n_udialect_handling_e *handling);
+
+/**
+ * @brief Gets the context from the given locale display names object.
+ * @since_tizen 5.0
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   type               The display context type
+ * @param[out]  context            The display context for the specific type
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ */
+int i18n_loc_disp_names_get_context(i18n_loc_disp_names_h loc_disp_names,
+                                       i18n_udisplay_context_type_e type,
+                                       i18n_udisplay_context_e *context);
+
+/**
+ * @brief Gets the display name of the provided locale.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   locale             The locale whose display name is to be returned
+ * @param[out]  name               The display name of the provided locale
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_loc_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                             const char *locale, char **name);
+
+/**
+ * @brief Gets the display name of the provided language code.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   language           The language code
+ * @param[out]  name               The display name of the provided language code
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_language_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                  const char *language, char **name);
+
+/**
+ * @brief Gets the display name of the script code provided as string.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   script             The script code string
+ * @param[out]  name               The display name of the provided script code
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_script_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                const char *script, char **name);
+
+/**
+ * @brief Gets the display name of the script code provided as enumeration.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   code               The script code number
+ * @param[out]  name               The display name of the provided region code
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_script_disp_name_with_script_code(i18n_loc_disp_names_h loc_disp_names,
+                                                                 i18n_uscript_code_e code, char **name);
+
+/**
+ * @brief Gets the display name of the provided region code.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   region             The region code
+ * @param[out]  name               The display name of the provided region code
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_region_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                const char *region, char **name);
+
+/**
+ * @brief Gets the display name of the provided variant.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   variant            The variant
+ * @param[out]  name               The display name of the provided variant
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_variant_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                 const char *variant, char **name);
+
+/**
+ * @brief Gets the display name of the provided locale key.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   key                The locale key name
+ * @param[out]  name               The display name of the provided locale key
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_key_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                             const char *key, char **name);
+
+/**
+ * @brief Gets the display name of the provided locale key-value.
+ * @since_tizen 5.0
+ * @remarks The returned name should be freed by the caller with free() function.
+ *
+ * @param[in]   loc_disp_names     The locale display names object
+ * @param[in]   key                The locale key name
+ * @param[in]   value              The locale key value
+ * @param[out]  name               The display name of the provided locale key
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE                 Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER    Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY        Out of memory
+ */
+int i18n_loc_disp_names_get_key_value_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                   const char *key, const char *value,
+                                                   char **name);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UTILS_I18N_LOC_DISP_NAMES_H__ */
index d38c43e..9b25e20 100644 (file)
@@ -4449,6 +4449,33 @@ typedef void *i18n_date_interval_fmt_h;
  * @}
  */
 
+/**
+* @addtogroup CAPI_BASE_UTILS_I18N_LOCALE_DISPLAY_NAMES_MODULE
+* @{
+*/
+
+/**
+ * @brief An #i18n_loc_disp_names_h handle.
+ * @details Use i18n_loc_disp_names_* functions to operate on #i18n_loc_disp_names_h objects.
+ * @since_tizen 5.0
+ */
+typedef void *i18n_loc_disp_names_h;
+
+/**
+ * @brief Types of dialect handling.
+ * @since_tizen 5.0
+ */
+typedef enum {
+       I18N_ULDN_STANDARD_NAMES = 0,           /**< Use standard names when generating a locale name,
+                                                    e.g. en_GB displays as 'English (United Kingdom)' */
+       I18N_ULDN_DIALECT_NAMES                 /**< Use dialect names, when generating a locale name,
+                                                    e.g. en_GB displays as 'British English' */
+} i18n_udialect_handling_e;
+
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/utils_i18n_loc_disp_names.cpp b/src/utils_i18n_loc_disp_names.cpp
new file mode 100644 (file)
index 0000000..f03cd2e
--- /dev/null
@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include <utils_i18n_loc_disp_names.h>
+#include <utils_i18n_ustring.h>
+#include <utils_i18n_private.h>
+
+#include <unicode/locdspnm.h>
+
+int i18n_loc_disp_names_create(const char *locale, i18n_loc_disp_names_h *loc_disp_names)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       Locale loc(locale, 0, 0, 0);
+       *loc_disp_names = LocaleDisplayNames::createInstance(loc);
+       retv_if(*loc_disp_names == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_create_from_dialect(const char *locale, i18n_udialect_handling_e dialect,
+                                               i18n_loc_disp_names_h *loc_disp_names)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       Locale loc(locale, 0, 0, 0);
+       *loc_disp_names = LocaleDisplayNames::createInstance(loc, (UDialectHandling)dialect);
+       retv_if(*loc_disp_names == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_create_from_context(const char *locale, i18n_udisplay_context_e *contexts,
+                                               int32_t length, i18n_loc_disp_names_h *loc_disp_names)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       Locale loc(locale, 0, 0, 0);
+       *loc_disp_names = LocaleDisplayNames::createInstance(loc, ((UDisplayContext *)contexts),
+               length);
+       retv_if(*loc_disp_names == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_destroy(i18n_loc_disp_names_h loc_disp_names)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       delete((LocaleDisplayNames *) loc_disp_names);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_locale(i18n_loc_disp_names_h loc_disp_names, char **locale)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(locale == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       Locale loc = ((LocaleDisplayNames *)loc_disp_names)->getLocale();
+       const char *locale_name = loc.getName();
+
+       int32_t len = strlen(locale_name);
+       *locale = (char *)realloc(*locale, len+1);
+
+       retv_if(*locale == NULL, I18N_ERROR_OUT_OF_MEMORY);
+       memset(*locale, 0x0, len+1);
+
+       COPY_STR(*locale, locale_name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_dialect_handling(i18n_loc_disp_names_h loc_disp_names,
+                                                i18n_udialect_handling_e *handling)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(handling == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UDialectHandling result = ((LocaleDisplayNames *)loc_disp_names)->getDialectHandling();
+       *handling = (i18n_udialect_handling_e)result;
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_context(i18n_loc_disp_names_h loc_disp_names,
+                                       i18n_udisplay_context_type_e type,
+                                       i18n_udisplay_context_e *context)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(context == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UDisplayContext result = ((LocaleDisplayNames *)loc_disp_names)->getContext(
+               (UDisplayContextType)type);
+       *context = (i18n_udisplay_context_e)result;
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_loc_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                             const char *locale, char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(locale == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->localeDisplayName(locale, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_language_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                  const char *language, char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(language == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->languageDisplayName(language, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_script_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                const char *script, char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(script == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->scriptDisplayName(script, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_script_disp_name_with_script_code(i18n_loc_disp_names_h loc_disp_names,
+                                                                 i18n_uscript_code_e code, char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->scriptDisplayName((UScriptCode)code, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_region_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                const char *region, char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(region == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->regionDisplayName(region, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_variant_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                 const char *variant, char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(variant == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->variantDisplayName(variant, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_key_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                             const char *key, char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(key == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->keyDisplayName(key, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}
+
+int i18n_loc_disp_names_get_key_value_disp_name(i18n_loc_disp_names_h loc_disp_names,
+                                                   const char *key, const char *value,
+                                                   char **name)
+{
+       retv_if(loc_disp_names == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(key == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(value == NULL, I18N_ERROR_INVALID_PARAMETER);
+       retv_if(name == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+       UnicodeString unicode_result;
+       ((LocaleDisplayNames *)loc_disp_names)->keyValueDisplayName(key, value, unicode_result);
+
+       const i18n_uchar *uchar_result = (i18n_uchar *)unicode_result.getTerminatedBuffer();
+
+       retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
+
+       retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
+
+       /*
+       * UTF-16 uses at least two bytes, growing up to four bytes as necessary,
+       * this is why we multiply UChar by 4.
+       */
+
+       int32_t char_len = 4*ulen+4;
+       char _name[char_len];
+       memset(_name, 0x0, char_len);
+       i18n_ustring_copy_au(_name, uchar_result);
+
+       int32_t len = strlen(_name);
+       *name = (char *) realloc(*name, len+1);
+
+       retv_if(*name == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+       memset(*name, 0x0, len+1);
+
+       COPY_STR(*name, _name, len+1);
+
+       return I18N_ERROR_NONE;
+}