Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make language files uniform #704

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
4 changes: 3 additions & 1 deletion res/lang/cat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ err_alloc = assignació de memòria fallida
err_bounds = índex fora de límits
err_brightness_change = error en canviar la brillantor
err_chdir = error en obrir la carpeta home

err_console_dev = error en accedir a la consola
err_dgn_oob = missatge de registre
err_domain = domini invàlid
Expand Down Expand Up @@ -35,6 +36,7 @@ err_perm_dir = error en canviar el directori actual
err_perm_group = error en degradar els permisos de grup
err_perm_user = error en degradar els permisos de l'usuari
err_pwnam = error en obtenir la informació de l'usuari

err_unknown = ha ocorregut un error desconegut
err_user_gid = error en establir el GID de l'usuari
err_user_init = error en inicialitzar usuari
Expand All @@ -46,10 +48,10 @@ err_xsessions_open = error en obrir la carpeta de sessions
insert = inserir
login = iniciar sessió
logout = sessió tancada
no_x11_support = x11 support disabled at compile-time
no_x11_support = el suport per x11 ha estat desactivat en la compilació
normal = normal
numlock = Bloq Num

password = Clau
restart = reiniciar
shell = shell
Expand Down
17 changes: 17 additions & 0 deletions res/lang/cs.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@



capslock = capslock
err_alloc = alokace paměti selhala
err_bounds = index je mimo hranice pole

err_chdir = nelze otevřít domovský adresář

err_console_dev = chyba při přístupu do konzole
err_dgn_oob = zpráva protokolu
err_domain = neplatná doména

err_hostname = nelze získat název hostitele
err_mlock = uzamčení paměti hesel selhalo
err_null = nulový ukazatel

err_pam = pam transakce selhala
err_pam_abort = pam transakce přerušena
err_pam_acct_expired = platnost účtu vypršela
Expand All @@ -29,17 +36,27 @@ err_perm_dir = nepodařilo se změnit adresář
err_perm_group = nepodařilo se snížit skupinová oprávnění
err_perm_user = nepodařilo se snížit uživatelská oprávnění
err_pwnam = nelze získat informace o uživateli


err_user_gid = nastavení GID uživatele selhalo
err_user_init = inicializace uživatele selhala
err_user_uid = nastavení UID uživateli selhalo


err_xsessions_dir = nepodařilo se najít složku relací
err_xsessions_open = nepodařilo se otevřít složku relací

login = uživatel
logout = odhlášen


numlock = numlock

password = heslo
restart = restartovat
shell = příkazový řádek
shutdown = vypnout

wayland = wayland

xinitrc = xinitrc
17 changes: 17 additions & 0 deletions res/lang/de.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@



capslock = Feststelltaste
err_alloc = Speicherzuweisung fehlgeschlagen
err_bounds = Listenindex ist außerhalb des Bereichs

err_chdir = Fehler beim oeffnen des home-ordners

err_console_dev = Zugriff auf die Konsole fehlgeschlagen
err_dgn_oob = Protokoll Nachricht
err_domain = Unzulaessige domain

err_hostname = Holen des Hostnames fehlgeschlagen
err_mlock = Abschließen des Passwortspeichers fehlgeschlagen
err_null = Null Zeiger

err_pam = pam Transaktion fehlgeschlagen
err_pam_abort = pam Transaktion abgebrochen
err_pam_acct_expired = Benutzerkonto abgelaufen
Expand All @@ -29,17 +36,27 @@ err_perm_dir = Fehler beim wechseln des Ordners
err_perm_group = Fehler beim heruntersetzen der Gruppen Berechtigungen
err_perm_user = Fehler beim heruntersetzen der Nutzer Berechtigungen
err_pwnam = Holen der Benutzerinformationen fehlgeschlagen


err_user_gid = Fehler beim setzen der Gruppen Id des Nutzers
err_user_init = Initialisierung des Nutzers fehlgeschlagen
err_user_uid = Setzen der Benutzer Id fehlgeschlagen


err_xsessions_dir = Fehler beim finden des Sitzungsordners
err_xsessions_open = Fehler beim öffnen des Sitzungsordners

login = Anmelden
logout = Abgemeldet


numlock = Numtaste

password = Passwort
restart = Neustarten
shell = shell
shutdown = Herunterfahren

wayland = wayland

xinitrc = xinitrc
6 changes: 4 additions & 2 deletions res/lang/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ err_alloc = failed memory allocation
err_bounds = out-of-bounds index
err_brightness_change = failed to change brightness
err_chdir = failed to open home folder

err_console_dev = failed to access console
err_dgn_oob = log message
err_domain = invalid domain
Expand Down Expand Up @@ -47,14 +48,15 @@ err_xsessions_open = failed to open sessions folder
insert = insert
login = login
logout = logged out
normal = normal
no_x11_support = x11 support disabled at compile-time
normal = normal
numlock = numlock

password = password
restart = reboot
shell = shell
shutdown = shutdown
sleep = sleep
wayland = wayland
xinitrc = xinitrc
x11 = x11
xinitrc = xinitrc
9 changes: 9 additions & 0 deletions res/lang/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ brightness_up = subir brillo
capslock = Bloq Mayús
err_alloc = asignación de memoria fallida
err_bounds = índice fuera de límites

err_chdir = error al abrir la carpeta home

err_console_dev = error al acceder a la consola
err_dgn_oob = mensaje de registro
err_domain = dominio inválido

err_hostname = error al obtener el nombre de host
err_mlock = error al bloquear la contraseña de memoria
err_null = puntero nulo

err_pam = error en la transacción pam
err_pam_abort = transacción pam abortada
err_pam_acct_expired = cuenta expirada
Expand All @@ -32,9 +36,13 @@ err_perm_dir = error al cambiar el directorio actual
err_perm_group = error al degradar los permisos del grupo
err_perm_user = error al degradar los permisos del usuario
err_pwnam = error al obtener la información del usuario


err_user_gid = error al establecer el GID del usuario
err_user_init = error al inicializar usuario
err_user_uid = error al establecer el UID del usuario


err_xsessions_dir = error al buscar la carpeta de sesiones
err_xsessions_open = error al abrir la carpeta de sesiones
insert = insertar
Expand All @@ -50,4 +58,5 @@ shell = shell
shutdown = apagar
sleep = suspender
wayland = wayland

xinitrc = xinitrc
9 changes: 6 additions & 3 deletions res/lang/fr.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
authenticating = authentification...

brightness_down = diminuer la luminosité
brightness_up = augmenter la luminosité
capslock = verr.maj
err_alloc = échec d'allocation mémoire
err_bounds = indice hors-limite
err_brightness_change = échec du changement de luminosité
err_chdir = échec de l'ouverture du répertoire home

err_console_dev = échec d'accès à la console
err_dgn_oob = message
err_domain = domaine invalide
Expand Down Expand Up @@ -35,6 +36,7 @@ err_perm_dir = échec de changement de répertoire
err_perm_group = échec du déclassement des permissions de groupe
err_perm_user = échec du déclassement des permissions utilisateur
err_pwnam = échec de lecture des infos utilisateur

err_unknown = une erreur inconnue est survenue
err_user_gid = échec de modification du GID
err_user_init = échec d'initialisation de l'utilisateur
Expand All @@ -46,14 +48,15 @@ err_xsessions_open = échec de l'ouverture du dossier de sessions
insert = insertion
login = identifiant
logout = déconnecté
normal = normal
no_x11_support = support pour x11 désactivé lors de la compilation
normal = normal
numlock = verr.num

password = mot de passe
restart = redémarrer
shell = shell
shutdown = éteindre
sleep = veille
wayland = wayland
xinitrc = xinitrc
x11 = x11
xinitrc = xinitrc
17 changes: 17 additions & 0 deletions res/lang/it.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@



capslock = capslock
err_alloc = impossibile allocare memoria
err_bounds = indice fuori limite

err_chdir = impossibile aprire home directory

err_console_dev = impossibile aprire console
err_dgn_oob = messaggio log
err_domain = dominio non valido

err_hostname = impossibile ottenere hostname
err_mlock = impossibile ottenere lock per la password in memoria
err_null = puntatore nullo

err_pam = transazione PAM fallita
err_pam_abort = transazione PAM interrotta
err_pam_acct_expired = account scaduto
Expand All @@ -29,17 +36,27 @@ err_perm_dir = impossibile cambiare directory corrente
err_perm_group = impossibile ridurre permessi gruppo
err_perm_user = impossibile ridurre permessi utente
err_pwnam = impossibile ottenere dati utente


err_user_gid = impossibile impostare GID utente
err_user_init = impossibile inizializzare utente
err_user_uid = impossible impostare UID utente


err_xsessions_dir = impossibile localizzare cartella sessioni
err_xsessions_open = impossibile aprire cartella sessioni

login = username
logout = scollegato


numlock = numlock

password = password
restart = riavvio
shell = shell
shutdown = arresto

wayland = wayland

xinitrc = xinitrc
49 changes: 49 additions & 0 deletions res/lang/normalize_lang_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env python3

from pathlib import Path
from sys import stderr


def process_lang_file(path: Path, lang_keys: list[str]) -> None:
# read key-value-pairs from lang file into dict
existing_entries = {}
with open(path, "r", encoding="UTF-8") as fh:
while line := fh.readline():
try:
key, value = line.split("=", 1)
existing_entries[key.strip()] = value.strip()
except ValueError: # line does not contain '='
continue

# re-write current lang file with entries in order of occurence in `lang_keys`
# and with empty lines for missing translations
with open(path, "w", encoding="UTF-8") as fh:
for item in lang_keys:
try:
fh.write(f"{item} = {existing_entries[item]}\n")
except KeyError: # no translation for `item` yet
fh.write("\n")


def main() -> None:
zig_lang_file = Path(__file__).parent.joinpath("../../src/config/Lang.zig").resolve()
if not zig_lang_file.exists():
print(f"ERROR: File '{zig_lang_file.as_posix()}' does not exist. Exiting.", file=stderr)
exit(1)

# read "language keys" from `zig_lang_file` into list
lang_keys = []
with open(zig_lang_file, "r", encoding="UTF-8") as fh:
while line := fh.readline():
# only process lines that are not empty or no comments
if not (line.strip() == "" or line.startswith("//")):
lang_keys.append(line.split(":")[0].strip())

lang_files = [f for f in Path.iterdir(Path(__file__).parent) if f.name.endswith(".ini") and f.is_file()]

for file in lang_files:
process_lang_file(file, lang_keys)


if __name__ == "__main__":
main()
17 changes: 17 additions & 0 deletions res/lang/pl.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@



capslock = capslock
err_alloc = nieudana alokacja pamięci
err_bounds = indeks poza granicami

err_chdir = nie udało się otworzyć folderu domowego

err_console_dev = nie udało się uzyskać dostępu do konsoli
err_dgn_oob = wiadomość loga
err_domain = niepoprawna domena

err_hostname = nie udało się uzyskać nazwy hosta
err_mlock = nie udało się zablokować pamięci haseł
err_null = wskaźnik zerowy

err_pam = transakcja pam nieudana
err_pam_abort = transakcja pam przerwana
err_pam_acct_expired = konto wygasło
Expand All @@ -29,17 +36,27 @@ err_perm_dir = nie udało się zmienić obecnego katalogu
err_perm_group = nie udało się obniżyć uprawnień grupy
err_perm_user = nie udało się obniżyć uprawnień użytkownika
err_pwnam = nie udało się uzyskać informacji o użytkowniku


err_user_gid = nie udało się ustawić GID użytkownika
err_user_init = nie udało się zainicjalizować użytkownika
err_user_uid = nie udało się ustawić UID użytkownika


err_xsessions_dir = nie udało się znaleźć folderu sesji
err_xsessions_open = nie udało się otworzyć folderu sesji

login = login
logout = wylogowano


numlock = numlock

password = hasło
restart = uruchom ponownie
shell = powłoka
shutdown = wyłącz

wayland = wayland

xinitrc = xinitrc
Loading