X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/4388f060552cc537e71e957d32f35e9d75a61233..340931cb2e044a2141d11567dd0f782524e32994:/icuSources/i18n/unicode/msgfmt.h diff --git a/icuSources/i18n/unicode/msgfmt.h b/icuSources/i18n/unicode/msgfmt.h index 54692b7b..99b0eaee 100644 --- a/icuSources/i18n/unicode/msgfmt.h +++ b/icuSources/i18n/unicode/msgfmt.h @@ -1,5 +1,7 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* -* Copyright (C) 2007-2012, International Business Machines Corporation and +* Copyright (C) 2007-2013, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************** * @@ -19,6 +21,8 @@ #include "unicode/utypes.h" +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Formats messages in a language-neutral way. @@ -36,7 +40,7 @@ U_CDECL_BEGIN // Forward declaration. struct UHashtable; -typedef struct UHashtable UHashtable; +typedef struct UHashtable UHashtable; /**< @internal */ U_CDECL_END U_NAMESPACE_BEGIN @@ -67,9 +71,8 @@ class NumberFormat; * if the pattern has named arguments (see {@link #usesNamedArguments()}). * *
An argument might not specify any format type. In this case, - * a Number value is formatted with a default (for the locale) NumberFormat, - * a Date value is formatted with a default (for the locale) DateFormat, - * and for any other value its toString() value is used. + * a numeric value is formatted with a default (for the locale) NumberFormat, + * and a date/time value is formatted with a default (for the locale) DateFormat. * *
An argument might specify a "simple" type for which the specified * Format object is created, cached and used. @@ -104,13 +107,14 @@ class NumberFormat; *
* message = messageText (argument messageText)* * argument = noneArg | simpleArg | complexArg - * complexArg = choiceArg | pluralArg | selectArg + * complexArg = choiceArg | pluralArg | selectArg | selectordinalArg * * noneArg = '{' argNameOrNumber '}' * simpleArg = '{' argNameOrNumber ',' argType [',' argStyle] '}' * choiceArg = '{' argNameOrNumber ',' "choice" ',' choiceStyle '}' * pluralArg = '{' argNameOrNumber ',' "plural" ',' pluralStyle '}' * selectArg = '{' argNameOrNumber ',' "select" ',' selectStyle '}' + * selectordinalArg = '{' argNameOrNumber ',' "selectordinal" ',' pluralStyle '}' * * choiceStyle: see {@link ChoiceFormat} * pluralStyle: see {@link PluralFormat} @@ -121,7 +125,7 @@ class NumberFormat; * argNumber = '0' | ('1'..'9' ('0'..'9')*) * * argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duration" - * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText + * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText | "::" argSkeletonText ** *
null
* number
+ * number
* NumberFormat.createInstance(getLocale(), status)
* new DecimalFormat(argStyleText, new DecimalFormatSymbols(getLocale(), status), status)
* date
+ * NumberFormatter::forSkeleton(argSkeletonText, status).locale(getLocale()).toFormat(status)
+ * date
* DateFormat.createDateInstance(kDefault, getLocale(), status)
* DateFormat.createDateInstance(kFull, getLocale(), status)
* new SimpleDateFormat(argStyleText, getLocale(), status)
+ * new SimpleDateFormat(argStyleText, getLocale(), status)
+ *
+ * argSkeletonText
+ * DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)
*
* time
* (none)
@@ -215,7 +225,7 @@ class NumberFormat;
* DateFormat.createTimeInstance(kFull, getLocale(), status)
*
* argStyleText
- * new SimpleDateFormat(argStyleText, getLocale(), status)
+ * new SimpleDateFormat(argStyleText, getLocale(), status)
*
* spellout
* argStyleText (optional)
@@ -234,6 +244,19 @@ class NumberFormat;
*
*
*
+ *
Argument formatting
+ *
+ * Arguments are formatted according to their type, using the default
+ * ICU formatters for those types, unless otherwise specified.
+ *
+ * There are also several ways to control the formatting.
+ *
+ * We recommend you use default styles, predefined style values, skeletons,
+ * or preformatted values, but not pattern strings or custom format objects.
+ *
+ * For more details, see the
+ * ICU User Guide.
+ *
* Usage Information
*
* Here are some examples of usage:
@@ -251,11 +274,11 @@ class NumberFormat;
*
* UnicodeString result;
* MessageFormat::format(
- * "At {1,time} on {1,date}, there was {2} on planet {0,number}.",
+ * "At {1,time,::jmm} on {1,date,::dMMMM}, there was {2} on planet {0,number}.",
* arguments, 3, result, success );
*
* cout << "result: " << result << endl;
- * //