hauleth

hauleth

How do you deal with inflections in translations when working with Gettext? I am working on my side project where I want to introduce proper translations, and while “core” will be written in English I also want to add Polish (which is my mother tongue) and I see some issues with inflections, as Gettext do not support it at all. This can be problematic as the slavic languages relies on that a lot, and for example noun genders forces how to construct sentences, not speaking about grammatical cases or other stuff which makes it a lot harder.

How did you dealt with such cases? Because due to lack of such features I am currently quite keen into implementing Fluent Elixir, but it seems like tremendous work, and I would prefer to focus on application if there is already done framework that support such features.

Showing Posts 1 to 3

kip

kip

ex_cldr Core Team

You can’t really deal with it Gettext. Its a definitional problem, not an implementation one.

The Unicde message format does a better job but its certainly not complete. I have an implementation of it in ex_cldr_messages that is API complete but lacks the message store and translation part. If it appears to reasonably suit your needs you can start to develop your side project and I’ll hurry up the message store and translation part in parallel. Its high on my to-do list anyway and I just need the push…

An example:

Cldr.Message.format(
    "{gender_of_host, select,
      female {
        {num_guests, plural, offset: 1
          =0 {{host} does not give a party.}
          =1 {{host} invites {guest} to her party.}
          =2 {{host} invites {guest} and one other person to her party.}
          other {{host} invites {guest} and # other people to her party.}}}
      male {
        {num_guests, plural, offset: 1
          =0 {{host} does not give a party.}
          =1 {{host} invites {guest} to his party.}
          =2 {{host} invites {guest} and one other person to his party.}
          other {{host} invites {guest} and # other people to his party.}}}
      other {
        {num_guests, plural, offset: 1
          =0 {{host} does not give a party.}
          =1 {{host} invites {guest} to their party.}
          =2 {{host} invites {guest} and one other person to their party.}
          other {{host} invites {guest} and # other people to their party.}}}}",
  gender_of_host: "male",
  host: "kip",
  guest: "jim",
  num_guests: 1
)

If you follow this approach then you get immediate integration with the rest of ex_cldr to format money, numbers, dates, calendars, units and lists in a locale-specific fashion as well.

There is a new Unicode Working Group working on message formatting recognising the limitation on all the current approaches. I am participating in. There is a wealth of great content and discussion and you’d be welcome to observe or join. But its early days. Currently it looks like i18next and Fluent are providing the most inspiration.

kip

kip

ex_cldr Core Team

OK, I’ll take up the challenge and do a Fluent implementation for Elixir. I can reuse a lot of code from ex_cldr_messages. They are structurally quite similar and both work from CLDR data.

kip

kip

ex_cldr Core Team

Progress on ex_cldr_fluent is moving forward, but a bit slower than I’d like due to competing priorities (there’s some very cool stuff coming out with CLDR 37 related to units, unit conversion and unit localisation that I’m also finishing up for ex_cldr_units version 3.0 that will be released in April.

The parser for fluent messages is largely complete, then I need to work on the backend machinery. I’ll push the current work to GitHub soon so anyone interested can comment or contribute.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews