blink
blink copied to clipboard
Translate
I would like to make / help making French translation of this emulator . Thanks in advance.
Same for me, I would also like to contribute a translation. Please document the procedure required.
Looks like I'm going to be learning how to use GNU gettext today. We can certainly have rich internationalization and localization for the Blinkenlights TUI. With the Blink command things may get trickier since being able to claim the tiniest possible footprint is something that's important to me.
OK so after investigating things, GNU libintl is GPL so we can't use it. I looked to FreeBSD for inspiration, and they don't do translation at all, at least not on their C codebases. Since both of our volunteer translators know how to program in C, the thing I'd recommend doing is (1) checking the locale environment variable to see what the language is, (2) create an environment variable int g_lang
, then (3) add an if (!IsTiny() && g_lanch == FRENCH)
statement to blocks of code like this:
https://github.com/jart/blink/blob/aa3b30fa3976bdfd11b8954b107e5dc66287db91/blink/blinkenlights.c#L2036-L2049
The IsTiny()
function would be defined as such:
#ifdef TINY
#define IsTiny() 1
#else
#define IsTiny() 0
#endif
So long as i18n code doesn't get linked in MODE=tiny
I'm happy to support all the translations you want. That includes both the blink
and blinkenlights
commands. We could even link a library that makes this easier, provided it can be vendored and isn't GPL. The main things I care about is that MODE=tiny
stays tiny and static linking is possible. I also highly encourage not invented here syndrome, in case either of you want to take a crack at whipping up a homebrew version of the gettext()
function.
We should also begin writing a manual for Blinkenlights now that we have the GitHub website setup. The current website is https://justine.lol/blinkenlights/ which doesn't have a lot of information and is written by hand in HTML. We should ideally have something more modern that's markdown generated and abstracts showing the appropriate translation. I'm open to suggestions on which tooling is most appropriate with our existing GitHub Actions workflow.
Speaking of NIH for i18n support, https://wiki.musl-libc.org/alternatives.html recommends using https://github.com/sabotage-linux/gettext-tiny (MIT licensed). Would this library also work in combination with cosmopolitan ? Edit : It seems that gettext-tiny is some kind of empty implementation and that the real thing is in musl itself.
With the Blink command things may get trickier since being able to claim the tiniest possible footprint is something that's important to me.
This sure makes sense at the time of writing, but now with the ./configure
script we can hide the internationalization behind a flag.
Some good candidates for translations are the usage strings and fatal error strings from blink
. All the internal logging (stuff that are not visible unless -e
is specified) should be kept in the original language for easier diagnostics.