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. ...
Get Metaprogramming Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.