hansihe

hansihe

Icu is a localization library for Elixir. It wraps the icu4x library by the Unicode consortium (with a Rustler NIF).

Docs

Some highlights:

  • Ships with every locale in the basic, moderate and modern CLDR coverage levels by default.
  • Fast compile times. Downloads precompiled NIF by default.
  • Simple to use, minimal configuration, no backends.
  • Implements:
    • BCP-47 handling
    • Number
    • List
    • Temporal (DateTime, NaiveDateTime, Date, Time)
    • Relative Temporal
    • Currency formatting
  • Backed by the proven icu4x library
  • Already used heavily in production
  • Otherwise a very boring library :slight_smile:

Some caveats:

  • Limited set of functionality, not as comprehensive as the cldr set of Elixir libraries.
    • Contributions are very welcome if you need more icu4x functionality exposed.
  • Uses a NIF, which may not be something you want.
  • NIF library is relatively heavy, it contains a lot of locale data.
    • icu4x is already optimized rather heavily for embedded use cases, you have loads of options to reduce library size by selecting only the data you require. Contributions are very welcome to make the icu elixir library more customizable for embedded users as well!

https://github.com/hansihe/icu_ex

Showing Posts 1 to 10

kip

kip

ex_cldr Core Team

That’s great work. Maybe this is a better way to go for localisation in Elixir than the ex_cldr libs?

Schultzer

Schultzer

I think both libraries have value, would be cool to have benchmarks of both so people have more data points for which and when they should choose one or the other. But also both suffer the same pain that not all data is exposed and need continuous maintenance and contributions.

kip

kip

ex_cldr Core Team

Is there some particular data you’re thinking of that’s in CLDR but not exposed?

Schultzer

Schultzer

No, but if you look in this repo you’ll see what I mean.

hansihe

hansihe OP

Are you referring to the data directory?

This is automatically generated by a script, was planning on automating publishing updates with CI at some point, but I haven’t gotten there yet.

hansihe

hansihe OP

Thanks!

I am unsure, it certainly has some advantages around compile time and not having to implement a ton of the algorithms.

On the other hand it does use a NIF, which I know some people have a high threshold for using in production.

icu4x is also not fully feature-complete. There are probably a few things which are not present in icu4x at all which ex_cldr has. As an example, when implementing it for our use case I had to get some currency stuff exposed from upstream icu4x which we needed.

Schultzer

Schultzer

I’m thinking the nif and lib, unless that is what you’re generating. And also you mentioned you had to make changes to icux itself.

I do believe that we can make ex_cldr compile a lot faster, especially by leveraging persistent_term. Anyway I believe that runtime behaviour is more interesting.

hansihe

hansihe OP

Ah if you mean that code need to be written in the library to expose this stuff then this is true. I would be curious to hear what you think the alternative here would be through.

If ex_cldr compilation can be made a lot faster then that is great news! This is one of the main pain points which made us write this library.

Schultzer

Schultzer

My comment on the generation was directed at Kip’s question if icux would be a better foundation to build on, I disagree as both solutions faces similar constraints with regards to maintaining and data exposure.

So it does do make it easier. The two approaches have similar value with different trade offs.

Whats great about ex_cldr is that it’s all in Elixir and if we can it should be used as a target for making the BEAM compiler faster.

kip

kip

ex_cldr Core Team

The upcoming Localize (ex_cldr 3.0) will compile much much faster. The current bottleneck is the compiler phase that deals with multiple functions heads. Its gets very very slow when there are many many function heads - and thats relied upon heavily in the current implementation. The new implementation is runtime only (no compile time config), uses persistent_term for data storage (not compiled artifacts - with a couple of exceptions).

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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

Other Trending Topics Top

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
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews