RelativeDateLocalization constructor
const
RelativeDateLocalization({
- required String languageCode,
- required List<
String> timeUnitsSingular, - required List<
String> timeUnitsPlural, - required String prepositionPast,
- required String prepositionFuture,
- required String atTheMoment,
- required List<
FormatComponent> formatOrderPast, - required List<
FormatComponent> formatOrderFuture,
Creates a RelativeDateLocalization.
languageCode
is the language code of the current locale. The English localization will be set to:
languageCode: 'en'
timeUnitsSingular
are the localized time units (singular form). The default English localization will be set to:
timeUnitsSingular: ['second', 'minute', 'hour', 'day', 'year'],
timeUnitsPlural
are the localized time units (plural form). The default English localization will be set to:
timeUnitsPlural: ['seconds', 'minutes', 'hours', 'days', 'years'],
prepositionPast
is the preposition to be displayed on relative dates in the past. The default English localization will be set to:
prepositionPast: 'ago',
prepositionFuture
is the preposition to be displayed on relative dates in the future. The default English localization will be set to:
prepositionFuture: 'in',
atTheMoment
is the localized string displayed if no difference in time can be measured. The default English localization will be set to:
atTheMoment: 'now',
formatOrderPast
describes the order in which the preposition, the value and the unit shall be displayed on the formatted string describing a date in the past. The default English localization will be set to:
formatOrderPast: [
FormatComponent.value,
FormatComponent.unit,
FormatComponent.preposition
],
formatOrderFuture
describes the order in which the preposition, the value and the unit shall be displayed on the formatted string describing a date in the future. The default English localization will be set to:
formatOrderFuture: [
FormatComponent.preposition,
FormatComponent.value,
FormatComponent.unit,
],
Implementation
const RelativeDateLocalization({
required this.languageCode,
required this.timeUnitsSingular,
required this.timeUnitsPlural,
required this.prepositionPast,
required this.prepositionFuture,
required this.atTheMoment,
required this.formatOrderPast,
required this.formatOrderFuture,
});