Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
df106ae6
Unverified
Commit
df106ae6
authored
Nov 13, 2022
by
zhu-mingye
Committed by
GitHub
Nov 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature-1251][admin,web] Add backend internationalization (#1250)
* [Feature][admin,web] Add backend internationalization * fix encoding * change default language to SIMPLIFIED_CHINESE
parent
029d6b33
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
364 additions
and
47 deletions
+364
-47
AppConfiguration.java
...n/src/main/java/com/dlink/configure/AppConfiguration.java
+53
-22
WebExceptionHandler.java
...rc/main/java/com/dlink/exception/WebExceptionHandler.java
+9
-5
UserServiceImpl.java
...src/main/java/com/dlink/service/impl/UserServiceImpl.java
+16
-15
MessageResolverUtils.java
...n/src/main/java/com/dlink/utils/MessageResolverUtils.java
+64
-0
application.properties
dlink-admin/src/main/resources/application.properties
+29
-2
messages.properties
dlink-admin/src/main/resources/i18n/messages.properties
+62
-0
messages_en_US.properties
...k-admin/src/main/resources/i18n/messages_en_US.properties
+62
-0
messages_zh_CN.properties
...k-admin/src/main/resources/i18n/messages_zh_CN.properties
+62
-0
index.tsx
dlink-web/src/pages/user/Login/index.tsx
+7
-3
No files found.
dlink-admin/src/main/java/com/dlink/configure/
SaTokenConfigure
.java
→
dlink-admin/src/main/java/com/dlink/configure/
AppConfiguration
.java
View file @
df106ae6
...
@@ -21,46 +21,77 @@ package com.dlink.configure;
...
@@ -21,46 +21,77 @@ package com.dlink.configure;
import
com.dlink.interceptor.TenantInterceptor
;
import
com.dlink.interceptor.TenantInterceptor
;
import
java.util.Locale
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.LocaleResolver
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.i18n.CookieLocaleResolver
;
import
org.springframework.web.servlet.i18n.LocaleChangeInterceptor
;
import
cn.dev33.satoken.interceptor.SaRouteInterceptor
;
import
cn.dev33.satoken.interceptor.SaRouteInterceptor
;
/**
/**
*
SaTokenConfigure
*
AppConfiguration
*
*
* @author wenmo
* @author wenmo
* @since 2021/11/28 19:35
* @since 2021/11/28 19:35
*/
*/
@Configuration
@Configuration
public
class
SaTokenConfigure
implements
WebMvcConfigurer
{
public
class
AppConfiguration
implements
WebMvcConfigurer
{
public
static
final
String
LOCALE_LANGUAGE_COOKIE
=
"language"
;
/**
* Cookie
*
* @return local resolver
*/
@Bean
(
name
=
"localeResolver"
)
public
LocaleResolver
localeResolver
()
{
CookieLocaleResolver
localeResolver
=
new
CookieLocaleResolver
();
localeResolver
.
setCookieName
(
LOCALE_LANGUAGE_COOKIE
);
// set default locale
localeResolver
.
setDefaultLocale
(
Locale
.
SIMPLIFIED_CHINESE
);
// set language tag compliant
localeResolver
.
setLanguageTagCompliant
(
false
);
return
localeResolver
;
}
@Bean
public
LocaleChangeInterceptor
localeChangeInterceptor
()
{
return
new
LocaleChangeInterceptor
();
}
// 注册拦截器
// 注册拦截器
@Override
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
localeChangeInterceptor
());
// 注册Sa-Token的路由拦截器
// 注册Sa-Token的路由拦截器
registry
.
addInterceptor
(
new
SaRouteInterceptor
())
registry
.
addInterceptor
(
new
SaRouteInterceptor
())
.
addPathPatterns
(
"/api/**"
)
.
addPathPatterns
(
"/api/**"
)
.
excludePathPatterns
(
"/api/login"
)
.
excludePathPatterns
(
"/api/login"
)
.
excludePathPatterns
(
"/api/geTenants"
)
.
excludePathPatterns
(
"/api/geTenants"
)
.
excludePathPatterns
(
"/openapi/**"
);
.
excludePathPatterns
(
"/openapi/**"
);
registry
.
addInterceptor
(
new
TenantInterceptor
())
registry
.
addInterceptor
(
new
TenantInterceptor
())
.
addPathPatterns
(
"/api/alertGroup/**"
)
.
addPathPatterns
(
"/api/alertGroup/**"
)
.
addPathPatterns
(
"/api/alertHistory/**"
)
.
addPathPatterns
(
"/api/alertHistory/**"
)
.
addPathPatterns
(
"/api/alertInstance/**"
)
.
addPathPatterns
(
"/api/alertInstance/**"
)
.
addPathPatterns
(
"/api/catalogue/**"
)
.
addPathPatterns
(
"/api/catalogue/**"
)
.
addPathPatterns
(
"/api/clusterConfiguration/**"
)
.
addPathPatterns
(
"/api/clusterConfiguration/**"
)
.
addPathPatterns
(
"/api/cluster/**"
)
.
addPathPatterns
(
"/api/cluster/**"
)
.
addPathPatterns
(
"/api/database/**"
)
.
addPathPatterns
(
"/api/database/**"
)
.
addPathPatterns
(
"/api/history/**"
)
.
addPathPatterns
(
"/api/history/**"
)
.
addPathPatterns
(
"/api/jobInstance/**"
)
.
addPathPatterns
(
"/api/jobInstance/**"
)
.
addPathPatterns
(
"/api/namespace/**"
)
.
addPathPatterns
(
"/api/namespace/**"
)
.
addPathPatterns
(
"/api/savepoints/**"
)
.
addPathPatterns
(
"/api/savepoints/**"
)
.
addPathPatterns
(
"/api/statement/**"
)
.
addPathPatterns
(
"/api/statement/**"
)
.
addPathPatterns
(
"/api/task/**"
)
.
addPathPatterns
(
"/api/task/**"
)
.
addPathPatterns
(
"/api/role/**"
)
.
addPathPatterns
(
"/api/role/**"
)
//
.addPathPatterns("/api/fragment/**")
//
.addPathPatterns("/api/fragment/**")
.
addPathPatterns
(
"/api/jar/*"
);
.
addPathPatterns
(
"/api/jar/*"
);
}
}
}
}
dlink-admin/src/main/java/com/dlink/exception/WebExceptionHandler.java
View file @
df106ae6
...
@@ -21,6 +21,7 @@ package com.dlink.exception;
...
@@ -21,6 +21,7 @@ package com.dlink.exception;
import
com.dlink.common.result.Result
;
import
com.dlink.common.result.Result
;
import
com.dlink.model.CodeEnum
;
import
com.dlink.model.CodeEnum
;
import
com.dlink.utils.MessageResolverUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -63,10 +64,11 @@ public class WebExceptionHandler {
...
@@ -63,10 +64,11 @@ public class WebExceptionHandler {
@ExceptionHandler
@ExceptionHandler
public
Result
notLoginException
(
NotLoginException
e
)
{
public
Result
notLoginException
(
NotLoginException
e
)
{
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletResponse
response
=
servletRequestAttributes
.
getResponse
();
HttpServletResponse
response
=
servletRequestAttributes
.
getResponse
();
response
.
setStatus
(
CodeEnum
.
NOTLOGIN
.
getCode
());
response
.
setStatus
(
CodeEnum
.
NOTLOGIN
.
getCode
());
return
Result
.
notLogin
(
"该用户未登录!"
);
return
Result
.
notLogin
(
MessageResolverUtils
.
getMessage
(
"login.not-login"
)
);
}
}
@ResponseStatus
(
HttpStatus
.
BAD_REQUEST
)
// 设置状态码为 400
@ResponseStatus
(
HttpStatus
.
BAD_REQUEST
)
// 设置状态码为 400
...
@@ -80,12 +82,14 @@ public class WebExceptionHandler {
...
@@ -80,12 +82,14 @@ public class WebExceptionHandler {
// 这里列出了全部错误参数,按正常逻辑,只需要第一条错误即可
// 这里列出了全部错误参数,按正常逻辑,只需要第一条错误即可
FieldError
fieldError
=
(
FieldError
)
errors
.
get
(
0
);
FieldError
fieldError
=
(
FieldError
)
errors
.
get
(
0
);
if
(
StringUtils
.
isNotBlank
(
fieldError
.
getDefaultMessage
()))
{
if
(
StringUtils
.
isNotBlank
(
fieldError
.
getDefaultMessage
()))
{
return
Result
.
failed
(
String
.
format
(
"字段:%s, %s"
,
fieldError
.
getField
(),
fieldError
.
getDefaultMessage
()));
return
Result
.
failed
(
String
.
format
(
"字段:%s, %s"
,
fieldError
.
getField
(),
fieldError
.
getDefaultMessage
()));
}
}
return
Result
.
failed
(
String
.
format
(
"字段:%s,不合法的值:%s"
,
fieldError
.
getField
(),
fieldError
.
getRejectedValue
()));
return
Result
.
failed
(
String
.
format
(
"字段:%s,不合法的值:%s"
,
fieldError
.
getField
(),
fieldError
.
getRejectedValue
()));
}
}
}
}
return
Result
.
failed
(
"请求参数错误"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"request.params.error"
)
);
}
}
@ExceptionHandler
@ExceptionHandler
...
...
dlink-admin/src/main/java/com/dlink/service/impl/UserServiceImpl.java
View file @
df106ae6
...
@@ -36,6 +36,7 @@ import com.dlink.service.TenantService;
...
@@ -36,6 +36,7 @@ import com.dlink.service.TenantService;
import
com.dlink.service.UserRoleService
;
import
com.dlink.service.UserRoleService
;
import
com.dlink.service.UserService
;
import
com.dlink.service.UserService
;
import
com.dlink.service.UserTenantService
;
import
com.dlink.service.UserTenantService
;
import
com.dlink.utils.MessageResolverUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.HashSet
;
...
@@ -80,7 +81,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
...
@@ -80,7 +81,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
public
Result
registerUser
(
User
user
)
{
public
Result
registerUser
(
User
user
)
{
User
userByUsername
=
getUserByUsername
(
user
.
getUsername
());
User
userByUsername
=
getUserByUsername
(
user
.
getUsername
());
if
(
Asserts
.
isNotNull
(
userByUsername
))
{
if
(
Asserts
.
isNotNull
(
userByUsername
))
{
return
Result
.
failed
(
"该账号已存在"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"user.register.account.exists"
)
);
}
}
if
(
Asserts
.
isNullString
(
user
.
getPassword
()))
{
if
(
Asserts
.
isNullString
(
user
.
getPassword
()))
{
user
.
setPassword
(
DEFAULT_PASSWORD
);
user
.
setPassword
(
DEFAULT_PASSWORD
);
...
@@ -89,9 +90,9 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
...
@@ -89,9 +90,9 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
user
.
setEnabled
(
true
);
user
.
setEnabled
(
true
);
user
.
setIsDelete
(
false
);
user
.
setIsDelete
(
false
);
if
(
save
(
user
))
{
if
(
save
(
user
))
{
return
Result
.
succeed
(
"注册成功"
);
return
Result
.
succeed
(
MessageResolverUtils
.
getMessage
(
"user.register.success"
)
);
}
else
{
}
else
{
return
Result
.
failed
(
"该账号已存在"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"user.register.account.exists"
)
);
}
}
}
}
...
@@ -107,16 +108,16 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
...
@@ -107,16 +108,16 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
public
Result
modifyPassword
(
String
username
,
String
password
,
String
newPassword
)
{
public
Result
modifyPassword
(
String
username
,
String
password
,
String
newPassword
)
{
User
user
=
getUserByUsername
(
username
);
User
user
=
getUserByUsername
(
username
);
if
(
Asserts
.
isNull
(
user
))
{
if
(
Asserts
.
isNull
(
user
))
{
return
Result
.
failed
(
"The account does not exist"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"login.user.not.exists"
)
);
}
}
if
(!
Asserts
.
isEquals
(
SaSecureUtil
.
md5
(
password
),
user
.
getPassword
()))
{
if
(!
Asserts
.
isEquals
(
SaSecureUtil
.
md5
(
password
),
user
.
getPassword
()))
{
return
Result
.
failed
(
"The old password is incorrect"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"user.oldpassword.incorrect"
)
);
}
}
user
.
setPassword
(
SaSecureUtil
.
md5
(
newPassword
));
user
.
setPassword
(
SaSecureUtil
.
md5
(
newPassword
));
if
(
updateById
(
user
))
{
if
(
updateById
(
user
))
{
return
Result
.
succeed
(
"Password changed successfully"
);
return
Result
.
succeed
(
MessageResolverUtils
.
getMessage
(
"user.change.password.success"
)
);
}
}
return
Result
.
failed
(
"Failed to change password"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"user.change.password.failed"
)
);
}
}
@Override
@Override
...
@@ -131,18 +132,18 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
...
@@ -131,18 +132,18 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
public
Result
loginUser
(
LoginUTO
loginUTO
)
{
public
Result
loginUser
(
LoginUTO
loginUTO
)
{
User
user
=
getUserByUsername
(
loginUTO
.
getUsername
());
User
user
=
getUserByUsername
(
loginUTO
.
getUsername
());
if
(
Asserts
.
isNull
(
user
))
{
if
(
Asserts
.
isNull
(
user
))
{
return
Result
.
failed
(
"账号或密码错误"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"login.fail"
)
);
}
}
String
userPassword
=
user
.
getPassword
();
String
userPassword
=
user
.
getPassword
();
if
(
Asserts
.
isNullString
(
loginUTO
.
getPassword
()))
{
if
(
Asserts
.
isNullString
(
loginUTO
.
getPassword
()))
{
return
Result
.
failed
(
"密码不能为空"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"login.password.notnull"
)
);
}
}
if
(
Asserts
.
isEquals
(
SaSecureUtil
.
md5
(
loginUTO
.
getPassword
()),
userPassword
))
{
if
(
Asserts
.
isEquals
(
SaSecureUtil
.
md5
(
loginUTO
.
getPassword
()),
userPassword
))
{
if
(
user
.
getIsDelete
())
{
if
(
user
.
getIsDelete
())
{
return
Result
.
failed
(
"账号不存在"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"login.user.not.exists"
)
);
}
}
if
(!
user
.
getEnabled
())
{
if
(!
user
.
getEnabled
())
{
return
Result
.
failed
(
"账号已被禁用"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"login.user.disabled"
)
);
}
}
// 将前端入参 租户id 放入上下文
// 将前端入参 租户id 放入上下文
...
@@ -153,9 +154,9 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
...
@@ -153,9 +154,9 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
StpUtil
.
login
(
user
.
getId
(),
loginUTO
.
isAutoLogin
());
StpUtil
.
login
(
user
.
getId
(),
loginUTO
.
isAutoLogin
());
StpUtil
.
getSession
().
set
(
"user"
,
userDTO
);
StpUtil
.
getSession
().
set
(
"user"
,
userDTO
);
return
Result
.
succeed
(
userDTO
,
"登录成功"
);
return
Result
.
succeed
(
userDTO
,
MessageResolverUtils
.
getMessage
(
"login.success"
)
);
}
else
{
}
else
{
return
Result
.
failed
(
"账号或密码错误"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"login.fail"
)
);
}
}
}
}
...
@@ -178,7 +179,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
...
@@ -178,7 +179,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
userTenants
.
forEach
(
userTenant
->
{
userTenants
.
forEach
(
userTenant
->
{
Tenant
tenant
=
tenantService
.
getBaseMapper
()
Tenant
tenant
=
tenantService
.
getBaseMapper
()
.
selectOne
(
new
QueryWrapper
<
Tenant
>().
eq
(
"id"
,
userTenant
.
getTenantId
()));
.
selectOne
(
new
QueryWrapper
<
Tenant
>().
eq
(
"id"
,
userTenant
.
getTenantId
()));
if
(
Asserts
.
isNotNull
(
tenant
))
{
if
(
Asserts
.
isNotNull
(
tenant
))
{
tenantList
.
add
(
tenant
);
tenantList
.
add
(
tenant
);
}
}
...
@@ -241,7 +242,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
...
@@ -241,7 +242,7 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
Set
<
Integer
>
tenantIds
=
new
HashSet
<>();
Set
<
Integer
>
tenantIds
=
new
HashSet
<>();
userTenants
.
forEach
(
userTenant
->
tenantIds
.
add
(
userTenant
.
getTenantId
()));
userTenants
.
forEach
(
userTenant
->
tenantIds
.
add
(
userTenant
.
getTenantId
()));
List
<
Tenant
>
tenants
=
tenantService
.
getTenantByIds
(
tenantIds
);
List
<
Tenant
>
tenants
=
tenantService
.
getTenantByIds
(
tenantIds
);
return
Result
.
succeed
(
tenants
,
"获取成功"
);
return
Result
.
succeed
(
tenants
,
MessageResolverUtils
.
getMessage
(
"response.get.successfully"
)
);
}
}
}
}
dlink-admin/src/main/java/com/dlink/utils/MessageResolverUtils.java
0 → 100644
View file @
df106ae6
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com
.
dlink
.
utils
;
import
java.util.Arrays
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
cn.hutool.extra.spring.SpringUtil
;
/**
* desc: 获取i18n资源文件
*/
public
class
MessageResolverUtils
{
@Autowired
private
static
MessageSource
messageSource
=
SpringUtil
.
getBean
(
MessageSource
.
class
);
public
MessageResolverUtils
()
{
}
/**
* 根据 messageKey 获取国际化消息 委托给 spring messageSource
*
* @param code 消息key
* @return 解析后的国际化
*/
public
static
String
getMessage
(
Object
code
)
{
return
messageSource
.
getMessage
(
code
.
toString
(),
null
,
code
.
toString
(),
LocaleContextHolder
.
getLocale
());
}
/**
* 根据 messageKey 和参数 获取消息 委托给 spring messageSource
*
* @param code 消息key
* @param messageArgs 参数
* @return 解析后的国际化
*/
public
static
String
getMessages
(
Object
code
,
Object
...
messageArgs
)
{
Object
[]
objs
=
Arrays
.
stream
(
messageArgs
).
map
(
MessageResolverUtils:
:
getMessage
).
toArray
();
String
message
=
messageSource
.
getMessage
(
code
.
toString
(),
objs
,
code
.
toString
(),
LocaleContextHolder
.
getLocale
());
return
message
;
}
}
dlink-admin/src/main/resources/application.properties
View file @
df106ae6
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
########################## application级别通用配置 ##########################
########################## application级别通用配置 ##########################
##### druid配置
##### druid配置
#连接池配置(通常来说,只需要修改initialSize、minIdle、maxActive
#连接池配置(通常来说,只需要修改initialSize、minIdle、maxActive
...
@@ -49,4 +67,13 @@ mybatis-plus.global-config.db-config.logic-not-delete-value=0
...
@@ -49,4 +67,13 @@ mybatis-plus.global-config.db-config.logic-not-delete-value=0
mybatis-plus.configuration.map-underscore-to-camel-case
=
true
mybatis-plus.configuration.map-underscore-to-camel-case
=
true
mybatis-plus.configuration.cache-enabled
=
false
mybatis-plus.configuration.cache-enabled
=
false
logging.config
=
classpath:log4j2.xml
logging.config
=
classpath:log4j2.xml
\ No newline at end of file
####### 国际化配置
spring.messages.basename
=
i18n/messages
# 国际化编码
spring.messages.encoding
=
utf-8
# 表示 messages 文件的缓存失效时间,如果不配置则缓存一直有效。
spring.messages.cache-duration
=
3600
# 在找不到当前系统对应的资源文件时,如果该属性为 true,则会默认查找当前系统对应的资源文件,否则就返回 null,返回 null 之后,最终又会调用到系统默认的 messages.properties 文件
spring.messages.fallback-to-system-locale
=
true
\ No newline at end of file
dlink-admin/src/main/resources/i18n/messages.properties
0 → 100644
View file @
df106ae6
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
unknown.i18n
=
未知的国际化信息,请检查。。。
modify.successfully
=
修改成功
modify.failed
=
修改失败
delete.successfully
=
修改成功
delete.failed
=
修改失败
delete.partially.successfully
=
删除部分成功,但 {0} 删除失败,共 {1} 次失败。
response.get.successfully
=
获取成功
response.get.failed
=
获取失败
request.params.error
=
请求参数错误
error.param.empty
=
{0}不能为空
error.param.invalid
=
{0}无效
error.param.occupied
=
{0}已被占用
login.fail
=
登录失败,用户名或密码错误
login.not-login
=
用户未登录,请先登录
login.session.timeout
=
会话已过期,请重新登录。
login.success
=
登录成功
login.password.notnull
=
密码不能为空
login.user.not.exists
=
账号不存在
login.user.disabled
=
账号已被禁用
outlogin.success
=
退出成功
user.oldpassword.incorrect
=
旧密码不正确
user.change.password.success
=
密码修改成功
user.change.password.failed
=
密码修改失败
user.register.account.exists
=
该账户已存在
user.register.success
=
注册成功
message.welcome
=
欢迎使用 Dinky
message.task.running
=
任务已在运行
base.not.exists
=
{0} 不存在
message.provider.config.error
=
数据源配置解析异常
config.template.jdbc.dbType
=
数据库类型
config.template.jdbc.url
=
连接地址
config.template.jdbc.user
=
用户
config.template.jdbc.password
=
密码
config.template.jdbc.driverClass
=
驱动类
config.template.http.schemas
=
表
config.template.http.tableName
=
表名
dlink-admin/src/main/resources/i18n/messages_en_US.properties
0 → 100644
View file @
df106ae6
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
unknown.i18n
=
Unknown internationalization information, please check. . .
modify.successfully
=
Modified successfully
modify.failed
=
Modification failed
delete.successfully
=
Modified successfully
delete.failed
=
Modification failed
delete.partially.successfully
=
Delete partially succeeded, but failed to delete {0}, a total of {1} failures.
response.get.successfully
=
Get successfully
response.get.failed
=
Get failed
request.params.error
=
Request parameters error
error.param.empty
=
{0} cannot be empty
error.param.invalid
=
{0} is invalid
error.param.occupied
=
{0} is occupied
login.fail
=
Login failed, wrong username or password
login.not-login
=
User is not logged in, please login first
login.session.timeout
=
The session has expired, please log in again.
login.success
=
Login successful
login.password.notnull
=
Password cannot be null
login.user.not.exists
=
Account does not exist
login.user.disabled
=
Account is disabled
outlogin.success
=
Exit successfully
user.oldpassword.incorrect
=
The old password is incorrect
user.change.password.success
=
Password changed successfully
user.change.password.failed
=
Password change failed
user.register.account.exists
=
This account already exists
user.register.success
=
Registration succeeded
message.welcome
=
Welcome to Dinky
message.task.running
=
Task is already running
base.not.exists
=
{0} does not exist
message.provider.config.error
=
Data source configuration parsing exception
config.template.jdbc.dbType
=
Database Type
config.template.jdbc.url
=
Connection address
config.template.jdbc.user
=
User
config.template.jdbc.password
=
Password
config.template.jdbc.driverClass
=
Driver Class
config.template.http.schemas
=
Table
config.template.http.tableName
=
Table Name
\ No newline at end of file
dlink-admin/src/main/resources/i18n/messages_zh_CN.properties
0 → 100644
View file @
df106ae6
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
unknown.i18n
=
未知的国际化信息,请检查。。。
modify.successfully
=
修改成功
modify.failed
=
修改失败
delete.successfully
=
修改成功
delete.failed
=
修改失败
delete.partially.successfully
=
删除部分成功,但 {0} 删除失败,共 {1} 次失败。
response.get.successfully
=
获取成功
response.get.failed
=
获取失败
request.params.error
=
请求参数错误
error.param.empty
=
{0}不能为空
error.param.invalid
=
{0}无效
error.param.occupied
=
{0}已被占用
login.fail
=
登录失败,用户名或密码错误
login.not-login
=
用户未登录,请先登录
login.session.timeout
=
会话已过期,请重新登录。
login.success
=
登录成功
login.password.notnull
=
密码不能为空
login.user.not.exists
=
账号不存在
login.user.disabled
=
账号已被禁用
outlogin.success
=
退出成功
user.oldpassword.incorrect
=
旧密码不正确
user.change.password.success
=
密码修改成功
user.change.password.failed
=
密码修改失败
user.register.account.exists
=
该账户已存在
user.register.success
=
注册成功
message.welcome
=
欢迎使用 Dinky
message.task.running
=
任务已在运行
base.not.exists
=
{0} 不存在
message.provider.config.error
=
数据源配置解析异常
config.template.jdbc.dbType
=
数据库类型
config.template.jdbc.url
=
连接地址
config.template.jdbc.user
=
用户
config.template.jdbc.password
=
密码
config.template.jdbc.driverClass
=
驱动类
config.template.http.schemas
=
表
config.template.http.tableName
=
表名
\ No newline at end of file
dlink-web/src/pages/user/Login/index.tsx
View file @
df106ae6
...
@@ -25,11 +25,12 @@ import {history, Link, SelectLang, useModel} from 'umi';
...
@@ -25,11 +25,12 @@ import {history, Link, SelectLang, useModel} from 'umi';
import
Footer
from
'@/components/Footer'
;
import
Footer
from
'@/components/Footer'
;
import
{
login
}
from
'@/services/ant-design-pro/api'
;
import
{
login
}
from
'@/services/ant-design-pro/api'
;
import
{
CheckCard
}
from
'@ant-design/pro-components'
;
import
{
CheckCard
}
from
'@ant-design/pro-components'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
getData
}
from
"@/components/Common/crud"
;
import
{
getData
}
from
"@/components/Common/crud"
;
import
{
TenantTableListItem
}
from
"@/pages/AuthenticationCenter/data.d"
;
import
{
TenantTableListItem
}
from
"@/pages/AuthenticationCenter/data.d"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
l
}
from
"@/utils/intl"
;
import
cookies
from
"js-cookie"
;
import
{
setLocale
}
from
"@@/plugin-locale/localeExports"
;
/** 此方法会跳转到 redirect 参数所在的位置 */
/** 此方法会跳转到 redirect 参数所在的位置 */
...
@@ -163,10 +164,13 @@ const Login: React.FC = () => {
...
@@ -163,10 +164,13 @@ const Login: React.FC = () => {
</>
</>
}
}
return
(
return
(
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
lang
}
>
{
SelectLang
&&
<
SelectLang
/>
}
</
div
>
<
div
className=
{
styles
.
lang
}
>
{
SelectLang
&&
<
SelectLang
onItemClick=
{
(
e
)
=>
{
let
language
=
e
.
key
.
toString
()
cookies
.
set
(
'language'
,
language
,
{
path
:
'/'
})
setLocale
(
language
)
}
}
/>
}
</
div
>
<
div
className=
{
styles
.
content
}
>
<
div
className=
{
styles
.
content
}
>
<
div
className=
{
styles
.
top
}
>
<
div
className=
{
styles
.
top
}
>
<
div
className=
{
styles
.
header
}
>
<
div
className=
{
styles
.
header
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment