-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Diagnostics icu4x
based list formatting.
#104047
Conversation
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
This comment has been minimized.
This comment has been minimized.
Mmmm, seems there's non-thread-safe things within |
@crlf0710 you need the sync feature on the icu_provider crate. |
So I think you should simply generate for |
Also, cc @zbraniecki: do you think this is the right way to use list formatter with fluent? This is only for lists of untranslated placeholders. |
Thanks! In the two recent commits, I updated the features flags to include |
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.
I can't speak to any of the icu4x usage or the baked data stuff, but the integration into DiagnosticArg
and other rustc infrastructure looks good to me.
LGTM so far, but I'll wait to see how it's hooked into Fluent (this PR only hooks in Memoizable) |
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.
ICU4X usage seems good too
@@ -49,6 +51,7 @@ impl<'source> Into<FluentValue<'source>> for DiagnosticArgValue<'source> { | |||
match self { | |||
DiagnosticArgValue::Str(s) => From::from(s), | |||
DiagnosticArgValue::Number(n) => From::from(n), | |||
DiagnosticArgValue::StrListSepByAnd(l) => fluent_value_from_str_list_sep_by_and(l), |
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.
@zbraniecki this is where it gets hooked in to fluent
@zbraniecki it's already hooked into Fluent; the lists eventually produce a FluentValue |
The fallback algorithm visits Upstream issues to improve documentation and tooling around this: unicode-org/icu4x#2683, unicode-org/icu4x#2243, unicode-org/icu4x#834 |
This comment was marked as resolved.
This comment was marked as resolved.
ad990e0
to
4c24176
Compare
Rebased forward. |
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.
r=me after last comment
177cfbd
to
d75c76d
Compare
@bors r=davidtwco |
…, r=davidtwco Diagnostics `icu4x` based list formatting. This adds a new kind of `DiagnosticArg` and add the ability to convert it to a `FluentValue::Custom`. When emitting fluent output, it makes use of `ListFormatter` from `icu4x` project to convert it to localized version of list following the fluent locale, as a kind of eager translation. Tested locally with locales like `en`, `ja`, etc, and they work fine. <del>Though neither `zh-CN` nor `zh-Hans` works correctly, it seems they fallback to `und` locale somehow, emitting only comma-based list. I believe this is an internal issue of `icu4x` itself.</del>(Works fine after rust-lang#104047 (comment)) Would love to hear what others think. r? `@davidtwco` cc `@Manishearth`
…, r=davidtwco Diagnostics `icu4x` based list formatting. This adds a new kind of `DiagnosticArg` and add the ability to convert it to a `FluentValue::Custom`. When emitting fluent output, it makes use of `ListFormatter` from `icu4x` project to convert it to localized version of list following the fluent locale, as a kind of eager translation. Tested locally with locales like `en`, `ja`, etc, and they work fine. <del>Though neither `zh-CN` nor `zh-Hans` works correctly, it seems they fallback to `und` locale somehow, emitting only comma-based list. I believe this is an internal issue of `icu4x` itself.</del>(Works fine after rust-lang#104047 (comment)) Would love to hear what others think. r? ``@davidtwco`` cc ``@Manishearth``
@bors rollup=iffy this will break naïve rollups because it introduces a new dep |
…, r=davidtwco Diagnostics `icu4x` based list formatting. This adds a new kind of `DiagnosticArg` and add the ability to convert it to a `FluentValue::Custom`. When emitting fluent output, it makes use of `ListFormatter` from `icu4x` project to convert it to localized version of list following the fluent locale, as a kind of eager translation. Tested locally with locales like `en`, `ja`, etc, and they work fine. <del>Though neither `zh-CN` nor `zh-Hans` works correctly, it seems they fallback to `und` locale somehow, emitting only comma-based list. I believe this is an internal issue of `icu4x` itself.</del>(Works fine after rust-lang#104047 (comment)) Would love to hear what others think. r? `@davidtwco` cc `@Manishearth`
d75c76d
to
2721e40
Compare
@bors r=davidtwco rollup=maybe lockfile problems were inherent to this PR after merge, did a force push with fixes |
…earth Rollup of 8 pull requests Successful merges: - rust-lang#102977 (remove HRTB from `[T]::is_sorted_by{,_key}`) - rust-lang#103378 (Fix mod_inv termination for the last iteration) - rust-lang#103456 (`unchecked_{shl|shr}` should use `u32` as the RHS) - rust-lang#103701 (Simplify some pointer method implementations) - rust-lang#104047 (Diagnostics `icu4x` based list formatting.) - rust-lang#104338 (Enforce that `dyn*` coercions are actually pointer-sized) - rust-lang#104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`) - rust-lang#104556 (rustdoc: use `code-header` class to format enum variants) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This adds a new kind of
DiagnosticArg
and add the ability to convert it to aFluentValue::Custom
. When emitting fluent output, it makes use ofListFormatter
fromicu4x
project to convert it to localized version of list following the fluent locale, as a kind of eager translation.Tested locally with locales like
en
,ja
, etc, and they work fine.Though neither(Works fine after #104047 (comment))zh-CN
norzh-Hans
works correctly, it seems they fallback tound
locale somehow, emitting only comma-based list. I believe this is an internal issue oficu4x
itself.Would love to hear what others think.
r? @davidtwco
cc @Manishearth