Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
1024程序员开源挑战赛
提交
107b94df
1
1024程序员开源挑战赛
项目概览
夜猫逐梦
/
1024程序员开源挑战赛
与 Fork 源项目一致
Fork自
GitCode / 1024程序员开源挑战赛(10.23-11.14)
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
1024程序员开源挑战赛
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
107b94df
编写于
11月 06, 2021
作者:
B
baiy
提交者:
ninecents
10月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
i18n fix
上级
d085df1f
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
40 addition
and
36 deletion
+40
-36
src/i18n/build.js
src/i18n/build.js
+6
-2
src/i18n/index.js
src/i18n/index.js
+4
-4
src/i18n/locales/en/main.i18n.json5
src/i18n/locales/en/main.i18n.json5
+0
-0
src/tool.vue
src/tool.vue
+15
-15
src/tool/adapter.js
src/tool/adapter.js
+1
-1
src/views/setting/block.vue
src/views/setting/block.vue
+12
-12
src/views/setting/common.vue
src/views/setting/common.vue
+1
-1
src/views/setting/setting.vue
src/views/setting/setting.vue
+1
-1
未找到文件。
src/i18n/build.js
浏览文件 @
107b94df
...
...
@@ -10,7 +10,10 @@ const LOCAL_LISTS = [
{
code
:
'
zh_CN
'
,
name
:
"
简体中文
"
}
]
// 默认地区
const
DEFAULT_LOCALE
=
'
zh_CN
'
// 为空展示地区
const
DEFAULT_SHOW_LOCALE
=
'
en
'
const
codeToLocale
=
(
code
)
=>
{
return
code
===
"
_default
"
?
DEFAULT_LOCALE
:
code
;
...
...
@@ -59,6 +62,7 @@ const getAllLocale = () => {
let
locales
=
{
lists
:
LOCAL_LISTS
,
default_locale
:
DEFAULT_LOCALE
,
default_show_locale
:
DEFAULT_SHOW_LOCALE
,
detail
:
{}
}
fs
.
readdirSync
(
path
.
resolve
(
path
.
join
(
__dirname
,
"
locales
"
))).
forEach
((
code
)
=>
{
...
...
@@ -107,9 +111,9 @@ module.exports = {
let
text
=
key
;
if
((
locale
in
locales
)
&&
(
key
in
locales
[
locale
]))
{
text
=
locales
[
locale
][
key
][
'
message
'
]
}
else
if
(
locale
!==
DEFAULT_LOCALE
)
{
}
else
if
(
locale
!==
DEFAULT_
SHOW_
LOCALE
)
{
// 获取默认语言
text
=
this
.
getMessage
(
DEFAULT_LOCALE
,
key
)
text
=
this
.
getMessage
(
DEFAULT_
SHOW_
LOCALE
,
key
)
}
return
text
;
},
...
...
src/i18n/index.js
浏览文件 @
107b94df
...
...
@@ -11,6 +11,7 @@ const locales = require('./locales/build.json')
export
const
LOCALE_LISTS
=
locales
.
lists
export
const
LOCALE_DETAIL
=
locales
.
detail
export
const
DEFAULT_LOCALE
=
locales
.
default_locale
export
const
DEFAULT_SHOW_LOCALE
=
locales
.
default_show_locale
let
currentLocale
=
""
;
...
...
@@ -24,10 +25,9 @@ const getMessage = (code, key) => {
let
text
=
key
;
if
((
locale
in
LOCALE_DETAIL
)
&&
(
key
in
LOCALE_DETAIL
[
locale
]))
{
text
=
LOCALE_DETAIL
[
locale
][
key
][
'
message
'
]
}
else
if
(
locale
!==
DEFAULT_LOCALE
){
}
else
if
(
locale
!==
DEFAULT_SHOW_LOCALE
)
{
// 获取默认语言
text
=
getMessage
(
DEFAULT_
LOCALE
,
key
)
text
=
getMessage
(
DEFAULT_
SHOW_LOCALE
,
key
)
}
return
text
;
}
...
...
@@ -48,7 +48,7 @@ const translate = (code, key, values = {}) => {
return
chromiumGetMessage
(
key
,
values
,
placeholders
)
}
let
text
=
getMessage
(
code
,
key
);
let
text
=
getMessage
(
code
,
key
);
const
matchRge
=
new
RegExp
(
'
{.+?}
'
,
'
g
'
)
const
matchString
=
text
.
match
(
matchRge
);
...
...
src/i18n/locales/en/m
ia
n.i18n.json5
→
src/i18n/locales/en/m
ai
n.i18n.json5
浏览文件 @
107b94df
文件已移动
src/tool.vue
浏览文件 @
107b94df
...
...
@@ -2,12 +2,12 @@
<div>
<Menu
mode=
"horizontal"
theme=
"light"
:active-name=
"currentCategory"
@
on-select=
"categorySelect"
style=
"height: 45px;line-height: 45px;"
>
<MenuItem
:style=
"$t('m
ia
n_css_main_category_item_style')"
:name=
"cat.name"
v-for=
"(cat) in category"
:key=
"cat.name"
>
<MenuItem
:style=
"$t('m
ai
n_css_main_category_item_style')"
:name=
"cat.name"
v-for=
"(cat) in category"
:key=
"cat.name"
>
<Badge
v-if=
"badgeCategoryIsShow(cat.name)"
dot
:offset=
"[15,-10]"
>
{{
$t
(
'
m
ia
n_category_
'
+
cat
.
name
)
}}
{{
$t
(
'
m
ai
n_category_
'
+
cat
.
name
)
}}
</Badge>
<template
v-else
>
{{
$t
(
'
m
ia
n_category_
'
+
cat
.
name
)
}}
{{
$t
(
'
m
ai
n_category_
'
+
cat
.
name
)
}}
</
template
>
</MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_new"
v-if=
"!isUtools"
>
...
...
@@ -34,31 +34,31 @@
<RadioGroup
:value=
"currentTool"
@
on-change=
"toolSelect"
style=
"margin: 10px 0 10px 20px;line-height: 30px;"
>
<Radio
:label=
"tool.name"
v-for=
"(tool) in tools"
:key=
"tool.name"
>
<Badge
v-if=
"badgeToolIsShow(tool.name)"
dot
:offset=
"[5,-5]"
>
{{ $t('m
ia
n_tool_'+tool.name) }}
{{ $t('m
ai
n_tool_'+tool.name) }}
</Badge>
<
template
v-else
>
{{
$t
(
'
m
ia
n_tool_
'
+
tool
.
name
)
}}
{{
$t
(
'
m
ai
n_tool_
'
+
tool
.
name
)
}}
</
template
>
</Radio>
</RadioGroup>
<div>
<router-view
v-if=
"isRouterAlive"
:key=
"$route.path + $route.query.t"
/>
</div>
<Drawer
:title=
"$t('m
ian_tool_'+currentTool)+' - '+$t('mia
n_history')"
v-model=
"historyShow"
:width=
"100"
>
<Drawer
:title=
"$t('m
ain_tool_'+currentTool)+' - '+$t('mai
n_history')"
v-model=
"historyShow"
:width=
"100"
>
<Table
ref=
"historyTable"
border
:columns=
"historyColumns"
:data=
"historyData"
:height=
"historyTableHeight"
>
<
template
slot-scope=
"{ row }"
slot=
"_value"
>
<div>
{{
historyValue
(
row
.
value
)
}}
}
</div>
</
template
>
<
template
slot-scope=
"{ index }"
slot=
"_op"
>
<Button
type=
"primary"
size=
"small"
@
click=
"historyView(index)"
>
{{
$t
(
'
m
ia
n_ui_views
'
)
}}
</Button>
<Button
type=
"primary"
style=
"margin-left: 5px"
@
click=
"historyLoad(index)"
size=
"small"
>
{{
$t
(
'
m
ia
n_ui_load
'
)
}}
</Button>
<Button
type=
"primary"
size=
"small"
@
click=
"historyView(index)"
>
{{
$t
(
'
m
ai
n_ui_views
'
)
}}
</Button>
<Button
type=
"primary"
style=
"margin-left: 5px"
@
click=
"historyLoad(index)"
size=
"small"
>
{{
$t
(
'
m
ai
n_ui_load
'
)
}}
</Button>
</
template
>
</Table>
<div
class=
"drawer-footer"
>
<Button
type=
"primary"
@
click=
"historyClear"
>
{{ $t('m
ia
n_history_clear') }}
</Button>
<Button
type=
"primary"
@
click=
"historyClear"
>
{{ $t('m
ai
n_history_clear') }}
</Button>
</div>
</Drawer>
<Drawer
:title=
"$t('m
ia
n_ui_setting')"
v-model=
"settingShow"
:width=
"400"
>
<Drawer
:title=
"$t('m
ai
n_ui_setting')"
v-model=
"settingShow"
:width=
"400"
>
<setting-block
v-if=
"settingShow"
></setting-block>
</Drawer>
<bottom-block/>
...
...
@@ -91,17 +91,17 @@ export default {
historyShow
:
false
,
historyColumns
:
[
{
title
:
this
.
$t
(
'
m
ia
n_history_time
'
),
title
:
this
.
$t
(
'
m
ai
n_history_time
'
),
key
:
'
time
'
,
width
:
180
},
{
title
:
this
.
$t
(
'
m
ia
n_history_data
'
),
title
:
this
.
$t
(
'
m
ai
n_history_data
'
),
slot
:
'
_value
'
,
ellipsis
:
true
,
},
{
title
:
this
.
$t
(
'
m
ia
n_history_op
'
),
title
:
this
.
$t
(
'
m
ai
n_history_op
'
),
slot
:
'
_op
'
,
width
:
150
}
...
...
@@ -204,7 +204,7 @@ export default {
history
()
{
let
history
=
historyFactory
(
this
.
currentTool
)
if
(
history
.
length
()
<
1
)
{
return
this
.
$Message
.
error
(
this
.
$t
(
'
m
ia
n_history_null
'
))
return
this
.
$Message
.
error
(
this
.
$t
(
'
m
ai
n_history_null
'
))
}
this
.
historyData
=
history
.
all
()
this
.
historyShow
=
true
...
...
@@ -224,7 +224,7 @@ export default {
})
},
width
:
700
,
okText
:
this
.
$t
(
'
m
ia
n_ui_close
'
)
okText
:
this
.
$t
(
'
m
ai
n_ui_close
'
)
})
},
historyClear
()
{
...
...
src/tool/adapter.js
浏览文件 @
107b94df
...
...
@@ -153,7 +153,7 @@ const utoolsConfigWrite = {
for
(
let
tool
of
tools
)
{
// 初始化数据
let
code
=
"
ctool-
"
+
tool
.
name
;
let
toolTitle
=
i18nBuild
.
translate
(
`m
ia
n_tool_
${
tool
.
name
}
`
)
let
toolTitle
=
i18nBuild
.
translate
(
`m
ai
n_tool_
${
tool
.
name
}
`
)
let
toolFeatures
=
featureConfig
.
hasOwnProperty
(
tool
.
name
)
?
featureConfig
[
tool
.
name
]
:
[]
if
(
!
utoolsToolFeature
.
hasOwnProperty
(
code
))
{
utoolsToolFeature
[
code
]
=
{
...
...
src/views/setting/block.vue
浏览文件 @
107b94df
...
...
@@ -2,32 +2,32 @@
<div>
<div>
<CellGroup
@
on-click=
"open"
>
<Cell
:title=
"$t('m
ia
n_common_tool')"
name=
"setting"
/>
<Cell
v-if=
"is_chromium || is_firefox"
:title=
"$t('m
ia
n_keyboard_setting')"
name=
"shortcuts"
/>
<Cell
:title=
"$t('m
ia
n_display_mode')"
>
<Cell
:title=
"$t('m
ai
n_common_tool')"
name=
"setting"
/>
<Cell
v-if=
"is_chromium || is_firefox"
:title=
"$t('m
ai
n_keyboard_setting')"
name=
"shortcuts"
/>
<Cell
:title=
"$t('m
ai
n_display_mode')"
>
<Select
v-model=
"display_mode"
slot=
"extra"
transfer
>
<Option
v-for=
"item in display_mode_list"
:value=
"item"
:key=
"item"
>
{{
$t
(
'
m
ia
n_display_mode_
'
+
item
)
}}
</Option>
<Option
v-for=
"item in display_mode_list"
:value=
"item"
:key=
"item"
>
{{
$t
(
'
m
ai
n_display_mode_
'
+
item
)
}}
</Option>
</Select>
</Cell>
<Cell
:title=
"$t('m
ia
n_setting_language')"
>
<Cell
:title=
"$t('m
ai
n_setting_language')"
>
<Select
v-model=
"locale"
slot=
"extra"
transfer
>
<Option
v-for=
"item in locales"
:value=
"item.code"
:key=
"item.code"
>
{{
item
.
name
}}
</Option>
</Select>
</Cell>
</CellGroup>
<CellGroup>
<Cell
:title=
"$t('m
ia
n_copy_results_to_clipboard')"
>
<Cell
:title=
"$t('m
ai
n_copy_results_to_clipboard')"
>
<i-switch
v-model=
"auto_save_copy"
slot=
"extra"
/>
</Cell>
<Cell
:title=
"$t('m
ia
n_read_content_from_clipboard')"
>
<Cell
:title=
"$t('m
ai
n_read_content_from_clipboard')"
>
<i-switch
v-model=
"auto_read_copy"
slot=
"extra"
/>
</Cell>
<Cell
:title=
"$t('m
ia
n_read_clipboard_content_trim')"
>
<Cell
:title=
"$t('m
ai
n_read_clipboard_content_trim')"
>
<i-switch
v-model=
"auto_read_copy_filter"
slot=
"extra"
/>
</Cell>
</CellGroup>
</div>
<Drawer
:title=
"$t('m
ia
n_ui_setting')"
placement=
"left"
v-model=
"settingShow"
:width=
"90"
>
<Drawer
:title=
"$t('m
ai
n_ui_setting')"
placement=
"left"
v-model=
"settingShow"
:width=
"90"
>
<setting-block
v-if=
"settingShow"
></setting-block>
</Drawer>
</div>
...
...
@@ -86,16 +86,16 @@ export default {
case
'
shortcuts
'
:
if
(
this
.
is_firefox
)
{
return
this
.
$Notice
.
success
({
title
:
this
.
$t
(
'
m
ia
n_keyboard_firefox_1
'
),
title
:
this
.
$t
(
'
m
ai
n_keyboard_firefox_1
'
),
render
:
h
=>
{
return
h
(
'
span
'
,
[
this
.
$t
(
'
m
ia
n_keyboard_firefox_2
'
),
this
.
$t
(
'
m
ai
n_keyboard_firefox_2
'
),
h
(
'
a
'
,
{
attrs
:
{
href
:
'
https://jingyan.baidu.com/article/3ea51489f1d0a713e61bbaff.html
'
,
target
:
'
_blank
'
}
},
this
.
$t
(
'
m
ia
n_keyboard_firefox_3
'
)),
},
this
.
$t
(
'
m
ai
n_keyboard_firefox_3
'
)),
])
}
});
...
...
src/views/setting/common.vue
浏览文件 @
107b94df
<
template
>
<div>
<CheckboxGroup
v-model=
"tools"
@
on-change=
"toolUpdate"
style=
"line-height: 30px;"
>
<Checkbox
v-for=
"(t,k) in all"
:key=
"k"
:label=
"t.name"
>
{{
$t
(
'
m
ia
n_tool_
'
+
t
.
name
)
}}
</Checkbox>
<Checkbox
v-for=
"(t,k) in all"
:key=
"k"
:label=
"t.name"
>
{{
$t
(
'
m
ai
n_tool_
'
+
t
.
name
)
}}
</Checkbox>
</CheckboxGroup>
</div>
</
template
>
...
...
src/views/setting/setting.vue
浏览文件 @
107b94df
<
template
>
<Card>
<Tabs
value=
"common"
>
<TabPane
:label=
"$t('m
ia
n_common_tool_setting')"
name=
"common"
>
<TabPane
:label=
"$t('m
ai
n_common_tool_setting')"
name=
"common"
>
<setting-common></setting-common>
</TabPane>
</Tabs>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录