Urgent.News

What's breaking now, across thousands of outlets.

Tech

i18n without gettext: JSON translations with dot keys

Quieres que tu app hable español e inglés. Buscas cómo, y el ecosistema te empuja a gettext o Babel: ficheros .po , un paso de compilación a .mo , herramientas de extracción. Potente, sí. Pero para una app pequeña o mediana es un peaje que no querías pagar — solo necesitabas un t() honesto. Lo resolví tantas veces que lo empaqueté: dotkey-i18n , Python puro, sin dependencias. Tus traducciones son…

Translated from Spanish Read in Spanish

A Python library called dotkey-i18n has been created to simplify internationalization for small to medium-sized applications. It allows translations to be stored in JSON files, which can be easily edited, and supports multiple languages. The library provides features such as fallback to a default language, navigation of nested JSON keys, and interpolation of variables.

It is framework-agnostic and can be used with various frameworks such as NiceGUI, Flask, and FastAPI. The library is available on GitHub and can be installed via pip.

Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The problem with the happy path

I recently had to do a deployment for a client demo. On local everything worked fine. All the tests were passing. All the data was where it was supposed to be. And then I pushed it to production.

  • Client demo deployed smoothly in local environment
  • Production queries failed due to empty state
  • Reporter learned importance of testing unhappy paths

var in JavaScript

var is one of the ways to create a variable in JavaScript. A variable is a place to store a value, like a name or a number. var is mostly seen in old JavaScript code, written before 2015.

  • "var" is a common variable declaration method in JavaScript.
  • Variables created with "var" can be modified and re-declared.
  • "var" variables are hoisted to the top of their containing function.

More from Sunday 16 August →