kip

kip

ex_cldr Core Team

Localize bindings for Lua, LFE, Erlang and Gleam

Localize friendly bindings for Lua, LFE, Erlang and Gleam

Localize provides locale-aware formatting of numbers, dates, currencies, units, lists and MessageFormat 2 messages. It’s an Elixir library, but everything it does runs on the BEAM.

To be a good BEAM citizen I’ve always wanted to provide good bindings to other BEAM languages but ex_cldr had too much “magic” to make that realistic. With Localize its possible and practical.

The guiding principle: each binding follows its own language’s idioms as best I know how (will some help from my local neighbourhood LLM).

localize_lua

Targeted at Elixir Lual..

Motivated by ash_cms, which renders Lua templates and needs locale-aware formatting inside the sandbox. Every call returns a string and falls back gracefully, so an untrusted template can never crash the render.

localize_lfe

Is Localize support for LFE:

(localize:currency 1234.56 "EUR" 
  (list #(locale de)))

It implements charlist/binary/atom coercion and lisp-case option keys translated to Localize’s snake_case.

localize_erl

Idiomatic Erlang bindings. Per-concern modules (localize_number, localize_date, …), {ok, Binary} | {error, {Tag, Message}} returns matching Localize’s own contract, maps for options, binaries throughout.

localize_gleam

Provides bindings for Gleam. Gleam’s build tool compiles Elixir dependencies transparently, and two things line up very well: Localize’s {ok, _} / {error, _} is Gleam’s Result, and collation’s :lt/:eq/:gt is gleam/order.Order. On top sits a fully-typed surface — an Options record, a LocalizeError union, typed date inputs:

number.format(1234.56, localize.Options(..localize.default(), currency: Some("USD")))
//=> Ok("$1,234.56")

Feedback welcome - especially to help me make the interfaces as idiomatic as possible.

Library links

Where Next?

Popular in Announcing Top

pkrawat1
Presenting Aviacommerce, open source e-commerce platform in Elixir Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
maltoe
Hello! Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_orde...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
sbs
Only 650 LOC, wrote for fun :slight_smile: https://github.com/sunboshan/qrcode
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps w...
New
josevalim
Hello everyone, We have just released NimbleCSV which is a small and fast CSV parsing library for Elixir. It allows developers to define...
New
Hal9000
Here is my first stab at this. README pasted below. https://github.com/Hal9000/elixir_random Comments and critiques are welcome. Thank...
New
fuelen
Hey folks! Want to present a toolkit for writing command-line user interfaces. It provides a convenient interface for colorizing text...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31194 112
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New

We're in Beta

About us Mission Statement