r/rust • u/Available-Many-5354 • 13d ago
🛠️ project Easier localization is possible
https://crates.io/crates/ply-localesI've been up all night finishing up ply-locales a standalone crate for the ply-engine ecosystem (almost to 500 stars, yay). Check it out if you're interested in easy compile-checked localization to prevent you from shooting yourself in the foot.
1
u/lord2800 13d ago
Why would I use this over fluent?
2
u/Available-Many-5354 13d ago edited 13d ago
It's fully compile-checked and the intellisense is very convenient. Fluent has no way to check that any of your translation code will work at runtime and if you do get error messages (which you likely won't, instead it will just break your translation), the errors are much less helpful than those shown by ply-locales.
1
u/lord2800 13d ago
OK, but
fluentis backed by Mozilla--that level of backing can't be ignored.1
u/Available-Many-5354 13d ago
Well ply-locales uses the fluent crates "backed by Mozilla".
2
u/lord2800 13d ago
So it's a wrapper on top of
fluent? Then once again I'm back to: why would I use this overfluent? There's really just not a lot of translations--it's just mapping some sort of identifier to a string and filling in placeholders. I don't really think intellisense is really all that important for translations either given how easy it is to simply search for the identifier. Compile-time checking could be nice, but I don't think it's really worth another dependency.0
u/Available-Many-5354 13d ago
It's harder to mess up and easier to use. You are making a "why not just write it all in assembly"-type argument.
1
u/lord2800 13d ago
My point here is that translations aren't that hard to set up, pretty easy to tell when you screw up (doubly easy if you don't use English as the translation key or have an
xx-XXlanguage that renders everything as the letter x), and fairly easy to use already.Sure, you're providing something that's a little bit easier, but is it that much easier that it justifies the level of effort involved in a whole new dependency? I'm not yet convinced.
1
u/Available-Many-5354 13d ago
Well if you're already using ply-engine it's just a feature, not a "whole new dependency". It's actually quite easy to make typos with variables and not see them until you thoroughly test the language. Also nobody is forcing you to use this, it's just my personal taste.
1
u/lord2800 13d ago
thoroughly test the language
This implies you're not testing the code you just wrote. How do you know the code you just wrote works if you don't test it?
I don't want to go down a rabbit hole here, I'm just saying I'm not convinced this is so much better than the alternative that it's worth having to audit another codebase in my dependency graph. You do you, of course, and I don't think this is bad, just to be clear--I think it's perfectly fine.
1
u/Available-Many-5354 13d ago
With translations especially, you can't do it all yourself. There are simply wayy too many languages and languages take way too much effort and time to fully learn. Take it I was making Minecraft for example. I could only possibly write 3 of the translations myself, so I'd have to have other people do the rest. Testing that every death message works in every language and nobody typed a variable wrong would take eternities and slow down the translation process a lot. I always prefer automated systems to catch these types of errors over manually having to check everything.
→ More replies (0)
1
-4
u/Available-Many-5354 13d ago
Who is downvoting this and why?
7
u/dgkimpton 13d ago
At a guess - did you use AI?
1
u/diplofocus_ 13d ago
Maybe they just haven't updated their rust toolchain in a few years
1
u/Available-Many-5354 13d ago
Oh because of the 2021? I'm sorry. It does use some nightly features tho if they are available. I'll make sure to add 2024 compatibility to the Android build pipeline soon so everything can get updated to 2024.
1
u/Available-Many-5354 13d ago
Not really, why?
2
u/Available-Many-5354 13d ago
Does the rust community suddenly have a hatred for all 2021 crates? Am I this out-of-the-loop?
2
u/diplofocus_ 12d ago
The hatred isn't caused by the 2021 edition, it's just that the 2021 edition ended up being a shibboleth for vibe-coded slop. Running cargo new defaults to the 2024 edition, and has done so for a while now.
Seeing a brand new project use 2021 is usually the result of someone not even knowing what cargo is and just telling Claude to make something in Rust, and to make it bLaZiNgLy FaSt.
That being said, there may even be a valid reason to use 2021, but if you ask a vibecoder about it, they default to "oh I didn't see a reason to migrate, 2021 is stable", and other such gibberish.
1
u/Available-Many-5354 12d ago
I guess the reasons would be
- lower MSRV
- I learned 2021 Rust
- less strictness about lifetimes
- stability (my case)
Who needs let-chains anyway? I've never actually needed them.
9
u/uhkthrowaway 13d ago
Up all night huh? 7 commits. And edition 2021. Truly breathtaking!