Description: Used for specifying text translation in templates.
Usage:{% tr 变量名称 %}
The premise of using the translation field is that the template supports multi-language functionality. The method to enable the multi-language function of the template is as follows:
Create a 'locales' directory under the template directory, then create a folder named after the current language code, such as zh-CN or zh-TW.Create a yml file in the folder, for example, default.yml.The directory structure is as follows:
./locales
├── en-us
│ └── default.yml
├── ja
│ └── default.yml
├── nl
│ └── default.yml
└── zh-cn
└── default.yml
The content of the Chinese default.yml file is as follows:
"yourLocation": "您的位置"
Calling method:{% tr "yourLocation" %}After the template is parsed, it will display content in different languages accordingly, such as displaying Chinese as您的位置and English asYour location.