当前位置:网站首页>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 :
边栏推荐
- Flutter 退出登录二次确认怎么做才更优雅?
- 阿里大于发送短信(用户微服务--消息微服务)
- Tianyi ty1208-z brush machine detailed tutorial (free to remove)
- elastic_ L02_ install
- ORM use of node -serialize
- Togaf certification self-study classic v2.0
- Flinksql can directly create tables and read MySQL or Kafka data on the client side, but how can it automatically flow and calculate?
- 阿里 & 蚂蚁自研 IDE
- I'm too lazy to write more than one character
- Lambda表达式
猜你喜欢

【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)

T430 toss and install OS majave 10.14

Xctf mobile--rememberother problem solving

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

剑指Offer03. 数组中重复的数字【简单】

最新版盲盒商城thinkphp+uniapp

Sword finger offer06 Print linked list from end to end
![Sword finger offer04 Search in two-dimensional array [medium]](/img/c4/002c951f8d914aaea4f4133685ebd1.png)
Sword finger offer04 Search in two-dimensional array [medium]

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

Self made pop-up input box, input text, and click to complete the event.
随机推荐
Flinksql can directly create tables and read MySQL or Kafka data on the client side, but how can it automatically flow and calculate?
剑指Offer10- I. 斐波那契数列
Summary of error prone knowledge points: Calculation of define s (x) 3*x*x+1.
Keep learning swift
[ArcGIS user defined script tool] vector file generates expanded rectangular face elements
剑指Offer05. 替换空格
Introduction to concurrent programming (II)
Enable SASL authentication for memcached
云计算未来 — 云原生
T430 toss and install OS majave 10.14
alright alright alright
Official website of Unicode query
2.7 overview of livedata knowledge points
adb push apk
剑指Offer07. 重建二叉树
node的ORM使用-Sequelize
Fundamentals of concurrent programming (III)
GaN图腾柱无桥 Boost PFC(单相)七-PFC占空比前馈
Swift5.7 扩展 some 到泛型参数
lambda与匿名内部类的区别