I see that https://github.com/rust-lang/rfcs/pull/1292 has been closed as it was considered too early to internationalize the compiler, yet at the same time the recent “Rust Platform” post which emphasized the need for making it easier to get into Rust made me think that the language barrier might really be a show-stopper.
I’ve worked with on a website before which had “dynamic” translated text, and I do understand the pain there is in finding a good framework for this, and the decision from Niko that it’s too early to translate “dynamic” error messages right now.
There is, however, one option we could entertain: putting in place a rudimentary system to have the translated version of the long forms of error messages (displayed by the --explain
option).
Unlike the “dynamic” error messages which need to splice in multiple pieces, the --explain
text is purely static. There is therefore no need for complicated scripting/formatting shenanigans.
I could imagine a rudimentary system in place with just bare text files:
i18n/
en-US/explain.txt
fr-FR/explain.txt
default.txt
where default.txt
would point to either en-US
or fr-FR
(in this scenario) and explain.txt
would contain the rudimentary format:
E0180
Some explanation text in the appropriate format
E0181
Some other text
in multiple lines
(or something equally simple).
It should be (relatively) easy to put in place, and a simple tool comparing the vN and v(N+1) version in en-US (assumed to be the reference) and in xx-YY would point all missing translations, or non-updated ones.
Also, even if the format is scraped in the future once the compiler gets a “real” i18n framework, it should be relatively easy to create a script that converts the existing translations to the new format so no translator work would be lost.
Note: on top of the compiler, it should probably also require some rustup/cargo work to setup the “default.txt” file and fetch a translation from the web.
As mentioned, it would be rudimentary, but I imagine that for someone not too proficient in English who is confused by the error message having the explanation be provided in their own language might really ease their work.
What do you think?