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

OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
asiniy
Hey there! I wrote a download elixir package which does exactly what its name about - an easy way to download files. I saw solutions ab...
New
mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 19417 141
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
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
cjen07
parameterized pipe in elixir: |n> edit: negative index in |n> and mixed usage with |> are supported example: use ParamPipe ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New
Flo0807
Hello everyone! I am excited to share our heart project Backpex with you. After building several Phoenix applications, we realized that...
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

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement