Description: Used for the specified text translation of the template.
How to use:{% tr 变量名称 %}
The prerequisite for using the translation field is that the template supports multilingual functionality. The multilingual function of the template is enabled as follows:
Create the locales directory under the template directory, and then create a folder whose name is the code in the current language, such as zh-CN or zh-TW. Create a yml file in the folder, such as default.yml. The directory structure is as follows:
./locales
├── en-us
│ └── default.yml
├── ja
│ └── default.yml
├── nl
│ └── default.yml
└── zh-cn
└── default.yml
The default.yml file content in Chinese is as follows:
"yourLocation": "您的位置"
Calling method:{% tr "yourLocation" %}
After the template is parsed, the contents of different languages will be displayed accordingly, such as the Chinese version您的位置
, displayed in English asYour location
.