< up >
2024-01-04

Hola docker, mucho gusto!1

I’m currently learning Spanish for my next vacation2. While Duolingo does an impressive job of gamifying the learning process, I thought about combining this fairly unknown world with one that I’m familiar with.

I use Linux and its utils a lot. I like to read man pages and I know a bunch of them. Why not switch the system language to Spanish then?

Well, maybe because 100 words is not enough… but in a fire-and-forget environment like a virtual machine or Docker container, it should be safe.

Contents

Dockerfile

After some fiddling with locale I came up with this Dockerfile:

FROM ubuntu:latest
RUN yes|unminimize
RUN apt update && \
    DEBIAN_FRONTEND=noninteractive apt install -y locales \
                                                  man-db \
                                                  manpages-es \
                                                  manpages-es-dev \
                                                  language-pack-es
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen && \
    dpkg-reconfigure --frontend=noninteractive locales && \
        update-locale LANG=es_ES.UTF-8
ENV LANG es_ES.UTF-8

Intermezzo - Minimized containers

Skip this if you just want to learn Spanish.

The Ubuntu container […] is a minimal install of Ubuntu[…] and needs to get unminimized in order to be “human-friendly”.

Otherwise, man bash prints:

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, including manpages, you can run the 'unminimize'
command. You will still need to ensure the 'man-db' package is installed.

Actually /usr/bin/man is a bash script that only outputs this text.

What does the unminimize actually do? Tell me, cat $(which unminimize): I’ve put the output into a gist. It basically enabled documentation and man-pages again.

Groping in the dark, anticipating light

Those 100 words I know are more about traveling and less about updating Ubuntu packages…

But, hey, you know what the messages should be about and anticipate their translation.

apt update

root@1e7e70970891:/# apt update
Des:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Des:2 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1.046 kB]
Obj:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Des:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Obj:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Des:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1.599 kB]
Des:7 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1.305 kB]
Descargados 4.179 kB en 6s (755 kB/s)
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Leyendo la información de estado... Hecho
Todos los paquetes están actualizados.

apropos .

apropos . is a great way to display one tool per line, including a description3. Some favorites of mine:

echo (1)             - muestra una línea de texto
futex (7)            - bloqueos rápidos en espacio de usuario
hostname (7)         - descripción de la resolución del nombre de equipo
man (1)              - interfaz de los manuales de referencia del sistema
memccpy (3)          - copia un área de memoria
memcmp (3)           - compara areas de memoria
memcpy (3)           - copiar area de memoria
memmem (3)           - localiza una subcadena
memmove (3)          - copia un área de memoria
memset (3)           - rellena una zona de memoria con bytes repetidos
md5sum (1)           - genera y verifica sumas de comprobación MD5
stpcpy (3)           - copia una cadena devolviendo un apuntador a su final
strcasecmp (3)       - comparan dos cadenas ignorando si son mayúsculas o minúsculas
strstr (3)           - localiza una subcadena
strchr (3)           - localizan un carácter en una cadena de ellos
strdup (3)           - duplican una cadena de caracteres
strlen (3)           - calcula la longitud de una cadena de caracteres

Especially all those C mem* and str* functions were fairly easy to anticipate when listed together:

man bash

Every time I accidentally look for the man page of a bash built-in, I get the huge bash man-page containing lots of essentials. In this case, this is exactly what we want. It offers everything from abstract basics like lists, expressions and comparisons to more practical features like the actual built-in commands.

Some of my favorite entries:

(lista)       lista se ejecuta en un subshell
{ lista; }    lista se ejecuta en el entorno actual de la shell
((expresión)) La expresión se evalúa de acuerdo a las reglas descritas abajo bajo la sección EVALUACIÓN ARITMÉTICA.

Today I learned

es en example es example en
información information Yo tengo información. I have information.
dependecias dependencies Vim necesite dependencias. Vim needs dependencies.
memoria memory Copiar area de memoria. Copy memory area.
caracteres character, personality ASCII tiene 128 characteres ASCII has 128 characters.
copia copy El programa copia el texto. The program copies the text.
compara compare Compara ambios programas Compare both programs.
interfaz interface Está activa sur interfaz de eth0? Is your eth0 interface up?
repetidos he repeats
texto text Soy un texto I’m a text.
sumas you add, join Él suma los números. He adds the numbers.
hecho done, complete, fact Bien hecho! Well done!

  1. Hello docker, nice to meet you
  2. The caminho portugeś “Jakobsweg” (Caminoh de Santiago) with Johannes.
  3. Where I still see a lot of English. Either I forgot some settings/packages, or the translation is still in progress.