-
Notifications
You must be signed in to change notification settings - Fork 4
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
Messages facet #19
Comments
What needs to be done
DesignThe design is quite still quite open. Since The translations need to be specific to each crate, so each crate will need to get something like ‘domain’ in gettext. I was considering:
And 3. sounds best. And we should be able to do without static and dynamic variants, so just
This can be completely static. Message {
domain:"cratename",
context: "",
text: "Hello, World!",
translations: &[
("cs", "Ahoj, Světe!"),
],
} (or perhaps with a function for the translations or pointer to crate-wide table of all translations or something) There will be A message with plural forms will have to be of a separate type, However, there is another problem. Facets currently only have the one Open questions
|
Haven't read this in full yet, but an interesting alternative (going back to embedding |
Actually: is there any particular reason you want/need to embed this info anyway? |
Because
|
I don't really understand the second part of your post, since it misses out a lot of details for one unfamiliar with these libraries and concepts, but I'll trust you on this. |
Also, the |
I think we're going to depend on a lot of the gettext infrastructure anyway though, aren't we? |
Since this is a long-term goal, might be worth persuading the Cargo devs to allow including resource files with packages... |
Well, gettext infrastructure will be initially needed for extraction (xgettext) and it will always be needed for managing the catalogues. But I don't want to depend on it for build. And yes, it would be useful to persuade Cargo devs to add support for data files, but they seem to have huge backlog. |
Why not simply use the usual gettext build process, though, and have it entirely separate from Cargo? It would be nice if Cargo had pre/post-build scripts, of course. This could be another request.
I think it's still worth requesting anyway. With a bit of nudging, it may come sooner than you think! |
Long term, there is really no point in relying on gettext. Embedding the strings is simpler and more efficient, extraction should eventually be done with something that understands Rust syntax (the procedural macros themselves, likely) and the catalogs can be manipulated with whatever the author wants—translate-toolkit tends to be more flexible then gettext and I am sure there are other tools for xliff (which I want to support too in the end). Short term we will definitely rely on it for the extraction and maintenance of the translations, but I don't think it makes the generation much easier, so I'd prefer doing the in-code embedding straight away. |
Okay, fair enough. What format does translate-toolkit use to store translations though? If that's some sort of resource file, then we should petition Cargo to allow resource files. |
Translate toolkit is a development tool only. It does not have any runtime component that would store translations anywhere. |
Okay. So the idea is that the file format Translate Toolkit uses would be exported by some tool (from rust-locale) to a rust-locale–specific format? |
The idea is that a |
Where does Translate Toolkit come into it then? Surely there needs to be some interoperability of formats somewhere? |
There are two standard formats for the catalogs: Uniforum PO and XLIFF. We will read one or both, at compiletime, and generate appropriate substitutions for the Between us writing the template and us reading the translations, somebody has to actually translate it and that involves some maintenance of the catalogs. That's what gettext (the |
Define generic interface and implement using
gettextembedding suitable maps or closures in the binary..mo
catalogsThis task does not include implementation of template generation
nor catalog compilation, just reading (actually, they may be ‘compiled’ for embedding in the binary; this won't include checking yet though).The text was updated successfully, but these errors were encountered: