AttributeScopes.FoundationAttributes.InflectionAlternativeAttribute
An attribute that provides an alternative inflection phrase when the system can’t achieve grammatical agreement.
Declaration
@frozen enum InflectionAlternativeAttributeOverview
Use the inflectionAlternativeAttribute to provide an alternative phrase for cases where the system can’t achieve unambiguous grammatical agreement.
For example, suppose you want to inflect the masculine form for welcome in Spanish, bienvenido, but the system doesn’t know the person’s preferred terms of address. Add an inflectionAlternative to your LocalizedStringResource, setting the alternative word or phrase in single quotation marks. The system uses the alternative when it can’t determine proper grammatical agreement.
// Define the resource with an inflection alternative.
let resource = LocalizedStringResource("^[Bienvenido](inflect: true, inflectionAlternative: 'Te damos la bienvenida').")
// Use the inflection alternative when the system can't determine agreement.
let result = AttributedString(localized: resource)
// result == "Te damos la bienvenida."See Also
Using automatic grammar agreement attributes
inflectAttributeScopes.FoundationAttributes.InflectionRuleAttributeagreementArgumentAttributeScopes.FoundationAttributes.AgreementArgumentAttributeagreementConceptAttributeScopes.FoundationAttributes.AgreementConceptAttributemorphologyAttributeScopes.FoundationAttributes.MorphologyAttributereferentConceptAttributeScopes.FoundationAttributes.ReferentConceptAttributeinflectionAlternative