8 #include "i18ninfo_argp.h"
10 #include <utils_i18n.h>
13 static int ASCIIDOC_FLAG = 0;
16 #define MS_TO_MIN 60000
17 #define MS_TO_HOUR 3600000
19 #define PRINT_ERROR_LOG(func_name, error_code) ({ fprintf(stderr, "\033[0;31m%s failed! Error: %s [code: %d] \033[0m\n", \
20 func_name, get_error_message(error_code), error_code); })
22 #define PRINT_DEBUG_LOG(fmt, arg...) ((DEBUG_FLAG) ? fprintf(stdout, "\033[0;32m" fmt "\033[1;32m \033[0m", ##arg) : 0 )
24 #define CHECK_ERROR(fun_name, error_code) if (error_code != 0) { \
25 PRINT_ERROR_LOG(fun_name, error_code); \
28 #define COPY_STR(dst, src, dst_len) do { \
29 strncpy((dst), (src), (dst_len + 1)); \
30 (dst)[(dst_len)] = '\0'; \
33 #define PRINT_ASCIIDOC_LOG(fmt) if (ASCIIDOC_FLAG) printf(fmt)
35 #define INT_ADD_RANGE_OVERFLOW(a, b) \
37 ? (a) < INT_MIN - (b) \
38 : INT_MAX - (b) < (a))
41 const char *default_locale = I18N_ULOCALE_UK;
43 i18n_udate_format_style_e eTimeFormatStyle[] = {
51 i18n_udate_format_style_e eDateFormatStyle[] = {
57 I18N_UDATE_LONG_RELATIVE,
58 I18N_UDATE_MEDIUM_RELATIVE,
59 I18N_UDATE_SHORT_RELATIVE,
64 const char *display_name;
70 static reordering_option reordering_options[N_OPTIONS] = {
71 {"I18N_UBIDI_KEEP_BASE_COMBINING", I18N_UBIDI_KEEP_BASE_COMBINING},
72 {"I18N_UBIDI_DO_MIRRORING", I18N_UBIDI_DO_MIRRORING},
73 {"I18N_UBIDI_INSERT_LRM_FOR_NUMERIC", I18N_UBIDI_INSERT_LRM_FOR_NUMERIC},
74 {"I18N_UBIDI_REMOVE_BIDI_CONTROLS", I18N_UBIDI_REMOVE_BIDI_CONTROLS},
75 {"I18N_UBIDI_OUTPUT_REVERSE", I18N_UBIDI_OUTPUT_REVERSE},
79 const char *display_name;
80 i18n_ubidi_reordering_mode_e mode;
83 #define N_MODES I18N_UBIDI_REORDER_COUNT
85 static reordering_mode reordering_modes[N_MODES] = {
86 {"I18N_UBIDI_REORDER_DEFAULT", I18N_UBIDI_REORDER_DEFAULT},
87 {"I18N_UBIDI_REORDER_NUMBERS_SPECIAL", I18N_UBIDI_REORDER_NUMBERS_SPECIAL},
88 {"I18N_UBIDI_REORDER_GROUP_NUMBERS_WITH_R", I18N_UBIDI_REORDER_GROUP_NUMBERS_WITH_R},
89 {"I18N_UBIDI_REORDER_RUNS_ONLY", I18N_UBIDI_REORDER_RUNS_ONLY},
90 {"I18N_UBIDI_REORDER_INVERSE_NUMBERS_AS_L", I18N_UBIDI_REORDER_INVERSE_NUMBERS_AS_L},
91 {"I18N_UBIDI_REORDER_INVERSE_LIKE_DIRECT", I18N_UBIDI_REORDER_INVERSE_LIKE_DIRECT},
92 {"I18N_UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL", I18N_UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL}
95 int n_date_enum_size = sizeof(eDateFormatStyle) / sizeof(eDateFormatStyle[0]);
96 int n_time_enum_size = sizeof(eTimeFormatStyle) / sizeof(eTimeFormatStyle[0]);
98 int n_enum_time_counter, n_enum_date_counter;
99 i18n_error_code_e error_code;
102 static void __get_available_locales();
103 static int __get_date_basic_format();
104 static int __get_date_and_time(char *input_time);
105 static int __get_number_format(const char *input_number);
106 static int __get_symbol();
107 static int __get_language_info();
108 static int __manage_string_iteration(char *custom_type);
109 static int __analyze_string(char *custom_string);
110 static int __get_timezone_info();
111 static int __get_tzdata_version();
113 char *__print_i18n_type_string(char *type, int num);
115 static void __get_available_locales()
117 const char *loc_list;
118 int32_t loc_count, i;
120 loc_count = i18n_ulocale_count_available();
121 if (loc_count == 0) {
123 } else if (loc_count < 0) {
126 PRINT_DEBUG_LOG("locale count : %d\n", loc_count);
127 for (i = 0; i < loc_count; i++) {
128 loc_list = i18n_ulocale_get_available(i);
129 printf("%s\n", loc_list);
134 char *__print_i18n_type_string(const char *type, int num)
136 char *str = (char*)calloc(300, sizeof(char));
137 PRINT_DEBUG_LOG("input type: %s, num: %d\n", type, num);
138 if (!strcmp(type, "time")) {
141 COPY_STR(str, "I18N_UDATE_FULL", strlen("I18N_UDATE_FULL"));
144 COPY_STR(str, "I18N_UDATE_LONG", strlen("I18N_UDATE_LONG"));
147 COPY_STR(str, "I18N_UDATE_MEDIUM", strlen("I18N_UDATE_MEDIUM"));
150 COPY_STR(str, "I18N_UDATE_SHORT", strlen("I18N_UDATE_SHORT"));
153 COPY_STR(str, "I18N_UDATE_NONE", strlen("I18N_UDATE_NONE"));
156 COPY_STR(str, "err", strlen("err"));
159 } else if (!strcmp(type, "date")) {
162 COPY_STR(str, "I18N_UDATE_FULL", strlen("I18N_UDATE_FULL"));
165 COPY_STR(str, "I18N_UDATE_LONG", strlen("I18N_UDATE_LONG"));
168 COPY_STR(str, "I18N_UDATE_MEDIUM", strlen("I18N_UDATE_MEDIUM"));
171 COPY_STR(str, "I18N_UDATE_SHORT", strlen("I18N_UDATE_SHORT"));
174 COPY_STR(str, "I18N_UDATE_RELATIVE", strlen("I18N_UDATE_RELATIVE"));
177 COPY_STR(str, "I18N_UDATE_LONG_RELATIVE", strlen("I18N_UDATE_LONG_RELATIVE"));
180 COPY_STR(str, "I18N_UDATE_MEDIUM_RELATIVE", strlen("I18N_UDATE_MEDIUM_RELATIVE"));
183 COPY_STR(str, "I18N_UDATE_SHORT_RELATIVE", strlen("I18N_UDATE_SHORT_RELATIVE"));
186 COPY_STR(str, "I18N_UDATE_NONE", strlen("I18N_UDATE_NONE"));
189 COPY_STR(str, "err", strlen("err"));
192 } else if (!strcmp(type, "number_format")) {
195 COPY_STR(str, "I18N_UNUMBER_DECIMAL", strlen("I18N_UNUMBER_DECIMAL"));
198 COPY_STR(str, "I18N_UNUMBER_CURRENCY", strlen("I18N_UNUMBER_CURRENCY"));
201 COPY_STR(str, "I18N_UNUMBER_PERCENT", strlen("I18N_UNUMBER_PERCENT"));
204 COPY_STR(str, "I18N_UNUMBER_SCIENTIFIC", strlen("I18N_UNUMBER_SCIENTIFIC"));
207 COPY_STR(str, "I18N_UNUMBER_SPELLOUT", strlen("I18N_UNUMBER_SPELLOUT"));
210 COPY_STR(str, "I18N_UNUMBER_ORDINAL", strlen("I18N_UNUMBER_ORDINAL"));
213 COPY_STR(str, "I18N_UNUMBER_DURATION", strlen("I18N_UNUMBER_DURATION"));
216 COPY_STR(str, "I18N_UNUMBER_NUMBERING_SYSTEM", strlen("I18N_UNUMBER_NUMBERING_SYSTEM"));
219 COPY_STR(str, "I18N_UNUMBER_PATTERN_RULEBASED", strlen("I18N_UNUMBER_PATTERN_RULEBASED"));
222 COPY_STR(str, "I18N_UNUMBER_CURRENCY_ISO", strlen("I18N_UNUMBER_CURRENCY_ISO"));
225 COPY_STR(str, "I18N_UNUMBER_CURRENCY_PLURAL", strlen("I18N_UNUMBER_CURRENCY_PLURAL"));
227 #if (__TIZEN_VER >= 4)
229 COPY_STR(str, "I18N_UNUMBER_CURRENCY_ACCOUNTING", strlen("I18N_UNUMBER_CURRENCY_ACCOUNTING"));
232 COPY_STR(str, "I18N_UNUMBER_CASH_CURRENCY", strlen("I18N_UNUMBER_CASH_CURRENCY"));
236 COPY_STR(str, "I18N_UNUMBER_FORMAT_STYLE_COUNT", strlen("I18N_UNUMBER_FORMAT_STYLE_COUNT"));
239 COPY_STR(str, "err", strlen("err"));
242 } else if (!strcmp(type, "symbol")) {
245 COPY_STR(str, "I18N_UNUMBER_DECIMAL_SEPARATOR_SYMBOL", strlen("I18N_UNUMBER_DECIMAL_SEPARATOR_SYMBOL"));
248 COPY_STR(str, "I18N_UNUMBER_GROUPING_SEPARATOR_SYMBOL", strlen("I18N_UNUMBER_GROUPING_SEPARATOR_SYMBOL"));
251 COPY_STR(str, "I18N_UNUMBER_PATTERN_SEPARATOR_SYMBOL", strlen("I18N_UNUMBER_PATTERN_SEPARATOR_SYMBOL"));
254 COPY_STR(str, "I18N_UNUMBER_PERCENT_SYMBOL", strlen("I18N_UNUMBER_PERCENT_SYMBOL"));
257 COPY_STR(str, "I18N_UNUMBER_ZERO_DIGIT_SYMBOL", strlen("I18N_UNUMBER_ZERO_DIGIT_SYMBOL"));
260 COPY_STR(str, "I18N_UNUMBER_DIGIT_SYMBOL", strlen("I18N_UNUMBER_DIGIT_SYMBOL"));
263 COPY_STR(str, "I18N_UNUMBER_MINUS_SIGN_SYMBOL", strlen("I18N_UNUMBER_MINUS_SIGN_SYMBOL"));
266 COPY_STR(str, "I18N_UNUMBER_PLUS_SIGN_SYMBOL", strlen("I18N_UNUMBER_PLUS_SIGN_SYMBOL"));
269 COPY_STR(str, "I18N_UNUMBER_CURRENCY_SYMBOL", strlen("I18N_UNUMBER_CURRENCY_SYMBOL"));
272 COPY_STR(str, "I18N_UNUMBER_INTL_CURRENCY_SYMBOL", strlen("I18N_UNUMBER_INTL_CURRENCY_SYMBOL"));
275 COPY_STR(str, "I18N_UNUMBER_MONETARY_SEPARATOR_SYMBOL", strlen("I18N_UNUMBER_MONETARY_SEPARATOR_SYMBOL"));
278 COPY_STR(str, "I18N_UNUMBER_EXPONENTIAL_SYMBOL", strlen("I18N_UNUMBER_EXPONENTIAL_SYMBOL"));
281 COPY_STR(str, "I18N_UNUMBER_PERMILL_SYMBOL", strlen("I18N_UNUMBER_PERMILL_SYMBOL"));
284 COPY_STR(str, "I18N_UNUMBER_PAD_ESCAPE_SYMBOL", strlen("I18N_UNUMBER_PAD_ESCAPE_SYMBOL"));
287 COPY_STR(str, "I18N_UNUMBER_INFINITY_SYMBOL", strlen("I18N_UNUMBER_INFINITY_SYMBOL"));
290 COPY_STR(str, "I18N_UNUMBER_NAN_SYMBOL", strlen("I18N_UNUMBER_NAN_SYMBOL"));
293 COPY_STR(str, "I18N_UNUMBER_SIGNIFICANT_DIGIT_SYMBOL", strlen("I18N_UNUMBER_SIGNIFICANT_DIGIT_SYMBOL"));
296 COPY_STR(str, "I18N_UNUMBER_MONETARY_GROUPING_SEPARATOR_SYMBOL", strlen("I18N_UNUMBER_MONETARY_GROUPING_SEPARATOR_SYMBOL"));
299 COPY_STR(str, "I18N_UNUMBER_ONE_DIGIT_SYMBOL", strlen("I18N_UNUMBER_ONE_DIGIT_SYMBOL"));
302 COPY_STR(str, "I18N_UNUMBER_TWO_DIGIT_SYMBOL", strlen("I18N_UNUMBER_TWO_DIGIT_SYMBOL"));
305 COPY_STR(str, "I18N_UNUMBER_THREE_DIGIT_SYMBOL", strlen("I18N_UNUMBER_THREE_DIGIT_SYMBOL"));
308 COPY_STR(str, "I18N_UNUMBER_FOUR_DIGIT_SYMBOL", strlen("I18N_UNUMBER_FOUR_DIGIT_SYMBOL"));
311 COPY_STR(str, "I18N_UNUMBER_FIVE_DIGIT_SYMBOL", strlen("I18N_UNUMBER_FIVE_DIGIT_SYMBOL"));
314 COPY_STR(str, "I18N_UNUMBER_SIX_DIGIT_SYMBOL", strlen("I18N_UNUMBER_SIX_DIGIT_SYMBOL"));
317 COPY_STR(str, "I18N_UNUMBER_SEVEN_DIGIT_SYMBOL", strlen("I18N_UNUMBER_SEVEN_DIGIT_SYMBOL"));
320 COPY_STR(str, "I18N_UNUMBER_EIGHT_DIGIT_SYMBOL", strlen("I18N_UNUMBER_EIGHT_DIGIT_SYMBOL"));
323 COPY_STR(str, "I18N_UNUMBER_NINE_DIGIT_SYMBOL", strlen("I18N_UNUMBER_NINE_DIGIT_SYMBOL"));
326 COPY_STR(str, "err", strlen("err"));
329 } else if (!strcmp(type, "iter_type")) {
332 COPY_STR(str, "I18N_UBRK_CHARACTER", strlen("I18N_UBRK_CHARACTER"));
335 COPY_STR(str, "I18N_UBRK_WORD", strlen("I18N_UBRK_WORD"));
338 COPY_STR(str, "I18N_UBRK_LINE", strlen("I18N_UBRK_LINE"));
341 COPY_STR(str, "I18N_UBRK_SENTENCE", strlen("I18N_UBRK_SENTENCE"));
344 COPY_STR(str, "err", strlen("err"));
348 PRINT_DEBUG_LOG("return string: %s\n", str);
352 static char *_date_basic_format_convert(const char *input_pattern, int i, const char *type)
355 i18n_udate_format_h format_h = NULL;
356 i18n_uchar timezone[BUF_SIZE] = {0, };
357 i18n_ustring_copy_ua_n(timezone, default_locale, BUF_SIZE);
358 i18n_uchar pattern[BUF_SIZE] = {0, };
359 i18n_ustring_copy_ua_n(pattern, input_pattern, BUF_SIZE);
360 ret = i18n_udate_create(I18N_UDATE_PATTERN, I18N_UDATE_PATTERN, default_locale, timezone, -1, pattern, -1, &format_h);
361 CHECK_ERROR("i18n_udate_create", ret);
363 i18n_udate date_now = 259200000;
365 if (!strcmp(type, "day")) {
366 date_now += i * 86400000;
367 } else if (!strcmp(type, "month")) {
369 for (k = 0; k < i; k++)
370 date_now += 2678400000;
372 i18n_ucalendar_get_now(&date_now);
375 i18n_uchar *result = (i18n_uchar *) malloc(BUF_SIZE * sizeof(i18n_uchar));
377 ret = i18n_udate_format_date(format_h, date_now, result, BUF_SIZE, NULL, &date_len);
378 CHECK_ERROR("i18n_udate_format_date", ret);
380 char *s = (char *)malloc(BUF_SIZE * sizeof(char));
381 i18n_ustring_copy_au(s, result);
382 i18n_udate_destroy(format_h);
385 PRINT_DEBUG_LOG("======%s\n", s);
389 static int __get_date_basic_format()
391 printf(" - To get basic date format\n");
392 printf("****************************************\n");
394 char *f_narrow, *f_short, *f_long, *s_narrow, *s_short, *s_long;
398 printf(" Day - Formatting\n");
399 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
400 PRINT_ASCIIDOC_LOG("|===\n");
401 printf("| # | %s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
402 for (i = 0; i < 7; i++) {
403 f_narrow = _date_basic_format_convert("EEEEE", i, "day");
404 f_short = _date_basic_format_convert("EEE", i, "day");
405 f_long = _date_basic_format_convert("EEEE", i, "day");
407 printf("| %d | %s | %s | %s\n", i, f_narrow, f_short, f_long);
413 PRINT_ASCIIDOC_LOG("|===\n");
416 printf(" Day - Stand-alone\n");
417 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
418 PRINT_ASCIIDOC_LOG("|===\n");
419 printf("| # | %-s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
420 for (i = 0; i < 7; i++) {
421 s_narrow = _date_basic_format_convert("ccccc", i, "day");
422 s_short = _date_basic_format_convert("ccc", i, "day");
423 s_long = _date_basic_format_convert("cccc", i, "day");
425 printf("| %d | %s | %s | %s\n", i, s_narrow, s_short, s_long);
431 PRINT_ASCIIDOC_LOG("|===\n");
434 printf(" Month - Formatting\n");
435 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
436 PRINT_ASCIIDOC_LOG("|===\n");
437 printf("| # | %-s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
438 for (i = 0; i < 12; i++) {
439 f_narrow = _date_basic_format_convert("MMMMM", i, "month");
440 f_short = _date_basic_format_convert("MMM", i, "month");
441 f_long = _date_basic_format_convert("MMMM", i, "month");
443 printf("| %-2d | %s | %s | %s\n", i, f_narrow, f_short, f_long);
449 PRINT_ASCIIDOC_LOG("|===\n");
451 //Month - stand-alone
452 printf(" Month - Stand-alone\n");
453 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
454 PRINT_ASCIIDOC_LOG("|===\n");
455 printf("| # | %s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
457 for (i = 0; i < 12; i++) {
458 s_narrow = _date_basic_format_convert("LLLLL", i, "month");
459 s_short = _date_basic_format_convert("LLL", i, "month");
460 s_long = _date_basic_format_convert("LLLL", i, "month");
462 printf("| %-2d | %s | %s | %s\n", i, s_narrow, s_short, s_long);
468 PRINT_ASCIIDOC_LOG("|===\n");
474 i18n_udate _time_convert(char *input_time)
476 i18n_ucalendar_h ucal;
478 int ret = I18N_ERROR_NONE;
479 int year, month, day, hour, minute, second;
482 strptime(input_time, "%Y%m%d%H%M%S", &result);
483 if (result.tm_year >= 100)
484 result.tm_year = result.tm_year%100 + 2000;
485 PRINT_DEBUG_LOG("Date from strptime, year:%d month:%d day:%d hour:%d minute:%d second:%d.\n", result.tm_year, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec);
487 /*create i18n_ucalendar_h */
488 ret = i18n_ucalendar_create(0, -1, NULL, I18N_UCALENDAR_DEFAULT, &ucal);
490 printf("i18n_ucalendar_create failed.\n");
494 /*set i18n_ucalendar_h's date */
495 i18n_ucalendar_set_date_time(ucal, result.tm_year, result.tm_mon, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec);
496 i18n_ucalendar_get(ucal, I18N_UCALENDAR_YEAR, &year);
497 i18n_ucalendar_get(ucal, I18N_UCALENDAR_MONTH, &month);
498 i18n_ucalendar_get(ucal, I18N_UCALENDAR_DATE, &day);
499 i18n_ucalendar_get(ucal, I18N_UCALENDAR_HOUR, &hour);
500 i18n_ucalendar_get(ucal, I18N_UCALENDAR_MINUTE, &minute);
501 i18n_ucalendar_get(ucal, I18N_UCALENDAR_SECOND, &second);
502 PRINT_DEBUG_LOG("Date from ucal, year:%d month:%d day:%d hour:%d minute:%d second:%d.\n", year, month, day, hour, minute, second);
503 /* get i18n_ucalendar's current time and converts it from milliseconds to seconds */
504 i18n_ucalendar_get_milliseconds(ucal, &date);
506 /* destroy i18n_ucalendar_h */
507 i18n_ucalendar_destroy(ucal);
512 static int __get_date_and_time(char *input_time)
515 printf(" - To get various date and time format\n");
516 printf("****************************************\n");
520 ret = i18n_ucalendar_get_now(&date_now);
521 CHECK_ERROR("i18n_ucalendar_get_now", ret);
522 PRINT_DEBUG_LOG("i18n_ucalendar_get_now = %lf\n", date_now);
524 date_now = _time_convert(input_time);
525 PRINT_DEBUG_LOG("_time_convert = %lf\n", date_now);
528 i18n_udate_format_h format_h = NULL;
529 i18n_udatepg_h udatepg;
530 ret = i18n_udatepg_create(default_locale, &udatepg);
531 CHECK_ERROR("i18n_udatepg_create", ret);
533 i18n_uchar format[BUF_SIZE];
534 i18n_ustring_copy_ua_n(format, "ddMMMyyyyHHmmssz", BUF_SIZE);
536 /* To get default time zone id */
539 i18n_uchar default_timezone_id[BUF_SIZE] = {0, };
541 ret = i18n_timezone_create_default(&tmz);
542 CHECK_ERROR("18n_timezone_create_default", ret);
543 ret = i18n_timezone_get_id(tmz, &timezone_id);
544 i18n_ustring_copy_ua_n(default_timezone_id, timezone_id, strlen(timezone_id));
546 int pattern_len, len;
547 i18n_uchar pattern[BUF_SIZE], skeleton[BUF_SIZE];
548 i18n_ustring_copy_ua(skeleton, I18N_UDATE_MONTH_DAY);
549 len = i18n_ustring_get_length(skeleton);
550 ret = i18n_udatepg_get_best_pattern(udatepg, skeleton, len, pattern, BUF_SIZE, &pattern_len);
551 CHECK_ERROR("i18n_udatepg_get_best_pattern", ret);
553 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
554 PRINT_ASCIIDOC_LOG("|===\n");
555 printf("| %-17.17s | %-26.26s | %s \n", "TIME TYPE" , "DATE TYPE" , "OUTPUT");
556 for (n_enum_date_counter = 0; n_enum_date_counter < n_date_enum_size; n_enum_date_counter++) {
557 for (n_enum_time_counter = 0; n_enum_time_counter < n_time_enum_size; n_enum_time_counter++) {
558 ret = i18n_udate_create(eTimeFormatStyle[n_enum_time_counter],
559 eDateFormatStyle[n_enum_date_counter],
560 default_locale, default_timezone_id, -1, pattern, -1, &format_h);
561 CHECK_ERROR("i18n_udate_create", ret);
563 i18n_uchar *result = (i18n_uchar *) malloc(BUF_SIZE * sizeof(i18n_uchar));
565 ret = i18n_udate_format_date(format_h, date_now, result, BUF_SIZE, NULL, &date_len);
566 CHECK_ERROR("i18n_udate_format_date", ret);
569 i18n_ustring_copy_au(s, result);
572 char *time_str, *date_str;
573 time_str = __print_i18n_type_string("time", n_enum_time_counter);
574 date_str = __print_i18n_type_string("date", n_enum_date_counter);
575 printf("| %-17.17s | %-26.26s | %s\n", time_str, date_str, s);
581 /* Release the time zone object. */
582 ret = i18n_udatepg_destroy(udatepg);
583 CHECK_ERROR("i18n_udatepg_destroy", ret);
584 ret = i18n_timezone_destroy(tmz);
585 CHECK_ERROR("i18n_timezone_destroy", ret);
587 PRINT_ASCIIDOC_LOG("|===\n");
591 static int __get_number_format(const char *input_number)
594 printf(" - To get various number format\n");
595 printf(" - Input number : %s\n", input_number);
596 printf("****************************************\n");
597 double my_number = atof(input_number);
598 PRINT_DEBUG_LOG("Input number = %f\n", my_number);
600 i18n_unumber_format_h num_format = NULL;
602 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
603 PRINT_ASCIIDOC_LOG("|===\n");
604 printf("| %-30.30s | %s\n", "NUMBER FORMAT" , "OUTPUT");
607 for (i = I18N_UNUMBER_DECIMAL; i <= I18N_UNUMBER_FORMAT_STYLE_COUNT; ++i) {
608 /* Create a number formatter. */
609 ret = i18n_unumber_create((i18n_unumber_format_style_e)i, NULL, -1, default_locale, NULL, &num_format);
610 CHECK_ERROR("i18n_unumber_create", ret);
612 /* Format the given number according to the given locale. */
613 i18n_uchar formatted_number[BUF_SIZE] = {0, };
614 i18n_unumber_format_double(num_format, my_number, formatted_number, BUF_SIZE, NULL);
616 /* Display the formatting result. */
617 char string[BUF_SIZE];
618 i18n_ustring_copy_au(string, formatted_number);
621 number_str = __print_i18n_type_string("number_format", i);
622 printf("| %-30.30s | %s\n", number_str, string);
625 PRINT_ASCIIDOC_LOG("|===\n");
627 /* Release the decimal number formatter. */
628 ret = i18n_unumber_destroy(num_format);
629 CHECK_ERROR("i18n_unumber_destroy", ret);
634 static int __get_symbol()
636 printf(" - To get various number symbol\n");
637 printf("****************************************\n");
639 /* Create a default number formatter. */
640 i18n_unumber_format_h num_format = NULL;
641 int ret = i18n_unumber_create(I18N_UNUMBER_DEFAULT, NULL, -1, default_locale, NULL, &num_format);
642 CHECK_ERROR("18n_unumber_create", ret);
646 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
647 PRINT_ASCIIDOC_LOG("|===\n");
648 printf("| %-47.47s | %s\n", "NUMBER SYMBOL" , "OUTPUT");
649 for (i = 0; i < I18N_UNUMBER_FORMAT_SYMBOL_COUNT; ++i) {
650 /* Format the selected symbol according to the chosen locale. */
652 i18n_uchar u_buffer[BUF_SIZE];
653 ret = i18n_unumber_get_symbol(num_format, (i18n_unumber_format_symbol_e)i, u_buffer, BUF_SIZE, &buf_len);
654 CHECK_ERROR("18n_unumber_get_symbol", ret);
656 /* Display the formatted symbol. */
657 char string[BUF_SIZE];
658 i18n_ustring_copy_au(string, u_buffer);
661 symbol_str = __print_i18n_type_string("symbol", i+1);
662 printf("| %-47.47s | %s\n", symbol_str, string);
665 PRINT_ASCIIDOC_LOG("|===\n");
667 /* Release the default number formatter object. */
668 ret = i18n_unumber_destroy(num_format);
669 CHECK_ERROR("i18n_unumber_destroy", ret);
674 static const char *layout_orientation_converter(i18n_ulocale_layout_type_e type)
677 case I18N_ULOCALE_LAYOUT_LTR:
680 case I18N_ULOCALE_LAYOUT_RTL:
683 case I18N_ULOCALE_LAYOUT_TTB:
686 case I18N_ULOCALE_LAYOUT_BTT:
695 static int __get_language_info()
697 printf(" - To get language information\n");
698 printf("****************************************\n");
700 i18n_uchar lang[BUF_SIZE];
702 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
703 PRINT_ASCIIDOC_LOG("|===\n");
704 printf("| KEY | VALUE\n");
706 /* Get the default locale code */
707 printf("| Default locale code | %s\n", default_locale);
709 /* Get the display name of the selected locale. */
710 i18n_uchar name[BUF_SIZE];
714 i18n_ulocale_get_display_name(default_locale, default_locale, name, BUF_SIZE, &name_len);
715 CHECK_ERROR("i18n_ulocale_get_display_name", ret);
716 char name_ch[BUF_SIZE];
717 i18n_ustring_copy_au(name_ch, name);
718 printf("| Language display name | %s\n", name_ch);
721 /* Get the language related to the selected locale. */
722 i18n_ulocale_get_display_language(default_locale, default_locale, lang, BUF_SIZE);
724 /* Get the string representation of the obtained language. */
725 char language[BUF_SIZE];
726 i18n_ustring_copy_au(language, lang);
727 printf("| Full name | %s\n", language);
729 /* Get the obtained language code. */
731 ret = i18n_ulocale_get_language(default_locale, language, BUF_SIZE, &lang_len);
732 CHECK_ERROR("i18n_ulocale_get_language", ret);
733 printf("| language code | %s\n", language);
735 /* Get the ISO code of the selected locale. */
736 const char *language_iso = i18n_ulocale_get_iso3_language(default_locale);
737 printf("| ISO code | %s\n", language_iso);
739 /* Get the type of the line orientation related to the selected locale. */
740 i18n_ulocale_layout_type_e type;
741 ret = i18n_ulocale_get_line_orientation(default_locale, &type);
742 CHECK_ERROR("i18n_ulocale_get_line_orientation", ret);
743 const char *orientation = layout_orientation_converter(type);
744 printf("| Line orientation | %s\n", orientation);
746 /* Get the characters orientation related to the selected locale. */
747 ret = i18n_ulocale_get_character_orientation(default_locale, &type);
748 CHECK_ERROR("i18n_ulocale_get_character_orientation", ret);
749 orientation = layout_orientation_converter(type);
750 printf("| Characters orientation | %s\n", orientation);
752 /* Get the variant code related to the selected locale. */
753 char variant[BUF_SIZE];
754 ret = i18n_ulocale_get_variant(default_locale, variant, BUF_SIZE);
755 CHECK_ERROR("i18n_ulocale_get_variant", ret);
756 printf("| variant code | %s\n", variant);
757 PRINT_ASCIIDOC_LOG("|===\n");
762 static int __manage_string_iteration(char *input_string)
764 printf(" - To manage the string iteration\n");
765 printf("****************************************\n");
767 PRINT_DEBUG_LOG("Input string : %s\n", input_string);
768 i18n_uchar *string_to_examine;
769 i18n_ubreak_iterator_h boundary;
772 const char *input_text = "Twinkle, twinkle, little star. How I wonder what you are";
773 printf(" - Input string : %s\n", input_text);
775 (i18n_uchar *) malloc(sizeof(i18n_uchar) * (strlen(input_text) + 1));
776 if(NULL == string_to_examine)
777 return I18N_ERROR_OUT_OF_MEMORY;
778 i18n_ustring_copy_ua(string_to_examine, input_text);
780 char input_text[1000] = {0, };
781 COPY_STR(input_text, input_string, 999);
782 printf(" - Input string : %s\n", input_text);
784 (i18n_uchar *) malloc(sizeof(i18n_uchar) * (strlen(input_text) + 1));
785 if(NULL == string_to_examine)
786 return I18N_ERROR_OUT_OF_MEMORY;
787 i18n_ustring_copy_ua(string_to_examine, input_text);
794 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
795 PRINT_ASCIIDOC_LOG("|===\n");
796 printf("| %-19.19s | %s\n", "ITER First", "VALUE");
798 /* Displays the first element in the given text */
799 for (i = 0; i <= I18N_UBRK_SENTENCE; i++) {
801 ret = i18n_ubrk_create((i18n_ubreak_iterator_type_e)i, default_locale, string_to_examine, -1, &boundary);
802 CHECK_ERROR("i18n_ubrk_create", ret);
803 int32_t start = i18n_ubrk_first(boundary);
804 int32_t end = i18n_ubrk_next(boundary);
805 i18n_uchar *result = (i18n_uchar *) malloc(sizeof(i18n_uchar) * (end - start + 1));
806 if (NULL == result) {
807 free(string_to_examine);
808 return I18N_ERROR_OUT_OF_MEMORY;
810 result[end - start] = '\0';
811 i18n_ustring_copy_n(result, &string_to_examine[start], end-start);
813 i18n_ustring_copy_au(str, result);
816 iter_type = __print_i18n_type_string("iter_type", i);
817 printf("| %-19.19s | %s\n", iter_type, str);
820 PRINT_ASCIIDOC_LOG("|===\n");
823 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
824 PRINT_ASCIIDOC_LOG("|===\n");
825 printf("| %-19.19s | %s\n", "ITER Last", "VALUE");
826 /* Displays the last element in the given text */
827 for (i = 0; i <= I18N_UBRK_SENTENCE; i++) {
829 ret = i18n_ubrk_create((i18n_ubreak_iterator_type_e)i, default_locale, string_to_examine, -1, &boundary);
830 CHECK_ERROR("i18n_ubrk_create", ret);
831 int32_t end = i18n_ubrk_last(boundary);
832 int32_t start = i18n_ubrk_previous(boundary);
833 i18n_uchar *result = (i18n_uchar *) malloc(sizeof(i18n_uchar) * (end - start + 1));
834 if (NULL == result) {
835 free(string_to_examine);
836 return I18N_ERROR_OUT_OF_MEMORY;
838 result[end - start] = '\0';
839 i18n_ustring_copy_n(result, &string_to_examine[start], end-start);
841 i18n_ustring_copy_au(str, result);
844 iter_type = __print_i18n_type_string("iter_type", i);
845 printf("| %-19.19s | %s\n", iter_type, str);
848 PRINT_ASCIIDOC_LOG("|===\n");
850 free(string_to_examine);
851 ret = i18n_ubrk_destroy(boundary);
852 CHECK_ERROR("i18n_ubrk_destroy", ret);
857 static int __analyze_string(char *custom_string)
859 printf(" - To manage the string\n");
860 printf("****************************************\n");
862 i18n_uchar *string_to_examine;
864 if (!custom_string) {
865 const char *input_text = "String";
866 printf(" - Input string : %s\n", input_text);
868 (i18n_uchar *) malloc(sizeof(i18n_uchar) * (strlen(input_text) + 1));
869 i18n_ustring_copy_ua(string_to_examine, input_text);
871 char *input_text = custom_string;
872 printf(" - Input string : %s\n", input_text);
874 (i18n_uchar *) malloc(sizeof(i18n_uchar) * (strlen(input_text) + 1));
875 i18n_ustring_copy_ua(string_to_examine, input_text);
878 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
879 PRINT_ASCIIDOC_LOG("|===\n");
880 printf("| KEY | VALUE\n");
883 int32_t len = i18n_ustring_get_length(string_to_examine);
884 printf("| Length | %d\n", len);
887 i18n_uchar dest[BUF_SIZE + 1];
888 i18n_ustring_to_upper(dest, BUF_SIZE + 1, string_to_examine, BUF_SIZE, NULL, &error_code);
889 CHECK_ERROR("i18n_ustring_to_upper", error_code);
892 i18n_ustring_copy_au(s, dest);
893 printf("| TO UPPER | %s\n", s);
896 i18n_ustring_to_lower(dest, BUF_SIZE + 1, string_to_examine, BUF_SIZE, NULL, &error_code);
897 CHECK_ERROR("i18n_ustring_to_lower", error_code);
898 i18n_ustring_copy_au(s, dest);
899 printf("| to lower | %s\n", s);
902 i18n_ustring_to_title_new(dest, BUF_SIZE + 1, string_to_examine, BUF_SIZE, NULL, NULL);
903 CHECK_ERROR("i18n_ustring_to_title_new", error_code);
904 i18n_ustring_copy_au(s, dest);
905 printf("| To Title | %s\n", s);
907 PRINT_ASCIIDOC_LOG("|===\n");
912 bool timezone_cb(const char *timezone_id, void *user_data)
914 printf("%s\n", timezone_id);
918 static int __get_available_timezone()
921 printf(" - To get the list of time zone");
922 printf("****************************************\n");
924 ret = i18n_timezone_foreach_timezone_id(timezone_cb, NULL);
925 CHECK_ERROR("i18n_timezone_foreach_timezone_id", ret);
930 static int __get_timezone_info(char *timezone_id)
933 printf(" - To get time zone information\n");
935 static i18n_timezone_h tmz;
936 i18n_uchar default_timezone_id[BUF_SIZE] = {0, };
939 /* Get the default timezone. */
940 ret = i18n_timezone_create_default(&tmz);
941 CHECK_ERROR("18n_timezone_create_default", ret);
942 ret = i18n_timezone_get_id(tmz, &timezone_id);
943 CHECK_ERROR("i18n_timezone_get_id", ret);
944 printf(" - Default timezone Id : %s\n", timezone_id);
946 ret = i18n_timezone_create(&tmz, timezone_id);
947 CHECK_ERROR("18n_timezone_create", ret);
948 printf(" - Input timezone Id : %s\n", timezone_id);
951 printf("****************************************\n");
953 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
954 PRINT_ASCIIDOC_LOG("|===\n");
955 printf("| KEY | VALUE\n");
957 /* Get the display name of the default or selected timezone. */
959 ret = i18n_timezone_get_display_name(tmz, &display_name);
960 CHECK_ERROR("i18n_timezone_get_display_name", ret);
961 printf("| Current timezone | %s\n", display_name);
963 /* Get the current time of the default or selected timezone. */
965 ret = i18n_ucalendar_get_now(&date_now);
966 CHECK_ERROR("i18n_ucalendar_get_now", ret);
967 PRINT_DEBUG_LOG("i18n_ucalendar_get_now = %lf\n", date_now);
969 i18n_udate_format_h format_h = NULL;
970 i18n_udatepg_h udatepg;
971 ret = i18n_udatepg_create("ko_KR", &udatepg);
972 CHECK_ERROR("i18n_udatepg_create", ret);
974 i18n_uchar format[BUF_SIZE] = {0, };
975 i18n_ustring_copy_ua_n(format, "ddMMMyyyyHHmmssz", BUF_SIZE);
977 int pattern_len = 0, len = 0;
978 i18n_uchar pattern[BUF_SIZE] = {0, }, skeleton[BUF_SIZE] = {0, };
979 i18n_ustring_copy_ua(skeleton, I18N_UDATE_MONTH_DAY);
980 len = i18n_ustring_get_length(skeleton);
981 ret = i18n_udatepg_get_best_pattern(udatepg, skeleton, len, pattern, BUF_SIZE, &pattern_len);
982 CHECK_ERROR("i18n_udatepg_get_best_pattern", ret);
984 i18n_ustring_copy_ua(default_timezone_id, timezone_id);
985 ret = i18n_udate_create(I18N_UDATE_FULL, I18N_UDATE_FULL, default_locale, default_timezone_id, -1, pattern, -1, &format_h);
986 CHECK_ERROR("i18n_udate_create", ret);
988 i18n_uchar result[BUF_SIZE] = {0, };
990 ret = i18n_udate_format_date(format_h, date_now, result, BUF_SIZE, NULL, &date_len);
991 CHECK_ERROR("i18n_udate_format_date", ret);
993 char s[BUF_SIZE] = {0, };
994 i18n_ustring_copy_au(s, result);
995 printf("| Current time | %s\n", s);
997 /* Get the selected timezone ID. */
998 ret = i18n_timezone_get_id(tmz, &timezone_id);
999 CHECK_ERROR("i18n_timezone_get_id", ret);
1000 printf("| Timezone ID | %s\n", timezone_id);
1002 /* Check whether the selected time zone uses daylight savings time or not. */
1003 i18n_ubool daylight_time;
1004 ret = i18n_timezone_use_daylight_time(tmz, &daylight_time);
1005 CHECK_ERROR("i18n_timezone_use_daylight_time", ret);
1006 printf("| Uses DST | %s\n", daylight_time ? "yes" : "no");
1009 * Get the amount of time that need to be added to the
1010 * local standard time to get the local wall clock time.
1012 int32_t dst_savings;
1013 ret = i18n_timezone_get_dst_savings(tmz, &dst_savings);
1014 CHECK_ERROR("i18n_timezone_get_dst_savings", ret);
1015 printf("| DST savings in [min] | %d\n", dst_savings / MS_TO_MIN);
1017 /* Get the selected time zone raw GMT offset. */
1018 int32_t offset_milliseconds;
1019 ret = i18n_timezone_get_raw_offset(tmz, &offset_milliseconds);
1020 CHECK_ERROR("i18n_timezone_get_raw_offset", ret);
1021 if (offset_milliseconds / MS_TO_HOUR > 0)
1022 printf("| Raw GMT offset | GMT +%d\n", offset_milliseconds / MS_TO_HOUR);
1024 printf("| Raw GMT offset | GMT %d\n", offset_milliseconds / MS_TO_HOUR);
1026 /* Get the region code associated with the selected time zone. */
1027 char region[BUF_SIZE];
1028 int32_t region_len = -1;
1029 ret = i18n_timezone_get_region(timezone_id, region, ®ion_len, BUF_SIZE);
1030 CHECK_ERROR("i18n_timezone_get_region", ret);
1031 printf("| Associated region code | %s\n", region);
1033 PRINT_ASCIIDOC_LOG("|===\n");
1035 /* Release the time zone object. */
1036 ret = i18n_udatepg_destroy(udatepg);
1037 CHECK_ERROR("i18n_udatepg_destroy", ret);
1038 ret = i18n_timezone_destroy(tmz);
1039 CHECK_ERROR("i18n_timezone_destroy", ret);
1046 static int __get_tzdata_version()
1048 const char *ver = i18n_timezone_get_tzdata_version();
1049 printf("tzdata version : %s\n", ver);
1050 printf("****************************************\n");
1055 static int32_t _get_uchar_length(const char *arr)
1057 int32_t ulen = strlen(arr);
1058 i18n_uchar _text[ulen + 1];
1059 i18n_ustring_copy_ua(_text, arr);
1061 return i18n_ustring_get_length(_text);
1064 static int __show_ubidi(char *input_text)
1066 printf(" - Examples of the Unicode Bidirectional Algorithm\n");
1067 printf(" - Input text : %s\n", input_text ? input_text : "Samsung is ﺱﺎﻤﺳﻮﻨﺟ in Arabic.");
1068 printf("****************************************\n");
1072 static i18n_ubidi_h ubidi;
1073 i18n_ubidi_create(&ubidi);
1076 text = "Samsung is سامسونج in Arabic";
1081 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
1082 PRINT_ASCIIDOC_LOG("|===\n");
1083 printf("| %-46.46s | %-34.34s | %s \n", "MODES", "OPTIONS", "OUTPUT");
1085 for (i = 0; i < N_MODES; i++) {
1086 /* Sets ubidi reordering mode */
1087 int ret = i18n_ubidi_set_reordering_mode(ubidi, reordering_modes[i].mode);
1088 CHECK_ERROR("i18n_ubidi_set_reordering_mode", ret);
1090 /* Sets ubidi paragraphs and perform the Unicode bidi algorithm */
1091 int src_length = _get_uchar_length(text);
1092 PRINT_DEBUG_LOG("src_length: %d\n", src_length);
1094 i18n_uchar *src = (i18n_uchar *) malloc(sizeof(i18n_uchar) * (src_length + 1));
1095 i18n_ustring_copy_ua(src, text);
1096 ret = i18n_ubidi_set_para(ubidi, src, src_length, I18N_UBIDI_DEFAULT_LTR, NULL);
1098 /* Writes ubidi reordered text to the entry with write_options */
1099 i18n_uchar dst[BUF_SIZE];
1100 int output_length = 0;
1102 for (j = 0; j < N_OPTIONS; j++) {
1103 ret = i18n_ubidi_write_reordered(ubidi, reordering_options[j].option, BUF_SIZE,
1104 dst, &output_length);
1105 CHECK_ERROR("i18n_ubidi_write_reordered", ret);
1107 char buffer[BUF_SIZE];
1108 i18n_ustring_copy_au(buffer, dst);
1109 printf("| %-46.46s | %-34.34s | %s \n", reordering_modes[i].display_name, reordering_options[j].display_name, buffer);
1113 PRINT_ASCIIDOC_LOG("|===\n");
1115 if (ubidi != NULL) {
1116 i18n_ubidi_destroy(ubidi);
1123 #if (__TIZEN_VER >= 4)
1124 int32_t _ustring_append_n(i18n_uchar *dest, int32_t dest_length, const i18n_uchar *src, int32_t src_length)
1126 for (int32_t i = 0; i < src_length; ++i) {
1127 dest[dest_length] = src[i];
1133 i18n_uchar *_convert_unicode_numeric_values(const i18n_uchar *input, int32_t length)
1137 int32_t output_length = 1;
1139 double *values = (double *) malloc(length * sizeof(double));
1140 int max_value_length = 0;
1142 /* Count output length */
1143 for (int32_t i = 0; i < length; ++i) {
1145 i18n_uchar_get_numeric_value(input[i], &value);
1147 if (value != I18N_U_NO_NUMERIC_VALUE) {
1148 int value_length = snprintf(NULL, 0, "%g", value);
1149 if (value_length > max_value_length)
1150 max_value_length = value_length;
1151 if (!INT_ADD_RANGE_OVERFLOW(output_length, value_length))
1152 output_length += value_length;
1154 if (!INT_ADD_RANGE_OVERFLOW(output_length, 1))
1159 /* +1 NULL terminator */
1160 if (!INT_ADD_RANGE_OVERFLOW(max_value_length, 1))
1161 max_value_length += 1;
1163 i18n_uchar *output = (i18n_uchar *) calloc(output_length, sizeof(input[0]));
1164 if (output == NULL) {
1168 i18n_ustring_mem_set(output, '\0', output_length);
1169 char *tmp = (char *) malloc((max_value_length) * sizeof(input[0]));
1170 i18n_uchar *c = (i18n_uchar *) malloc((max_value_length) * sizeof(input[0]));
1172 int32_t current_length = 0;
1173 for (int32_t i = 0; i < length; ++i) {
1174 double value = values[i];
1175 if (value != I18N_U_NO_NUMERIC_VALUE) {
1176 /* Convert double to i18n_uchar */
1183 snprintf(tmp, max_value_length, "%g", value);
1184 i18n_ustring_copy_ua_n(c, tmp, max_value_length);
1185 /* Append converted number to output string */
1186 int32_t src_length = i18n_ustring_get_length(c);
1187 current_length = _ustring_append_n(output, current_length, c, src_length);
1189 current_length = _ustring_append_n(output, current_length, input + i, 1);
1199 static int __convert_number(char *custom_number)
1201 printf(" - To convert the number\n");
1202 printf("****************************************\n");
1204 i18n_uchar *number_to_convert;
1206 if (!custom_number) {
1207 const char *input_number = "abc০১২৩def四五六ⅦⅧⅨ";
1208 printf(" Input number : %s\n", input_number);
1210 (i18n_uchar *) malloc(sizeof(i18n_uchar) * (strlen(input_number) + 1));
1211 if (NULL == number_to_convert)
1212 return I18N_ERROR_OUT_OF_MEMORY;
1214 i18n_ustring_copy_ua_n(number_to_convert, input_number, BUF_SIZE);
1216 i18n_uchar *str = _convert_unicode_numeric_values(number_to_convert, i18n_ustring_get_length(number_to_convert));
1218 printf("\nError: Out of memory.\n");
1219 free(number_to_convert);
1222 char p_string[BUF_SIZE];
1223 i18n_ustring_copy_au_n(p_string, str, BUF_SIZE);
1224 printf(" Convert number : %s\n", p_string);
1226 PRINT_ASCIIDOC_LOG("|===\n");
1229 char *input_number = custom_number;
1230 printf(" Input number : %s\n", input_number);
1232 (i18n_uchar *) malloc(sizeof(i18n_uchar) * (strlen(input_number) + 1));
1233 i18n_ustring_copy_ua(number_to_convert, input_number);
1235 i18n_uchar *str = _convert_unicode_numeric_values(number_to_convert, i18n_ustring_get_length(number_to_convert));
1237 printf("\nError: Out of memory.\n");
1238 free(number_to_convert);
1241 char p_string[BUF_SIZE];
1242 i18n_ustring_copy_au_n(p_string, str, BUF_SIZE);
1243 printf(" Convert number : %s\n", p_string);
1245 PRINT_ASCIIDOC_LOG("|===\n");
1247 free(number_to_convert);
1252 const char* unit_type;
1253 const char* unit_subtype;
1254 int (*fp)(i18n_measure_unit_h *measure_unit);
1257 struct create_mu mu[] = {
1258 {"acceleration", "g-force", i18n_measure_unit_create_g_force},
1259 {"acceleration", "meter-per-second-squared", i18n_measure_unit_create_meter_per_second_squared},
1260 {"angle", "arc-minute", i18n_measure_unit_create_arc_minute},
1261 {"angle", "arc-second", i18n_measure_unit_create_arc_second},
1262 {"angle", "degree", i18n_measure_unit_create_degree},
1263 {"angle", "radian", i18n_measure_unit_create_radian},
1264 {"area", "acre", i18n_measure_unit_create_acre},
1265 {"area", "hectare", i18n_measure_unit_create_hectare},
1266 {"area", "square-centimeter", i18n_measure_unit_create_square_centimeter},
1267 {"area", "square-foot", i18n_measure_unit_create_square_foot},
1268 {"area", "square-inch", i18n_measure_unit_create_square_inch},
1269 {"area", "square-kilometer", i18n_measure_unit_create_square_kilometer},
1270 {"area", "square-meter", i18n_measure_unit_create_square_meter},
1271 {"area", "square-mile", i18n_measure_unit_create_square_mile},
1272 {"area", "square-yard", i18n_measure_unit_create_square_yard},
1273 {"concentr", "karat", i18n_measure_unit_create_karat},
1274 {"consumption", "liter-per-kilometer", i18n_measure_unit_create_liter_per_kilometer},
1275 {"consumption", "mile-per-gallon", i18n_measure_unit_create_mile_per_gallon},
1276 {"digital", "bit", i18n_measure_unit_create_bit},
1277 {"digital", "byte", i18n_measure_unit_create_byte},
1278 {"digital", "gigabit", i18n_measure_unit_create_gigabit},
1279 {"digital", "gigabyte", i18n_measure_unit_create_gigabyte},
1280 {"digital", "kilobit", i18n_measure_unit_create_kilobit},
1281 {"digital", "kilobyte", i18n_measure_unit_create_kilobyte},
1282 {"digital", "megabit", i18n_measure_unit_create_megabit},
1283 {"digital", "megabyte", i18n_measure_unit_create_megabyte},
1284 {"digital", "terabit", i18n_measure_unit_create_terabit},
1285 {"digital", "terabyte", i18n_measure_unit_create_terabyte},
1286 {"duration", "day", i18n_measure_unit_create_day},
1287 {"duration", "hour", i18n_measure_unit_create_hour},
1288 {"duration", "microsecond", i18n_measure_unit_create_microsecond},
1289 {"duration", "milisecond", i18n_measure_unit_create_millisecond},
1290 {"duration", "minute", i18n_measure_unit_create_minute},
1291 {"duration", "month", i18n_measure_unit_create_month},
1292 {"duration", "nanosecond", i18n_measure_unit_create_nanosecond},
1293 {"duration", "second", i18n_measure_unit_create_second},
1294 {"duration", "week", i18n_measure_unit_create_week},
1295 {"duration", "year", i18n_measure_unit_create_year},
1296 {"electric", "ampere", i18n_measure_unit_create_ampere},
1297 {"electric", "miliampere", i18n_measure_unit_create_milliampere},
1298 {"electric", "ohm", i18n_measure_unit_create_ohm},
1299 {"electric", "volt", i18n_measure_unit_create_volt},
1300 {"energy", "calorie", i18n_measure_unit_create_calorie},
1301 {"energy", "foodcalorie", i18n_measure_unit_create_foodcalorie},
1302 {"energy", "joule", i18n_measure_unit_create_joule},
1303 {"energy", "kilocalorie", i18n_measure_unit_create_kilocalorie},
1304 {"energy", "kilojoule", i18n_measure_unit_create_kilojoule},
1305 {"energy", "kilowatt-hour", i18n_measure_unit_create_kilowatt_hour},
1306 {"frequency", "gigahertz", i18n_measure_unit_create_gigahertz},
1307 {"frequency", "hertz", i18n_measure_unit_create_hertz},
1308 {"frequency", "kilohertz", i18n_measure_unit_create_kilohertz},
1309 {"frequency", "megahertz", i18n_measure_unit_create_megahertz},
1310 {"length", "astronomical-unit", i18n_measure_unit_create_astronomical_unit},
1311 {"length", "centimeter", i18n_measure_unit_create_centimeter},
1312 {"length", "decimeter", i18n_measure_unit_create_decimeter},
1313 {"length", "fathom", i18n_measure_unit_create_fathom},
1314 {"length", "foot", i18n_measure_unit_create_foot},
1315 {"length", "furlong", i18n_measure_unit_create_furlong},
1316 {"length", "inch", i18n_measure_unit_create_inch},
1317 {"length", "kilometer", i18n_measure_unit_create_kilometer},
1318 {"length", "light-year", i18n_measure_unit_create_light_year},
1319 {"length", "meter", i18n_measure_unit_create_meter},
1320 {"length", "micrometer", i18n_measure_unit_create_micrometer},
1321 {"length", "mile", i18n_measure_unit_create_mile},
1322 {"length", "millimeter", i18n_measure_unit_create_millimeter},
1323 {"length", "nanometer", i18n_measure_unit_create_nanometer},
1324 {"length", "nautical-mile", i18n_measure_unit_create_nautical_mile},
1325 {"length", "parsec", i18n_measure_unit_create_parsec},
1326 {"length", "picometer", i18n_measure_unit_create_picometer},
1327 {"length", "yard", i18n_measure_unit_create_yard},
1328 {"light", "lux", i18n_measure_unit_create_lux},
1329 {"mass", "carat", i18n_measure_unit_create_carat},
1330 {"mass", "gram", i18n_measure_unit_create_gram},
1331 {"mass", "kilogram", i18n_measure_unit_create_kilogram},
1332 {"mass", "metric-ton", i18n_measure_unit_create_metric_ton},
1333 {"mass", "microgram", i18n_measure_unit_create_microgram},
1334 {"mass", "milligram", i18n_measure_unit_create_milligram},
1335 {"mass", "ounce-troy", i18n_measure_unit_create_ounce_troy},
1336 {"mass", "ounce", i18n_measure_unit_create_ounce},
1337 {"mass", "pound", i18n_measure_unit_create_pound},
1338 {"mass", "stone", i18n_measure_unit_create_stone},
1339 {"mass", "ton", i18n_measure_unit_create_ton},
1340 {"power", "gigawatt", i18n_measure_unit_create_gigawatt},
1341 {"power", "horsepower", i18n_measure_unit_create_horsepower},
1342 {"power", "kilowatt", i18n_measure_unit_create_kilowatt},
1343 {"power", "megawatt", i18n_measure_unit_create_megawatt},
1344 {"power", "milliwatt", i18n_measure_unit_create_milliwatt},
1345 {"power", "watt", i18n_measure_unit_create_watt},
1346 {"pressure", "hectopascal", i18n_measure_unit_create_hectopascal},
1347 {"pressure", "inch-hg", i18n_measure_unit_create_inch_hg},
1348 {"pressure", "millibar", i18n_measure_unit_create_millibar},
1349 {"pressure", "millimeter-of-mercury", i18n_measure_unit_create_millimeter_of_mercury},
1350 {"pressure", "pound-per-square-inch", i18n_measure_unit_create_pound_per_square_inch},
1351 {"speed", "kilometer-per-hour", i18n_measure_unit_create_kilometer_per_hour},
1352 {"speed", "meter-per-second", i18n_measure_unit_create_meter_per_second},
1353 {"speed", "mile-per-hour", i18n_measure_unit_create_mile_per_hour},
1354 {"temperature", "celsius", i18n_measure_unit_create_celsius},
1355 {"temperature", "fahrenheit", i18n_measure_unit_create_fahrenheit},
1356 {"temperature", "kelvin", i18n_measure_unit_create_kelvin},
1357 {"volume", "acre-foot", i18n_measure_unit_create_acre_foot},
1358 {"volume", "bushel", i18n_measure_unit_create_bushel},
1359 {"volume", "centiliter", i18n_measure_unit_create_centiliter},
1360 {"volume", "cubic-centimeter", i18n_measure_unit_create_cubic_centimeter},
1361 {"volume", "cubic-foot", i18n_measure_unit_create_cubic_foot},
1362 {"volume", "cubic-inch", i18n_measure_unit_create_cubic_inch},
1363 {"volume", "cubic-kilometer", i18n_measure_unit_create_cubic_kilometer},
1364 {"volume", "cubic-meter", i18n_measure_unit_create_cubic_meter},
1365 {"volume", "cubic-mile", i18n_measure_unit_create_cubic_mile},
1366 {"volume", "cubic-yard", i18n_measure_unit_create_cubic_yard},
1367 {"volume", "cup", i18n_measure_unit_create_cup},
1368 {"volume", "deciliter", i18n_measure_unit_create_deciliter},
1369 {"volume", "fluid-ounce", i18n_measure_unit_create_fluid_ounce},
1370 {"volume", "gallon", i18n_measure_unit_create_gallon},
1371 {"volume", "hectoliter", i18n_measure_unit_create_hectoliter},
1372 {"volume", "liter", i18n_measure_unit_create_liter},
1373 {"volume", "megaliter", i18n_measure_unit_create_megaliter},
1374 {"volume", "milliliter", i18n_measure_unit_create_milliliter},
1375 {"volume", "pint", i18n_measure_unit_create_pint},
1376 {"volume", "quart", i18n_measure_unit_create_quart},
1377 {"volume", "tablespoon", i18n_measure_unit_create_tablespoon},
1378 {"volume", "teaspoon", i18n_measure_unit_create_teaspoon}
1381 static int __show_measure_unit(char *input_number)
1383 printf(" - To show the measure unit\n");
1384 printf(" - Input number : %s\n", input_number ? input_number : "137");
1386 printf("****************************************\n");
1389 input_number = (char *)"137";
1390 PRINT_DEBUG_LOG("Input number : %s\n", input_number);
1392 PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
1393 PRINT_ASCIIDOC_LOG("|===\n");
1394 printf("| TYPE | SUBTYPE | NARROW | SHORT | WIDE \n");
1397 for (i = 0; i < sizeof(mu) / sizeof(mu[0]); i++) {
1398 i18n_measure_unit_h measure_unit = NULL;
1399 int error_code = mu[i].fp(&measure_unit);
1401 i18n_formattable_h formattable = NULL;
1403 sscanf(input_number, "%lf", &numer);
1404 error_code = i18n_formattable_create_with_double(numer, &formattable);
1406 i18n_measure_h measure;
1407 error_code = i18n_measure_create(formattable, measure_unit, &measure);
1408 i18n_formattable_destroy(formattable);
1410 int measure_array_count = 0;
1411 const int max_measures = 10;
1412 i18n_measure_h measure_array[max_measures] = { NULL };
1413 measure_array[measure_array_count++] = measure;
1415 i18n_measure_format_h measure_format_narrow = NULL;
1416 i18n_measure_format_create("en", "US", I18N_UMEASFMT_WIDTH_NARROW, &measure_format_narrow);
1418 i18n_measure_format_h measure_format_short = NULL;
1419 i18n_measure_format_create("en", "US", I18N_UMEASFMT_WIDTH_SHORT, &measure_format_short);
1421 i18n_measure_format_h measure_format_wide = NULL;
1422 i18n_measure_format_create("en", "US", I18N_UMEASFMT_WIDTH_WIDE, &measure_format_wide);
1424 i18n_field_position_h field_position = NULL;
1425 i18n_field_position_create_for_field(5, &field_position);
1426 const int width = 100;
1427 const char *input = " ";
1428 i18n_uchar dest_narrow[width];
1429 i18n_ustring_copy_ua_n(dest_narrow, input, width);
1430 i18n_uchar dest_short[width];
1431 i18n_ustring_copy_ua_n(dest_short, input, width);
1432 i18n_uchar dest_wide[width];
1433 i18n_ustring_copy_ua_n(dest_wide, input, width);
1436 error_code = i18n_measure_format_format_measures(measure_format_narrow, measure_array, measure_array_count,
1437 field_position, width, dest_narrow, &length);
1438 CHECK_ERROR("i18n_measure_format_format_measures[I18N_UMEASFMT_WIDTH_NARROW]", error_code);
1439 error_code = i18n_measure_format_format_measures(measure_format_short, measure_array, measure_array_count,
1440 field_position, width, dest_short, &length);
1441 CHECK_ERROR("i18n_measure_format_format_measures[I18N_UMEASFMT_WIDTH_SHORT]", error_code);
1442 error_code = i18n_measure_format_format_measures(measure_format_wide, measure_array, measure_array_count,
1443 field_position, width, dest_wide, &length);
1444 CHECK_ERROR("i18n_measure_format_format_measures[I18N_UMEASFMT_WIDTH_WIDE]", error_code);
1445 PRINT_DEBUG_LOG("length = %d\n", length);
1447 char output_text_narrow[width + 1] = { 0x00, };
1448 char output_text_short[width + 1] = { 0x00, };
1449 char output_text_wide[width + 1] = { 0x00, };
1450 i18n_ustring_copy_au_n(output_text_narrow, dest_narrow, width);
1451 i18n_ustring_copy_au_n(output_text_short, dest_short, width);
1452 i18n_ustring_copy_au_n(output_text_wide, dest_wide, width);
1454 printf("| %-12s | %-24s |%-10s |%-15s |%s\n", mu[i].unit_type, mu[i].unit_subtype, output_text_narrow, output_text_short, output_text_wide);
1455 i18n_measure_destroy(measure);
1457 PRINT_ASCIIDOC_LOG("|===\n");
1463 #if (__TIZEN_VER >= 5)
1464 static int __test_plural_rules(char *input_number)
1467 printf(" - To show plural rules\n");
1468 printf(" - Rule text : one: n is 1; few: n in 2..4\n");
1469 printf(" - Input number : %s\n", input_number ? input_number : "3");
1471 printf("****************************************\n");
1473 i18n_plural_rules_h rules = NULL;
1475 const char *rule_text = "one: n is 1; few: n in 2..4";
1476 PRINT_DEBUG_LOG("%s \n", rule_text);
1478 /* Creates a plural rules object from a description. */
1479 int error_code = i18n_plural_rules_create_rules_from_descr(rule_text, &rules);
1481 /* Create an enumeration of the keywords for the given locale. */
1482 i18n_uenumeration_h keywords = NULL;
1483 error_code = i18n_plural_rules_get_keywords(rules, &keywords);
1484 CHECK_ERROR("i18n_plural_rules_get_keywords", error_code);
1486 /* Get the number of the keywords that the enumeration contains. */
1487 int32_t count = i18n_uenumeration_count(keywords);
1488 printf("Number of keywords: %d\n", count);
1490 /* Get the first keyword from the enumeration. */
1492 const char *keyword = i18n_uenumeration_next(keywords, &len);
1493 CHECK_ERROR("i18n_uenumeration_next", get_last_result());
1495 /* Iterate over all of the keywords found in the enumeration. */
1496 printf("Display list of keywords: ");
1497 while (keyword != NULL) {
1498 /* Display the currently processed keyword. */
1499 printf("%s ", keyword);
1501 /* Get the next keyword from the enumeration. */
1502 keyword = i18n_uenumeration_next(keywords, &len);
1503 CHECK_ERROR("i18n_uenumeration_next", get_last_result())
1507 /* Release the keywords enumeration as it is not needed anymore. */
1508 error_code = i18n_uenumeration_destroy(keywords);
1509 if (error_code != I18N_ERROR_NONE) {
1510 CHECK_ERROR("i18n_uenumeration_destroy", error_code);
1513 /* Create unumber format, to get number from user input. */
1514 i18n_unumber_format_h unumber;
1515 error_code = i18n_unumber_create(I18N_UNUMBER_DECIMAL, NULL, -1, default_locale, NULL, &unumber);
1516 CHECK_ERROR("i18n_unumber_create", error_code);
1519 input_number = (char *)"3";
1520 PRINT_DEBUG_LOG("Input number : %s\n", input_number);
1522 i18n_uchar i18nchar_input[BUF_SIZE] = { 0 };
1523 i18n_ustring_copy_ua(i18nchar_input, input_number);
1525 /* Parse string to double. */
1526 double input = i18n_unumber_parse_double(unumber, i18nchar_input, -1, NULL);
1528 /* Get rule from user defined number and print it to user. */
1529 i18n_uchar buffer[BUF_SIZE] = { 0 };
1530 int output_length = -1;
1531 error_code = i18n_plural_rules_select_double(rules, input, BUF_SIZE, buffer, &output_length);
1532 CHECK_ERROR("i18n_plural_rules_select_double", error_code);
1534 char output_buffer[BUF_SIZE] = { 0 };
1535 i18n_ustring_copy_au_n(output_buffer, buffer, BUF_SIZE);
1536 printf("Matched rule: %s \n", output_buffer);
1538 /* Release the rules as it is not needed anymore. */
1539 error_code = i18n_plural_rules_destroy(rules);
1540 if (error_code != I18N_ERROR_NONE) {
1541 CHECK_ERROR("i18n_plural_rules_destroy", error_code);
1553 loc_count = i18n_ulocale_count_available();
1554 for (i = 0; i < loc_count; i++) {
1555 default_locale = i18n_ulocale_get_available(i);
1556 printf("\n== Date and Time Test");
1557 printf("\n****************************************");
1558 printf("\n - locales : %s\n", default_locale);
1559 ret = __get_date_and_time(NULL);
1561 printf("\n== Number Format Test");
1562 printf("\n****************************************");
1563 printf("\n - locales : %s\n", default_locale);
1564 ret = __get_number_format("3.5");
1566 printf("\n== Number Symbol Test");
1567 printf("\n****************************************");
1568 printf("\n - locales : %s\n", default_locale);
1569 ret = __get_symbol();
1571 printf("\n== Language Info");
1572 printf("\n****************************************");
1573 printf("\n - locales : %s\n", default_locale);
1574 ret = __get_language_info();
1578 printf("\n== String Iteration Test");
1579 printf("\n****************************************\n");
1580 ret = __manage_string_iteration(NULL);
1583 printf("\n== String Test");
1584 printf("\n****************************************\n");
1585 ret = __analyze_string(NULL);
1587 printf("\n== Timezone Info");
1588 printf("\n****************************************\n");
1589 ret = __get_timezone_info(NULL);
1592 printf("\n== TZ Data Version Info");
1593 printf("\n****************************************\n");
1594 ret = __get_tzdata_version();
1596 printf("get i18n time zone info list failed\n");
1600 void showAllLocale()
1602 __get_available_locales();
1605 void showLangInfo(char *locale)
1611 loc_count = i18n_ulocale_count_available();
1612 for (i = 0; i < loc_count; i++) {
1613 default_locale = i18n_ulocale_get_available(i);
1614 printf("\n== Language Info");
1615 printf("\n****************************************");
1616 printf("\n - locales : %s\n", default_locale);
1617 ret = __get_language_info();
1619 printf("get i18n language info list failed\n");
1623 default_locale = locale;
1624 printf("\n== Language Info");
1625 printf("\n****************************************");
1626 printf("\n - locales : %s\n", default_locale);
1627 ret = __get_language_info();
1629 printf("get i18n language info list failed\n");
1634 void showTimezone(char *timezone_id)
1637 printf("\n== Timezone Info");
1638 printf("\n****************************************\n");
1639 ret = __get_timezone_info(timezone_id);
1641 printf("get i18n time zone info list failed\n");
1645 void showAllTimezone()
1649 printf("\n== List of Timezone");
1650 printf("\n****************************************\n");
1651 ret = __get_available_timezone();
1653 printf("get the list of time zone failed\n");
1657 void showTzdataVersion()
1659 printf("\n== TZ Data Version Info");
1660 printf("\n****************************************\n");
1661 __get_tzdata_version();
1664 void showUbidi(char *input)
1666 printf("\n== Show Ubidi");
1667 printf("\n****************************************\n");
1668 __show_ubidi(input);
1671 #if (__TIZEN_VER >= 4)
1672 void testNumberConvert(char *input)
1676 printf("\n== Number Converting Test");
1677 printf("\n****************************************\n");
1678 ret = __convert_number(input);
1680 printf("number converting failed\n");
1684 void showMeasureUnit(char *input)
1686 printf("\n== Show Measure Unit");
1687 printf("\n****************************************\n");
1688 __show_measure_unit(input);
1692 #if (__TIZEN_VER >= 5)
1693 void testPluralRules(char *input)
1695 printf("\n== Test Plural Rules");
1696 printf("\n****************************************\n");
1697 __test_plural_rules(input);
1701 void showDatentimeFormat(char *locale)
1707 loc_count = i18n_ulocale_count_available();
1708 for (i = 0; i < loc_count; i++) {
1709 default_locale = i18n_ulocale_get_available(i);
1710 printf("\n== Show Date basic format");
1711 printf("\n****************************************");
1712 printf("\n - locales : %s\n", default_locale);
1713 ret = __get_date_basic_format();
1715 printf("get i18n date and time basic format list failed\n");
1719 default_locale = locale;
1720 printf("\n== Show Date basic format");
1721 printf("\n****************************************");
1722 printf("\n - locales : %s\n", default_locale);
1723 ret = __get_date_basic_format();
1725 printf("get i18n date and time basic format list failed\n");
1730 void testDatentime(char *input, char *locale)
1736 loc_count = i18n_ulocale_count_available();
1737 for (i = 0; i < loc_count; i++) {
1738 default_locale = i18n_ulocale_get_available(i);
1739 printf("\n== Date and Time Test");
1740 printf("\n****************************************");
1741 printf("\n - locales : %s\n", default_locale);
1742 ret = __get_date_and_time(input);
1744 printf("get i18n date and time list failed\n");
1748 default_locale = locale;
1749 printf("\n== Date and Time Test");
1750 printf("\n****************************************");
1751 printf("\n - locales : %s\n", default_locale);
1752 ret = __get_date_and_time(input);
1754 printf("get i18n date and time list failed\n");
1759 void testNumberFormat(char *input, char *locale)
1767 loc_count = i18n_ulocale_count_available();
1768 for (i = 0; i < loc_count; i++) {
1769 default_locale = i18n_ulocale_get_available(i);
1770 printf("\n== Number Format Test");
1771 printf("\n****************************************");
1772 printf("\n - locales : %s\n", default_locale);
1773 ret = __get_number_format(input);
1775 printf("get number format list failed\n");
1779 default_locale = locale;
1780 printf("\n== Number Format Test");
1781 printf("\n****************************************");
1782 printf("\n - locales : %s\n", default_locale);
1783 ret = __get_number_format(input);
1785 printf("get number format list failed\n");
1791 void testNumberSymbol(char *locale)
1797 loc_count = i18n_ulocale_count_available();
1798 for (i = 0; i < loc_count; i++) {
1799 default_locale = i18n_ulocale_get_available(i);
1800 printf("\n== Number Symbol Test");
1801 printf("\n****************************************");
1802 printf("\n - locales : %s\n", default_locale);
1803 ret = __get_symbol();
1805 printf("get i18n symbol list failed\n");
1809 default_locale = locale;
1810 printf("\n== Number Symbol Test");
1811 printf("\n****************************************");
1812 printf("\n - locales : %s\n", default_locale);
1813 ret = __get_symbol();
1815 printf("get i18n symbol list failed\n");
1820 void testString(char *input)
1824 printf("\n== String Test");
1825 printf("\n****************************************\n");
1826 ret = __analyze_string(input);
1828 printf("get i18n string list failed\n");
1832 void testStringIter(char *input)
1836 printf("\n== String Iteration Test");
1837 printf("\n****************************************\n");
1838 ret = __manage_string_iteration(input);
1840 printf("get i18n string iteration list failed\n");
1844 int main(int argc, char *argv[])
1846 struct arguments arguments = {0, };
1848 argp_parse(&argp, argc, argv, 0, 0, &arguments);
1850 if (arguments.all) {
1851 memset(&arguments, 0x00, sizeof(arguments));
1856 if (arguments.printASCII) {
1860 if (arguments.showAllLocale) {
1864 if (arguments.showLangInfo) {
1865 showLangInfo(arguments.setLocale);
1868 if (arguments.showDateFormat) {
1869 showDatentimeFormat(arguments.setLocale);
1872 if (arguments.testDatentime) {
1873 testDatentime(arguments.testTimeArg, arguments.setLocale);
1876 if (arguments.testNumberFormat) {
1877 testNumberFormat(arguments.testNumberFormatArg, arguments.setLocale);
1880 if (arguments.testNumberSymbol) {
1881 testNumberSymbol(arguments.setLocale);
1884 if (arguments.testString) {
1885 testString(arguments.testStringArg);
1888 if (arguments.testStringIter) {
1889 testStringIter(arguments.testStringIterArg);
1892 if (arguments.showTimezone) {
1893 showTimezone(arguments.timezoneId);
1896 if (arguments.showAllTimezone) {
1900 if (arguments.showTzdataVersion) {
1901 showTzdataVersion();
1904 if (arguments.showUbidi) {
1905 showUbidi(arguments.testTextArg);
1908 #if (__TIZEN_VER >= 4)
1909 if (arguments.testNumberConvert) {
1910 testNumberConvert(arguments.testNumberConvertArg);
1913 if (arguments.showMeasureUnit) {
1914 showMeasureUnit(arguments.testInputNumArg);
1917 #if (__TIZEN_VER >= 5)
1918 if (arguments.testPluralRules) {
1919 testPluralRules(arguments.testPluralRulesArg);