The Ur Project

Documenting the craft of stacking things so they remain stacked. For a very long time.

Not everyone speaks English

I'm not a native English speaker: I'm Dutch, so English is more or less my second native language. But not everyone is lucky enough to grow up in a country where foreign languages are naturally and culturally appreciated.

Sandcastle is a little English-centric, right now

So much is missing at the moment in the Sandcastle images that it's probably not very usable unless you're relatively familiar with English. I just hadn't gotten to it yet. Which is dumb, because I've done a ton of l10n and i18n work in the past (I even share a patent on it with someone, somewhere).

So it's time to fix all this. Fortunately, not much has changed since I last dug into this. Well, the stacks have mostly solidified and are a little better integrated, but as a whole, it all still works the same way. There's still ibus, with all the input methods (Sandcastle had ibus, but none of the input methods), and there's all the lang/* and locale/* stuff (and the images had almost none of that installed, either).

So today's package churn sorts out the basics, and adds the whole lot.

The goal: a fully usable live-usb image, in every region

The main Live USB image will remain the one-stop shop for everyone. Not only does it do double duty as a network installer (that you can repeatedly use without paying the download penalty), but the network installer also refreshes itself when you use it a few days later. It's essentially a live installer that's never obsolete. You can even just update it, like a normal install.

For that reason I'm going to stick all the language stuff and input methods into it. It's the most sensible place, so, why not? That means adding the input methods for e.g. Korean, Chinese, Japanese, Vietnamese and others. And fonts, CJK included, to cover most if not all scripts.

The trick: choosing at boot

We'll want to run gnome-initial-setup when the live-usb image first starts, because it's a good way for the user to start off using the system in their preferred language. So you insert the stick, turn on the computer, and then the first thing shown should be what language you want. Nothing else should be first.

But that requires that we have full translations of everything on the USB image as well. All the translations, a full set of glibc locales, and the CJK fonts add up to about 1 GiB. This means that the fun days of having a Live USB image in under 2 GiB are probably over. But the good thing is that we'll just keep a single Live USB image going forward, and we will test everything - no second-tier quality for non-English users.

The hidden feature that will now shine

I had previously documented that pkg will happily automatically install specific language subpackages as add-ons, if you configure it to do so, just like you could always install /debug or /man subpackages. This also allowed you to install powertop/lang/nl_NL if you so desired (**). Automatically. Which means that mechanically, keeping your system in your own language by default is very, very easy. It's a single configuration change and easy to turn on.

So the installer will make that change for you. The language you pick when the stick boots goes into include_subpkgs in /etc/pkg.toml on the system it installs. For Dutch, that's:

[install]
include_subpkgs = ["lang/nl", "lang/nl_NL"]

From then on, every package you install brings its Dutch translation along, if it has one. And because pkg upgrade applies it to what's already installed too, it also works if you change it later. Nothing else to do.

The subpackages post already showed how, back in part 6.

(**) If you think it's silly for a Dutch person to prefer a Dutch translation over the original, you're entirely correct. To be fair, 331 packages ship a Dutch translation, as plain nl. But I did a dispatch search on nl_NL, and out of nearly 3,000 recipes, exactly one package turns up. It's powertop. A program written by a Dutch person (not me), and maintained by me (a Dutch person) for several years, during which I wrote the l10n/i18n code it needed. So that particular translation exists purely to prove the translation worked (see for yourself), and getverdemme, nobody uses it. Pretty much. Helaas pindakaas.

Anyway, not everyone has a brain like mine, about 90% turned over to simplified English, that some days forgets how Dutch sounds. So I wish for those to be able to use Sandcastle images in their native or preferred languages. It's worth it. I enjoy reading and listening to some of the other languages I speak or can understand, and learning more languages has always been a fun experience for me.

If you're looking for l10n/i18n support - please follow the progress and help test these features as they'll get pushed to images soon. There are a few things that need to come together, and a human testing it is very valuable. Hop on Discord, or see how you can help.

--sofar (aka Auke)