topgrade icon indicating copy to clipboard operation
topgrade copied to clipboard

add i18n

Open 0xMRTT opened this issue 3 years ago • 9 comments

For many users, English isn't their first language. It'll be cool if topgrade can be translated in other languages using a library called i18n-embed and fluent language

0xMRTT avatar Oct 11 '22 16:10 0xMRTT

I'll look into it. I had a quick look into the rust-i18n crate and it seems pretty easy to implement.

s34m avatar Oct 11 '22 17:10 s34m

yes i want to translate this to zh_TW @DottoDev

olivertzeng avatar Nov 22 '22 11:11 olivertzeng

I'll look into it. I had a quick look into the rust-i18n crate and it seems pretty easy to implement.

Is this still in development? Or is the idea just forgotten?

olivertzeng avatar Oct 30 '23 23:10 olivertzeng

I'll look into it. I had a quick look into the rust-i18n crate and it seems pretty easy to implement.

Is this still in development? Or is the idea just forgotten?

I believe that DottoDev did give it a try as there is a branch in the repo, but for now, I think it is forgotten

SteveLauC avatar Oct 30 '23 23:10 SteveLauC

I might take another crack at this next week. Are there any preferences regarding the library to implement this or should I make an (then) educated guess and just go for it?

Mastermindaxe avatar May 16 '24 09:05 Mastermindaxe

Are there any preferences regarding the library to implement this or should I make an (then) educated guess and just go for it?

I haven't taken a look at i18n so I cannot give you a detailed reply for now. But feel free to ask me if you have any specific questions:)

SteveLauC avatar May 18 '24 08:05 SteveLauC

I've started with an implementation in https://github.com/topgrade-rs/topgrade/pull/807

But tbh I'm not quite satisfied with the usability of that crate in println macros for example. It's very tedious as println!("Hello") becomes println!("{}", t!("Hello")). This makes it much more unreadable imo. Especially in print statements where there are many arguments in the format string.

I think it works well enough though. If you could take a quick glance and tell me if you want me to move forward with it, that would be amazing. I'm just afraid that there might be a better option that sacrifices developer experience less. I'm open to suggestions and any input you have. If that's a non-issue for you I'd be happy to finish the PR and migrate the still missing strings.

One further note on the implementation: I've use the english string literals as the translation keys for better developer experience. Ie I don't have to look in the translation file to work with the code and can, instead, just look at the key. My attempt at improving dx :D

Mastermindaxe avatar May 19 '24 07:05 Mastermindaxe

Thanks for working on it!

If you could take a quick glance and tell me if you want me to move forward with it, that would be amazing

Yeah, I will take a look at the PR in the near future!

SteveLauC avatar May 19 '24 08:05 SteveLauC

Just a quick update: Have made lots of progress over in #807. I think the bulk of it is done. If any of you guys would like to review be my guest.

@olivertzeng Thought I'd give you a quick update on this 😄

Mastermindaxe avatar Jun 24 '24 14:06 Mastermindaxe

Initial i18n support has been added (kudos to @Mastermindaxe ), welcome to add the translations for your language. And, locale file maintainers are more welcome. 😁

SteveLauC avatar Oct 03 '24 11:10 SteveLauC

Initial i18n support has been added (kudos to @Mastermindaxe ), welcome to add the translations for your language. And, locale file maintainers are more welcome. 😁

Will do

olivertzeng avatar Oct 03 '24 11:10 olivertzeng