73
74
format_match_simple (char const *text)
75
76
/* Is it a boolean? */
76
if (0 == g_ascii_strcasecmp (text, go_format_boolean (TRUE)))
77
if (0 == g_ascii_strcasecmp (text, go_locale_boolean_name (TRUE)))
77
78
return value_new_bool (TRUE);
78
if (0 == g_ascii_strcasecmp (text, go_format_boolean (FALSE)))
79
if (0 == g_ascii_strcasecmp (text, go_locale_boolean_name (FALSE)))
79
80
return value_new_bool (FALSE);
81
82
/* Is it an error? */
897
892
gboolean has_percent = FALSE;
899
894
GString *numstr = g_string_sized_new (20);
900
GString const *curr = go_format_get_currency (NULL, NULL);
901
GString const *thousand = go_format_get_thousand ();
902
GString const *decimal = go_format_get_decimal ();
895
GString const *curr = go_locale_get_currency (NULL, NULL);
896
GString const *thousand = go_locale_get_thousand ();
897
GString const *decimal = go_locale_get_decimal ();
903
898
gboolean last_was_digit = FALSE;
904
899
gboolean allow1000 = (thousand->len != 0);
1090
1084
if (text[0] == '\'')
1091
1085
return value_new_string (text + 1);
1093
fam = cur_fmt ? cur_fmt->family : GO_FORMAT_GENERAL;
1094
if (cur_fmt != GO_FORMAT_GENERAL) {
1095
switch (cur_fmt->family) {
1096
case GO_FORMAT_TEXT:
1097
return value_new_string (text);
1099
case GO_FORMAT_NUMBER:
1100
case GO_FORMAT_CURRENCY:
1101
case GO_FORMAT_ACCOUNTING:
1102
case GO_FORMAT_PERCENTAGE:
1103
case GO_FORMAT_SCIENTIFIC:
1104
v = format_match_decimal_number (text, &fam);
1106
value_set_fmt (v, cur_fmt);
1109
case GO_FORMAT_DATE: {
1110
gboolean month_before_day =
1111
hack_month_before_day (cur_fmt);
1113
v = format_match_datetime (text, date_conv,
1118
v = format_match_decimal_number (text, &fam);
1120
value_set_fmt (v, cur_fmt);
1124
case GO_FORMAT_TIME: {
1125
gboolean month_before_day =
1126
hack_month_before_day (cur_fmt);
1127
gboolean prefer_hour = hack_prefer_hour (cur_fmt);
1129
v = format_match_datetime (text, date_conv,
1134
v = format_match_time (text, TRUE, prefer_hour, FALSE);
1136
v = format_match_decimal_number (text, &fam);
1138
value_set_fmt (v, cur_fmt);
1142
case GO_FORMAT_FRACTION:
1143
v = format_match_fraction (text, &denlen);
1145
v = format_match_decimal_number (text, &fam);
1148
value_set_fmt (v, cur_fmt);
1087
fam = cur_fmt ? go_format_get_family (cur_fmt) : GO_FORMAT_GENERAL;
1089
case GO_FORMAT_TEXT:
1090
return value_new_string (text);
1092
case GO_FORMAT_NUMBER:
1093
case GO_FORMAT_CURRENCY:
1094
case GO_FORMAT_ACCOUNTING:
1095
case GO_FORMAT_PERCENTAGE:
1096
case GO_FORMAT_SCIENTIFIC:
1097
v = format_match_decimal_number (text, &fam);
1099
value_set_fmt (v, cur_fmt);
1102
case GO_FORMAT_DATE: {
1103
gboolean month_before_day =
1104
hack_month_before_day (cur_fmt);
1106
v = format_match_datetime (text, date_conv,
1111
v = format_match_decimal_number (text, &fam);
1113
value_set_fmt (v, cur_fmt);
1117
case GO_FORMAT_TIME: {
1118
gboolean month_before_day =
1119
hack_month_before_day (cur_fmt);
1120
gboolean prefer_hour = hack_prefer_hour (cur_fmt);
1122
v = format_match_datetime (text, date_conv,
1127
v = format_match_time (text, TRUE, prefer_hour, FALSE);
1129
v = format_match_decimal_number (text, &fam);
1131
value_set_fmt (v, cur_fmt);
1135
case GO_FORMAT_FRACTION:
1136
v = format_match_fraction (text, &denlen);
1138
v = format_match_decimal_number (text, &fam);
1141
value_set_fmt (v, cur_fmt);
1156
1148
/* Check basic types */