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

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
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
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
GES233
I’m posting this in response to Jose’s recent tweet (Cr. link) : People are sleeping on Elixir for a coding harness: Hot-code swappi...
New
_mfierro
Hello, I wrote Stop My Hand, a Scattergories-like web application using Phoenix/LiveView as my learning project for Elixir (after readin...
New

Other Trending Topics Top

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
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews