inflected(locale:userTermOfAddress:inflectionConcepts:)
Process automatic grammar agreement and formatting attributes.
Declaration
func inflected(locale: Locale = .current, userTermOfAddress: TermOfAddress? = .currentUser, inflectionConcepts: [InflectionConcept] = []) -> AttributedStringParameters
- locale:
The locale used for formatting the string. It also specifies the language used for automatic grammar agreement, unless overridden with the
languageIdentifierattribute. - userTermOfAddress:
The user’s preferred term of address, if the user has set one. A value of
nilindicates no preference, in which case the inflection alternative will be used for strings that address the the user. Default value is.currentUser. - inflectionConcepts:
A list of objects providing additional hints for automatic grammar agreement, such as terms of address for people who are mentioned, or phrases with which the string has to grammatically agree.
Discussion
Arguments that were previously formatted in the string must be annotated with the following attributes:
replacementIndex, set to the index of the format specifier.localizedNumericArgument, if the argument was numeric, must also be set to the original value of the argument. If not all arguments are properly annotated, theagreeWithArgumentandinflectattributes may not work properly and behavior is undefined.