-
Notifications
You must be signed in to change notification settings - Fork 197
Fix remaining FormatStyle caches of autoupdating locales #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix remaining FormatStyle caches of autoupdating locales #342
Conversation
…and an autoupdating locale will not cause a refreshed format. Follows up on 18ac5ac (swiftlang#334) Fixes rdar://119010483
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one comment regarding the relative formatted. It doesn't look like we are registering preferences with ICU formatter currently anyways, but wanted to check
let formatter = Self.cache.formatter(for: format) { | ||
ICURelativeDateFormatter(uNumberFormatStyle: format.unitsStyle.icuNumberFormatStyle, uRelDateStyle: format.unitsStyle.icuRelativeDateStyle, locale: format.locale, context: format.capitalizationContext.icuContext) | ||
internal static func formatter(for style: Date.RelativeFormatStyle) -> ICURelativeDateFormatter { | ||
let signature = Signature(localeIdentifier: style.locale.identifier, numberFormatStyle: style.unitsStyle.icuNumberFormatStyle?.rawValue, relativeDateStyle: style.unitsStyle.icuRelativeDateStyle.rawValue, context: style.capitalizationContext.icuContext.rawValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be the preference-capturing locale identifier to account for, say, custom first weekday? I imagine that information would be useful for calculating relative date in terms of weeks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that may be another bug. I'll file one to check if ICURelativeDateFormatter should be using preference-capturing locale.
… locale for testing purposes. Follow up for swiftlang#342
…and an autoupdating locale will not cause a refreshed format. (swiftlang#342) Follows up on 18ac5ac (swiftlang#334) Fixes rdar://119010483
Fix up remaining issues where we cache a
Locale
for format styles, and an autoupdating locale will not cause a refreshed format.Follows up on 18ac5ac (#334 )
Fixes rdar://119010483