当前位置:网站首页>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 :
边栏推荐
猜你喜欢

4. 无线体内纳米网:电磁传播模型和传感器部署要点

实现验证码验证

【附下载】密码获取工具LaZagne安装及使用

1-2 project technology selection and structure

Flutter 退出登录二次确认怎么做才更优雅?

Take you to the installation and simple use tutorial of the deveco studio compiler of harmonyos to create and run Hello world?

Use Tencent cloud IOT platform to connect custom esp8266 IOT devices (realized by Tencent continuous control switch)

记录自己vulnhub闯关记录

(最新版) Wifi分销多开版+安装框架

Wechat applet pages always report errors when sending values to the background. It turned out to be this pit!
随机推荐
JVM memory model
Redhat5 installing socket5 proxy server
ImportError: No module named examples. tutorials. mnist
elastic_ L01_ summary
What is more elegant for flutter to log out and confirm again?
Sword finger offer05 Replace spaces
Eureka自我保护
Solve the problem of VI opening files with ^m at the end
【附下载】密码获取工具LaZagne安装及使用
Tensorflow binary installation & Failure
Fundamentals of concurrent programming (III)
Use bloc to build a page instance of shutter
2021 autumn Information Security Experiment 1 (password and hiding technology)
Apache Mina Development Manual
Ten workplace rules
电压环对 PFC 系统性能影响分析
【ArcGIS自定义脚本工具】矢量文件生成扩大矩形面要素
[download attached] password acquisition tool lazagne installation and use
最新版盲盒商城thinkphp+uniapp
Day 1 of kotlin learning: simple built-in types of kotlin