Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22261 Add tech preview implementation for MessageFormat 2.0 to icu4c #2579

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion icu4c/source/common/unicode/utypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ typedef enum UErrorCode {

U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */


#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UErrorCode warning value.
Expand Down Expand Up @@ -568,12 +569,27 @@ typedef enum UErrorCode {
U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */
U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @stable ICU 61 */
U_NUMBER_SKELETON_SYNTAX_ERROR, /**< The number skeleton passed to C++ NumberFormatter or C UNumberFormatter was invalid or contained a syntax error. @stable ICU 62 */

/* MessageFormat 2.0 errors */
U_MF_UNRESOLVED_VARIABLE_ERROR, /** A variable is referred to but not bound by any definition */
U_MF_SYNTAX_ERROR, /** Includes all syntax errors */
U_MF_UNKNOWN_FUNCTION_ERROR, /** An annotation refers to a function not defined by the standard or custom function registry */
U_MF_VARIANT_KEY_MISMATCH_ERROR, /** In a match-construct, one or more variants had a different number of keys from the number of selectors */
U_MF_FORMATTING_ERROR, /** Covers all runtime errors: for example, an internally inconsistent set of options. */
U_MF_NONEXHAUSTIVE_PATTERN_ERROR, /** In a match-construct, the variants do not cover all possible values */
U_MF_DUPLICATE_OPTION_NAME_ERROR, /** In an annotation, the same option name appears more than once */
U_MF_SELECTOR_ERROR, /** A selector function is applied to an operand of the wrong type */
U_MF_MISSING_SELECTOR_ANNOTATION_ERROR, /** A selector expression evaluates to an unannotated operand */
U_MF_DUPLICATE_DECLARATION_ERROR, /** The same variable is declared in more than one .local or .input declaration */
U_MF_OPERAND_MISMATCH_ERROR, /** An operand provided to a function does not have the required form for that function */
U_MF_UNSUPPORTED_STATEMENT_ERROR, /** A message includes a reserved statement */
U_MF_UNSUPPORTED_EXPRESSION_ERROR, /** A message includes syntax reserved for future standardization or private implementation use */
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal formatting API error code.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
U_FMT_PARSE_ERROR_LIMIT = 0x10114,
U_FMT_PARSE_ERROR_LIMIT = 0x10121,
#endif // U_HIDE_DEPRECATED_API

/*
Expand Down
13 changes: 13 additions & 0 deletions icu4c/source/common/utypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ _uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = {
"U_FORMAT_INEXACT_ERROR",
"U_NUMBER_ARG_OUTOFBOUNDS_ERROR",
"U_NUMBER_SKELETON_SYNTAX_ERROR",
"U_MF_UNRESOLVED_VARIABLE_ERROR",
"U_MF_SYNTAX_ERROR",
"U_MF_UNKNOWN_FUNCTION_ERROR",
"U_MF_VARIANT_KEY_MISMATCH_ERROR",
"U_MF_FORMATTING_ERROR",
"U_MF_NONEXHAUSTIVE_PATTERN_ERROR",
"U_MF_DUPLICATE_OPTION_NAME_ERROR",
"U_MF_SELECTOR_ERROR",
"U_MF_MISSING_SELECTOR_ANNOTATION_ERROR",
"U_MF_DUPLICATE_DECLARATION_ERROR",
"U_MF_OPERAND_MISMATCH_ERROR",
"U_MF_UNSUPPORTED_STATEMENT_ERROR",
"U_MF_UNSUPPORTED_EXPRESSION_ERROR"
};

static const char * const
Expand Down
11 changes: 11 additions & 0 deletions icu4c/source/i18n/i18n.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@
<ClCompile Include="measunit.cpp" />
<ClCompile Include="measunit_extra.cpp" />
<ClCompile Include="measure.cpp" />
<ClCompile Include="messageformat2.cpp" />
<ClCompile Include="messageformat2_arguments.cpp" />
<ClCompile Include="messageformat2_checker.cpp" />
<ClCompile Include="messageformat2_data_model.cpp" />
<ClCompile Include="messageformat2_errors.cpp" />
<ClCompile Include="messageformat2_evaluation.cpp" />
<ClCompile Include="messageformat2_formattable.cpp" />
<ClCompile Include="messageformat2_formatter.cpp" />
<ClCompile Include="messageformat2_function_registry.cpp" />
<ClCompile Include="messageformat2_parser.cpp" />
<ClCompile Include="messageformat2_serializer.cpp" />
<ClCompile Include="msgfmt.cpp" />
<ClCompile Include="nfrs.cpp" />
<ClCompile Include="nfrule.cpp" />
Expand Down
36 changes: 36 additions & 0 deletions icu4c/source/i18n/i18n.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,42 @@
<ClCompile Include="measure.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_arguments.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_checker.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_context.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_data_model.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_errors.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_evaluation.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_formattable.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_formatter.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_function_registry.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_parser.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="messageformat2_serializer.cpp">
<Filter>formatting</Filter>
</ClCompile>
<ClCompile Include="msgfmt.cpp">
<Filter>formatting</Filter>
</ClCompile>
Expand Down
11 changes: 11 additions & 0 deletions icu4c/source/i18n/i18n_uwp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,17 @@
<ClCompile Include="measunit.cpp" />
<ClCompile Include="measunit_extra.cpp" />
<ClCompile Include="measure.cpp" />
<ClCompile Include="messageformat2.cpp" />
<ClCompile Include="messageformat2_arguments.cpp" />
<ClCompile Include="messageformat2_checker.cpp" />
<ClCompile Include="messageformat2_data_model.cpp" />
<ClCompile Include="messageformat2_errors.cpp" />
<ClCompile Include="messageformat2_evaluation.cpp" />
<ClCompile Include="messageformat2_formattable.cpp" />
<ClCompile Include="messageformat2_formatter.cpp" />
<ClCompile Include="messageformat2_function_registry.cpp" />
<ClCompile Include="messageformat2_parser.cpp" />
<ClCompile Include="messageformat2_serializer.cpp" />
<ClCompile Include="msgfmt.cpp" />
<ClCompile Include="nfrs.cpp" />
<ClCompile Include="nfrule.cpp" />
Expand Down
Loading