Skip to main content

6 posts tagged with "features"

View All Tags

Custom ICU Formatters in Lingui

· 2 min read
Andrii Bodnar
Engineering Manager

ICU MessageFormat comes with a fixed set of formatters: plural, select, selectordinal, number, date and time. Anything else had to happen in your code before the value reached the message, which meant the translator had no say in it. Lingui now lets you register your own formatters on the i18n instance and use them in messages like the built-in ones.

Lingui for Vue: Macros in Single-File Component Templates

· 4 min read
Andrii Bodnar
Engineering Manager

Vue projects could already use Lingui through @lingui/core and @lingui/extractor-vue, but there were no Vue bindings, and templates had to call i18n._ directly instead of using macros. The new @lingui/vue package adds Vue 3 bindings: Trans, useLingui, an app plugin, and a template transform that makes Lingui macros work inside <template> blocks.

social-card image

Lingui Without a Build Step: the Runtime Macro

· 2 min read
Andrii Bodnar
Engineering Manager

Lingui macros turn msg`Hello` into a message descriptor at build time, so they need Babel, SWC or the native transform. That works well in apps, but not everywhere. Node.js scripts, serverless functions, CLI tools and test runners often run your code as it is, with no compile step. The new experimental runtime macro covers those cases.

Native Macro Transform for Vite

· 3 min read
Andrii Bodnar
Engineering Manager

Lingui macros have always needed a compiler plugin: Babel or SWC turns t`Hello` and <Trans> into runtime calls at build time. In Vite that meant wiring the macro plugin into whichever compiler your framework plugin uses. The new native macro transform removes that step. One option in vite.config.ts, and @lingui/vite-plugin transforms macros itself.

social-card image

Introducing Context Directives

· 3 min read
Andrii Bodnar
Engineering Manager

One of Lingui's biggest ergonomic wins is keyless translations - you write the source string directly in your code and Lingui generates a stable ID for you. But that convenience quietly breaks down the moment you need context to prevent collisions across files. Suddenly you're writing context: "checkout" on every macro call in every file, which defeats the whole point.

social-card image