feat: expose i18n object by adding setter and getter #6330
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The PR provides public access to the i18n object of DateTimePicker by adding setter and getter methods.
Note
The i18n object has only two properties at the moment: dateLabel and timeLabel. These properties specify a suffix to be added to the aria-label of DatePicker and TimePicker, where the first part of that aria-label is the aria-label or label of DateTimePicker. Due to an API design issue, we also have methods setDateAriaLabel and setTimeAriaLabel set these suffixes despite their name suggesting they set the whole aria-label (overriding the default aria-label format). Ideally, they would be changed to set the whole aria-label while suffixes would only be set through i18n. However, this would be a significant breaking change, which is too big to be included in a minor version. So, for now, it was decided to keep these properties in i18n and also retain these methods, with the difference that the methods will store their labels separately from i18n and their labels will take precedence over the labels set through i18n to avoid undesired side effects.
Part of #4618
Type of change