Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
483d75e0
Commit
483d75e0
authored
Jul 20, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
视频压缩
parent
28f668d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
14 deletions
+13
-14
YzgLanguage.java
...rc/main/java/com/yanzuoguang/util/helper/YzgLanguage.java
+3
-3
CheckHelperTest.java
yzg-util-base/src/test/java/helper/CheckHelperTest.java
+10
-11
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/YzgLanguage.java
View file @
483d75e0
...
@@ -23,7 +23,7 @@ public class YzgLanguage {
...
@@ -23,7 +23,7 @@ public class YzgLanguage {
/**
/**
* 默认场景
* 默认场景
*/
*/
public
static
final
String
SCENE_
DEFAULT
=
"DEFAULT
"
;
public
static
final
String
SCENE_
Global
=
"GLOBAL
"
;
/**
/**
* 英语
* 英语
...
@@ -128,7 +128,7 @@ public class YzgLanguage {
...
@@ -128,7 +128,7 @@ public class YzgLanguage {
* @return
* @return
*/
*/
public
String
getScene
()
{
public
String
getScene
()
{
return
StringHelper
.
getFirst
(
this
.
threadScene
.
get
(),
SCENE_
DEFAULT
);
return
StringHelper
.
getFirst
(
this
.
threadScene
.
get
(),
SCENE_
Global
);
}
}
...
@@ -218,7 +218,7 @@ public class YzgLanguage {
...
@@ -218,7 +218,7 @@ public class YzgLanguage {
return
ret
;
return
ret
;
}
}
// 获取语言对应关系
// 获取语言对应关系
Map
<
String
,
String
>
globalFrom
=
getDefaultFrom
(
SCENE_
DEFAULT
,
defaultLanguageValue
);
Map
<
String
,
String
>
globalFrom
=
getDefaultFrom
(
SCENE_
Global
,
defaultLanguageValue
);
// 获取对应语言
// 获取对应语言
ret
=
globalFrom
.
get
(
language
);
ret
=
globalFrom
.
get
(
language
);
if
(!
StringHelper
.
isEmpty
(
ret
))
{
if
(!
StringHelper
.
isEmpty
(
ret
))
{
...
...
yzg-util-base/src/test/java/helper/CheckHelperTest.java
View file @
483d75e0
...
@@ -5,8 +5,14 @@ import com.yanzuoguang.util.helper.YzgLanguage;
...
@@ -5,8 +5,14 @@ import com.yanzuoguang.util.helper.YzgLanguage;
import
org.junit.Test
;
import
org.junit.Test
;
public
class
CheckHelperTest
{
public
class
CheckHelperTest
{
// 设置默认语言为中文
static
YzgLanguage
language
=
YzgLanguage
.
get
();
static
String
scene_user
=
"用户检测"
;
static
{
static
{
language
.
setEnglishChinese
(
"name"
,
"名称"
);
language
.
setEnglishChinese
(
scene_user
,
"name"
,
"姓名"
);
CheckerHelper
.
newInstance
();
CheckerHelper
.
newInstance
();
}
}
...
@@ -20,30 +26,23 @@ public class CheckHelperTest {
...
@@ -20,30 +26,23 @@ public class CheckHelperTest {
@Test
@Test
public
void
testCh
()
{
public
void
testCh
()
{
// 设置默认语言为中文
// 设置默认语言为中文
YzgLanguage
language
=
YzgLanguage
.
get
();
language
.
setDefaulLanguage
(
YzgLanguage
.
LANGUAGE_CH
);
language
.
setDefaulLanguage
(
YzgLanguage
.
LANGUAGE_CH
);
language
.
setEnglishChinese
(
"name"
,
"名称"
);
testEn
();
testEn
();
// 设置默认语言为英文
// 设置默认语言为英文
language
.
setDefaulLanguage
(
YzgLanguage
.
LANGUAGE_EN
);
language
.
setDefaulLanguage
(
YzgLanguage
.
LANGUAGE_EN
);
}
}
@Test
@Test
public
void
testChScene
()
{
public
void
testChScene
()
{
// 设置默认语言为中文
// 设置当前线程语言为中文
YzgLanguage
language
=
YzgLanguage
.
get
();
language
.
setThreadLanguage
(
YzgLanguage
.
LANGUAGE_CH
);
language
.
setDefaulLanguage
(
YzgLanguage
.
LANGUAGE_CH
);
language
.
setThreadScene
(
scene_user
);
language
.
setEnglishChinese
(
"name"
,
"名称"
);
String
scene1
=
"用户检测"
;
language
.
setEnglishChinese
(
scene1
,
"name"
,
"姓名"
);
language
.
setThreadScene
(
scene1
);
testEn
();
testEn
();
// 设置默认语言为英文
// 设置默认语言为英文
language
.
setDefaulLanguage
(
YzgLanguage
.
LANGUAGE_EN
);
language
.
setDefaulLanguage
(
YzgLanguage
.
LANGUAGE_EN
);
language
.
removeThreadScene
();
}
}
...
...
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