当前位置:网站首页>Low code platform international multilingual (I18N) technical solution
Low code platform international multilingual (I18N) technical solution
2022-07-03 12:42:00 【Older farmers have dreams】
internationalization (Internationalization, abbreviation i18n): It means that software development should have the function of supporting multiple languages and regions . That is to say, it can switch the page display language .i18n, among “I” and “n” First and last characters respectively ,18 Is the number of characters in the middle .
Low code platform / Using international multilingualism in the zero code platform (i18n), Involving static text internationalization 、 Dynamic text internationalization 、 Menu internationalization, etc . among , Model driven 、 Visualize the business module generated by zero code configuration , How to internationalize multilingualism , It is the key and difficult point for zero code platform to solve internationalization .
1、 Static text internationalization multilingualism
Static text refers to the names written in the code , Back end included Java Code and front end Vue Code , such as : backstage Java The code judges that the login password is wrong , return “ Wrong user name or password ” Such information ; front end vue Code “ newly added ”“ Delete ” Wait for the button name 、“ user name ”、“ state ” Equivalent label name . These are all static text , The technology of international multilingual transformation is relatively simple , But the workload is relatively large , The following describes the static internationalization ideas of the back-end and front-end respectively .
1.1、 Back end internationalization (Java)
(1) Define multilingual resource files
In the engineering resources/static/i18n Under the table of contents , Chinese simplified messages.properties
user.login.success= Login successful
user.logout.success= Quit successfully
user.register.success= Registered successfully
American English messages_en_US.properties
user.login.success=Login Success
user.logout.success=logout Success
user.register.success=register Success
(2)java Code using I18nUtil Acquire internationalization
I18nUtil.message(“user.login.success”)
(3) be based on IDEA Develop multilingual files 
1.2、 Front end internationalization (Vue)
(1) Define multilingual resource files
In the engineering src/assets/lang Under the table of contents , Chinese simplified zh_CN.json
{
"m": {
"common": {
"button": {
"add": " newly added ",
"update": " edit ",
"delete": " Delete "
}
}
}
}
American English en_US.json
{
"m": {
"common": {
"button": {
"add": "New",
"update": "Modify",
"delete": "Delete"
}
}
}
}
(2)vue Code using $t Acquire internationalization
Normal text usage : { { $t('m.fm.components.fields.input') }}
How to use it in the label : :placeholder="$t('m.fm.components.fields.input')"
js Internal use : this.$t('m.fm.components.fields.input')
(3) be based on Webstore Develop multilingual files
Multi language identification should avoid global conflicts , Recommended naming conventions : System name . The name of the table . Prompt name , such as :app1.table1.hello
2、 Dynamic text internationalization multi language
A generated module based on model visualization configuration , Multilingual maintenance is different from static resource files , Model based dynamic maintenance is also required , Instead of developers writing dead code in advance .
2.1、 Maintain multiple languages based on business models
In the zero code platform , Common visual development methods , Let's say form design and page design based on business model , Then the key point of the implementation of dynamic multilingual technology is how to configure multilingual based on business model . In the cloud low code platform , Multi language extension based on application entity model , The fields of the entity model will be automatically synchronized to the multilingual configuration , You only need to maintain the Chinese of the field 、 English name is enough .“ other ” Allow users to add language information under the category , Note that the code must be unique , It is recommended that different applications use different prefixes to distinguish codes .
2.2、 Visual designers use multiple languages
When designing forms and pages , Use multilingual controls to enter dynamic text that needs to be internationalized , For example, the label of a form control 、 Column name of the list 、 Button name, etc , Here's the picture .
Chinese environment form design :
English environment form design :
3、 Menu name internationalized multilingual
Menu multilingual development is actually data multilingual , Non text label multilingual , So it is necessary to maintain the menu , Enter names in multiple languages . Enter the menu management module , Click the add or edit button , Maintain menu multilingual in pop-up page :
The menu name is the default menu name , Chinese and English are the multilingual configuration of the menu respectively , The front-end display menu rule is : First find the corresponding language name according to the current language environment , If not found , Take the default menu name .
English environment menu multi language display :
Chinese environment menu multi language display :
4、 The system switches between multiple languages
Multilingual switching refers to the same system , Different users log in , You can switch between different languages .
Generally, the portal for switching between multiple languages is when the user logs in , Manually select switch multi language .
It should be noted that , Multilingual switching is related to the user's current login session , Not system level multilingualism , In terms of technical realization , The language type selected by the current user needs to be passed to the system through the thread safety mechanism , Realize multi language switching by user session .
Reference resources :
边栏推荐
- Nodejs+Express+MySQL实现登陆功能(含验证码)
- lambda与匿名内部类的区别
- Swift5.7 扩展 some 到泛型参数
- Implement verification code verification
- 网上炒股开户安不安全?谁给回答一下
- 启用MemCached的SASL认证
- Self made pop-up input box, input text, and click to complete the event.
- 剑指Offer10- I. 斐波那契数列
- Sword finger offer06 Print linked list from end to end
- Integer int compare size
猜你喜欢
【ArcGIS自定义脚本工具】矢量文件生成扩大矩形面要素
LeetCode 0556.下一个更大元素 III - 4步讲完
电压环对 PFC 系统性能影响分析
Sword finger offer09 Implementing queues with two stacks
If you can't learn, you have to learn. Jetpack compose writes an im app (I)
[ManageEngine] the role of IP address scanning
Idea packages the web project into a war package and deploys it to the server to run
(最新版) Wifi分销多开版+安装框架
社交社区论坛APP超高颜值UI界面
使用BLoC 构建 Flutter的页面实例
随机推荐
Lambda expression
最新版盲盒商城thinkphp+uniapp
init. RC service failed to start
(最新版) Wifi分销多开版+安装框架
The latest version of blind box mall thinkphp+uniapp
Integer string int mutual conversion
Keep learning swift
GCN thinking - word2vec directly calculates text classification
Comprehensive evaluation of double chain notes · Siyuan notes: advantages, disadvantages and evaluation
初入职场,如何快速脱颖而出?
How to convert a decimal number to binary in swift
Swift5.7 扩展 some 到泛型参数
Apache Mina开发手册
Write a simple nodejs script
[ManageEngine] the role of IP address scanning
[ArcGIS user defined script tool] vector file generates expanded rectangular face elements
[download attached] password acquisition tool lazagne installation and use
257. All paths of binary tree
4. 无线体内纳米网:电磁传播模型和传感器部署要点
Dix règles de travail