i18n stands for internationalization, which is a process of designing a software application so that it can be adapted to various languages and regions without engineering changes.
In this post, we will introduce the basics of i18n, then discuss the common concerns that need to be taken care of, and finally, we will show you how we implemented i18n in GNU Artanis.
The basic idea of i18n is to separate the text from the code. This is done by using a dictionary that maps the text to a key. The key is then used in the code to refer to the text. This way, the text can be easily replaced with a translation without changing the code.
Say if your website has a title "Hello" and you want to make it available in multiple languages. Imaginary, You can create a dictionary like this:
Then in your code, you can use the key "Hello" to refer to the text. When you want to display the text, you can look up the key in the dictionary and get the translation. When you done this, we say you have done i18n.