Using Joomla’s multilingual capabilities in our component
While developing our component, you may have noticed we never used natural language for our labels and texts. Instead, we used key strings with the syntax of COM_SPM_CONTEXT_DETAIL
. This is to take advantage of the Joomla! translation system to allow us to provide our extension in multiple languages.
Joomla’s translation system is very powerful, but it’s also very simple. It is based on text files saved with the.ini
extension. These .ini
files contain a list of the key strings to translate followed by an equals sign and the translation surrounded by quotes. When loading the page, Joomla! reads these .ini
files and uses them to translate all the words passed through the Text
class. The simplicity of the system makes it possible to override translations easily and you may even override a core translation just by creating the same language key string. That is why we usually prefix our key strings with the...