O'Reilly logo

Metaprogramming Elixir by Chris McCord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building an Internationalization Library

Almost all user-facing applications are best served by an internationalization layer where language snippets can be stored and referenced programmatically. Let’s use code generation to produce an internationalization library in fewer lines of code than you thought possible. This is the most advanced exercise you’ve done so far, so let’s start by breaking down our implementation into a rubric that you can use to attack complex metaprogramming problems.

Step 1: Plan Your Macro API

The first step of our Translator implementation is to plan the surface area of our macro API. This is often called README Driven Development. It helps tease out our library goals and figure out what macros we need to make them happen. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required