Client-side translations

Nore
Developer
 
Posts: 492
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

Re: Client-side translations

by Nore » Fri Feb 02, 2018 22:18

Well, basically, that would be as much work as parsing the po files. The question is, how to do this without rewriting gettext?
 

User avatar
Wuzzy
Member
 
Posts: 2947
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: Client-side translations

by Wuzzy » Fri Feb 02, 2018 22:46

In case you have a solution that allows to load dynamically gettext po files (and unload them again once one leaves the server), then I will switch to gettext asap. Without it, I can find no better way than having to recode gettext, which is way more complicated than what we currently have.

Well, first of all, you do not directly load any files with Gettext. Then, as far I understand, it's not the PO files which are loaded into memory, but the MO files (compiled PO files for better efficiency).
The Gettext interface is basically just textdomain and gettext. I'm oversimplifying, of course, but there's no function to just “load a PO file”. The loading is probably done internally.
I guess you are worried about memory leaks, right?
I don't know exactly if Gettext ever unloads stuff. I hope it does. Maybe Gettext is clever and already does this automagically whenever needed. Since there's no way to explicitly unload stuff.
Sadly, the official Gettext docs don't say anything about its memory usage.
Probably the only way to find out for sure is too dig deep into Gettext source code or to ask Gettext developers.

Rewriting Gettext doesn't sound like a good idea. Talking to the Gettext devs would make much more sense. Our use case is quite an interesting and unusual one.
I'm creating MineClone 2, a Minecraft clone for Minetest. I made the Help modpack, adding in-game help to Minetest.
 

Nore
Developer
 
Posts: 492
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

Re: Client-side translations

by Nore » Fri Feb 02, 2018 22:55

The problem isn't memory usage per se, but rather that translations specific to a server should be unloaded once the server is left. The translations also need to be loaded when the server is joined, and I never found how to do that, unfortunately. (I'm not even sure it is possible with the gettext API).
 

User avatar
Linuxdirk
Member
 
Posts: 1222
Joined: Wed Sep 17, 2014 11:21
Location: Germany
GitHub: 4w
In-game: Linuxdirk

Re: Client-side translations

by Linuxdirk » Sat Feb 03, 2018 13:22

Okay then. So it’s a technical limitation. But why not take a raw PO files and manually parse them? Everyone creating translations would benefit from it because there are literally (and figuratively) hundreds of well documented and tested, widely supported and accepted, tools to create them.

I’m pretty sure it’s not specifically about passing a MO file to Gettext and have it processed (the technical side is important to core devs, of course, but why should mod devs care how the created translations are processed by the engine as long as it works as intended?) but about the missing tools to properly create translation bases from the code and the tools to write translations.
 

Previous

Return to News



Who is online

Users browsing this forum: zing269 and 3 guests