-
-
Notifications
You must be signed in to change notification settings - Fork 623
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
[Project Fluent] Basic internationalization support (would close PR #2553) #2674
base: main
Are you sure you want to change the base?
[Project Fluent] Basic internationalization support (would close PR #2553) #2674
Conversation
ab56d20
to
3edb09c
Compare
@@ -54,7 +54,11 @@ fn render_not_found(subcommand: &str, bin: &str) -> StyledStr { | |||
let _ = write!(output, "{error}error:{error:#} "); | |||
let _ = write!( | |||
output, | |||
"unrecognized subcommand '{invalid}{subcommand}{invalid:#}' " | |||
"{} ", |
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.
This is an awkward example but maybe helps show where extra steps are required (e.g. a simple non-literal/const string would be wrapped by t!(..)
and done)
description = "macro library for atuin" | ||
|
||
rust-version = { workspace = true } | ||
version = "18.5.0-beta.2" |
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.
TODO: this seems to be a cargo-i18n issue that it cannot accept non-literal versions.
That said, running cargo i18n
doesn't actually seem to be necessary.
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.
But might need an upstream change in cargo-i18n to fix :/
3edb09c
to
7ea4f77
Compare
This pull request has been mentioned on Atuin Community. There might be relevant details there: |
@@ -4,7 +4,7 @@ edition = "2024" | |||
description = "client library for atuin" | |||
|
|||
rust-version = { workspace = true } | |||
version = { workspace = true } | |||
version = "18.5.0-beta.2" |
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.
(see below: if it is not easy to address the cargo-i18n
issue then I'm fairly sure we can ignore it - either way will restore these before merge)
7ea4f77
to
b4cdb63
Compare
Alternative approach to #2553. Not closing that just yet, but keen for feedback either way.
After thinking about the discussion on the Forum, the biggest challenge is that a lot of small changes brings risk. This is a suggestion:
Suggestion: tidy-up, PR and merge this to provide i18n support. Once that is in a release and there is no negative feedback and folks confirm that the single example works OK, then PR 2., which is roughly the minimal set of common translatable strings. Less than that, and there's too much English leaking through to get buy-in, any more and the PR is oversized.
NB: there is a commit in 2. with English translations - note that it covers the full set of changes in 3. so most of them can be ignored in the near-term (happy to split it in two parts - one for 2. and one for 3.).
This PR does not add any translatable strings except one. Changes 2. and 3. only translate the crates
atuin-common
andatuin-client
, plusinspector.rs
andinteractive.rs
in theatuin
crate.How to test
This PR has only one translatable string, to make sure it works and breaks nothing, as the main challenge is to get the machinery in without regressions. However, using https://github.com/philtweir/fork-atuin/tree/feature/i18n-support-fluent-basic, you can build and take the interactive search as a minimal test.
In this PR, the only visible change should be:
vs
How translatability is implemented
Adding
t!(...)
everywhere appropriate, in some places accounting for static return values, and then progressively adding translations to*.flt
files as people wish to (separately) PR.Notes
t!(...)
can take arguments (e.g. translate%{time} ago
) it does not return&'static str
so, for FilterMode, I usedlazy_static
and elsewhere, switched toString
or otherwise worked-around.cargo-i18n
docs) - this means a newatuin_macro
package (if this is a hard no, please say and I will try new ideas!)./i18n
folder (this has a side-benefit/downside that the same string will be translated the same way in all crates)Checks