A few days ago I published my first package in Hex.pm. It is called Trans and aims to provide a easy way to leverage database support of JSON datatypes to store translations. Trans is heavily inspired by the incredible gem hstore_translate.
The traditional approach of having adjacent tables for storing the translation information quickly increases the number of JOINs required for retrieving data, especially when a single query contains multiple models. The approach provided by Trans stores translations in a single column of each model, so when a model is retrieved so are it’s translations. Modern RDBMSs provide support for this kind of unschemed data and to use conditions in it.
If you find it interesting, take a more detailed look at:
- Trans page on Hex.pm: https://hex.pm/packages/trans
- Trans documentation: https://hexdocs.pm/trans/api-reference.html
- Trans code: https://github.com/belaustegui/trans
Any suggestions, issues, ideas and contributions are more than welcome.