A lot goes into the development of Ouch Browser, design, testing, and localization. Obviously, as the good programmer, you'd want to test everything to see how they work, right? I'll admit that translation tests were neglected often, up until a while ago when curiosity made me switch my LC_ALL environment variable to Estonian, the most complete translation in Ouch Browser at the time.

I noticed that most strings were translated, until I got into the UI elements which were directly rendered from code, they were still in English. I found this quite odd, how come certain strings are not being translated from the completed translation? Looking into it, this problem had to do with the underlying library used in code (as in, not in the Blueprint/GtkBuilder files), GetText.NET. After taking a look at the source code of the library, it actually reimplements gettext, which could have been the reason why it doesn't work as expected.

Then, I began searching online for a library that actually binded to the native gettext library, and after about two days of searching, I have concluded that it simply does not exist. However, being the change I want to see in the world, I took it upon myself to make my own library.

The first part involved researching how DllImport worked, since I remember that's how you use native libraries inside C#, but it didn't take me long to find out that it had a successor, LibraryImport (which, after nearly finishing the binding, apparently saved me from a lot of headaches). After that, I created the rough implementation as a unit test and hooked it into Ouch Browser's text domain.

After that, I hooked it directly into Ouch Browser (which for now on will be the reference application for Lunaris.Gettext). So far, so good, it worked with the LC_ALL environment variable, but then I found a huge problem.

After looking into this, though, I realized that this was a Weblate syncing issue, not an issue with gettext itself.

Then, I worked on expanding the unit tests to cover more edge cases and others. This is the first time I've ever written unit tests, mainly because this is the first thing I've ever written that has a high chance of failure.

Now, I was thinking about improving the cross-platform capabilities of Lunaris.Gettext. In the first version of this, I built gettext from source, which is obviously unfeasible, especially since this was only tested on glibc Linux. All of the compilation of the native gettext library and Lunaris.Gettext together eventually wore down my NVMe drive (and eventually corrupted my Fedora Workstation install).

Eventually, I realized another way this could have been used, which should have been very apparent to me the entire time, and that was using the system's gettext libraries. So, I got to work on writing the custom LibraryImport resolver, which handles gettext for each operating system (and now libc, which will be explained down the line). Running tests under Windows now worked!

I did implement and then remove setlocale(3) support for the sake of cross-platform, but I eventually backtracked on this, and started reimplementing it with Windows locales in mind too.

This has also led towards the first actual translation test, which would eventually be expanded to translated concatenations and plural translations.

And that leads us to the present. A lot of refactorings have been done, and more extensive testing, and it eventually led to the final minor release, not because I gave up, but because it was simply finished, and there was nothing more to implement, as long as if gettext stayed 1.0 (which is apparently a very new development, after more than 20 years, it's finally hit stable). We should all just do things.

Lunaris.Gettext
C# bindings for gettext
https://codeberg.org/lunaris-technologies/Lunaris.Gettext
Lunaris.Gettext 1.3.0
C# bindings for gettext
https://www.nuget.org/packages/Lunaris.Gettext