-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Switch to Gettext (PO) file format for client-side translations #7290
Comments
It seems you did not inform yourself about why a custom file format was chosen instead of gettext. Additionally (quote):
Do you have such a solution? Don't get me wrong, there are good reasons to switch to the widely used |
Why not simply use PO files instead of compiled MO files and Gettext? So both sides can have what they most want: Everyone creating mods and/or translations can have a super stable, widespread, and reliable toolchain and you devs can have weird plaintext parsing you seem to have a fetish for. |
Nobody wants plaintext parsing, it's just that gettext does not expose the mechanisms needed to make it work for client-side translations. Besides, parsing .po files is not enough. To get all gettext features such as plural handling you do need to reimplement gettext, which is -- as nore already said -- complicated. |
Then all the plaintext parsing that happens in Minetest is there because …?
Then don’t replicate Gettext 1:1 but instead use the superior format and toolchain to get a PO file that then is used by the translation system instead of the stupid TR files that have no toolchain at all. To me it’s not about the actual implementation but the workflow when translating stuff. And this is – of course – Gettext based because every more or less relevant project uses Gettext. There are dozens and hundreds of tools, web services, and systems to get the untranslated strings, translate them, and return something (a PO file) that can be processed further (usually it is compiled to MO and then be used by Gettext, but that does not HAVE to be like that, the PO file can be used everywhere else). |
Go back to the forum post I linked above and read it again.
????????
Yes I'm talking about that, doing that is complicated. I'll say it again just in case: I am in favour of switching to gettext, but it's not easily possible at the moment. |
You mean the part that basically reads “we use the format intlib once used before they switched to use PO files – but we don’t do that”? And why cobble together and own weird system and not simply implement intlib?
!!!!!!!!
Why exactly is parsing a PO file complicated? There are even parsers for the compiled MO files in plain Lua. |
Can you please give a rough overview on how the client-side translations work in terms of network packets being exchanged between client and server? I want to understand why there's a problem/difficulty. |
No, I mean the part that says "gettext can't dynamically load and unload translations so we were forced to come up with our own system".
That's not what I said.
The gist of it is (for specifics ask nore):
The difficulty is not in the network protocol or what is sent to the client. |
Dude, you missed my whole point. DO. NOT. USE. GETTEXT. ... Can't write it any clearer than that. Use the PO file format so people can use their usual translation toolchain and do whatever is needed in order to provide translations as wanted. |
I thought the whole point of this issue is that Wuzzy wanted gettext (the software) to be used. |
Yes, but since Gettext can't be used easily it would be a good starting point to use plain PO files at least so the toolchain on user side (mod developers, translators, etc.) doesn't change.
Then don't support 90 percent of the features then. Just plain strings with replacement variables. It is so inherently simple that even I was able to do it in plain Lua. https://github.com/4w/xtend/tree/master/xtend_default/tools/convert_po_file_to_tr_file But because of my Lua skills and willingness to completely dig into something stupid as this it does not support multi-line strings. |
Yeah, I only care about adopting the PO file format, not about the exact implementation in Minetest. |
I just found about this old (2007) code for parsing MO files: http://number-none.com/blow/code/mo_file/ |
How easy would it be to modify gettext to expose or extract their file parser? |
I couldn't make any sense of this thread here. There is something I might be missing in my understanding. Is it maybe the future plans to implement dynamic translation loading in future versions of minetest? |
Works in the sense that a single language is forced on every single client on the server, yes.
Suppose you join a server, it provides translation files for a certain mod, then you leave and join another server, which happens to provide a translation file for the same mod, but a different one. |
is it possible to sandbox libgettext to be able to reload it? |
So basically to make this work, you actually have to write your own PO parser? Maybe talk to the Gettext people about this. I still can't wrap my head around that you supposedly cannot unload catalogues. |
Besides, it seems like the other thing we need to do, loading translation files at runtime, is not possible either. |
Is it possible to add basic support for PO files (without fancy features)? This will require a very basic loader for PO files. |
inttlib does exactly that. |
Issue type
Summary
I propose to switch to PO format for client-side / mod translations and remove all traces of the weird Minetest-only
.tr
file format.Rationale
Seriously, this should be a no-brainer.
.tr
files. Something as seemingly trivial such as updating a.tr
file would be a nightmare.tr
is Minetest-only and obscure; few people want to learn a new file format for no real reason.tr
format is Minetest-only, so interoperability with existing tools is practically zeroThoughs about compability
Note that there's no official release yet with mod translations, so it is not be too late to make the switch, you do not have to worry about breaking existing translations yet. If you wait with this for AFTER the 0.5.0 release, a transition would likely to be more painful.
The text was updated successfully, but these errors were encountered: