RelativeDateLocalization constructor

const RelativeDateLocalization({
  1. required String languageCode,
  2. required List<String> timeUnitsSingular,
  3. required List<String> timeUnitsPlural,
  4. required String prepositionPast,
  5. required String prepositionFuture,
  6. required String atTheMoment,
  7. required List<FormatComponent> formatOrderPast,
  8. 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,
});