Skip to content

Commit

Permalink
Add i18n support for option sections and short cut reminder
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Aug 16, 2024
1 parent ddd8f13 commit e703360
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 11 deletions.
24 changes: 24 additions & 0 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"409": {
"message": "已经提交过了"
},
"close": {
"message": "关闭"
},
"channelWhitelisted": {
"message": "UP主已加入白名单!"
},
Expand Down Expand Up @@ -450,6 +453,18 @@
"whatManualSkipOnFullVideo": {
"message": "如果你想看软广视频时不跳过中间的内容,而是观看完整视频,可以启用软广手动跳过"
},
"optionSectionSkipNotice": {
"message": "跳过提醒弹窗"
},
"optionSectionPlayerAndButtons": {
"message": "播放器和按钮区"
},
"optionSectionPortVideo": {
"message": "搬运视频绑定"
},
"optionSectionExtensionRelated": {
"message": "插件相关选项"
},
"skipNoticeDuration": {
"message": "“空降提醒弹窗”显示持续时间(秒):"
},
Expand Down Expand Up @@ -862,6 +877,15 @@
"message": "阅读指南!!",
"description": "Show the first time they submit or if they are \"high risk\""
},
"skipFrameShortcutPopupLine1": {
"message": "无法精准定位?可以尝试使用 “,” 和 “.” 按键跳到上一帧或者下一帧!试试吧~"
},
"skipFrameShortcutPopupLine2": {
"message": "(快捷键只有在打开弹窗时可用,按键绑定可以在{0}中修改)"
},
"optionsPage": {
"message": "选项页面"
},
"categoryUpdate1": {
"message": "类别在这里!"
},
Expand Down
24 changes: 24 additions & 0 deletions public/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"409": {
"message": "已经提交过了"
},
"close": {
"message": "关闭"
},
"channelWhitelisted": {
"message": "UP主已加入白名单!"
},
Expand Down Expand Up @@ -450,6 +453,18 @@
"whatManualSkipOnFullVideo": {
"message": "如果你想看软广视频时不跳过中间的内容,而是观看完整视频,可以启用软广手动跳过"
},
"optionSectionSkipNotice": {
"message": "跳过提醒弹窗"
},
"optionSectionPlayerAndButtons": {
"message": "播放器和按钮区"
},
"optionSectionPortVideo": {
"message": "搬运视频绑定"
},
"optionSectionExtensionRelated": {
"message": "插件相关选项"
},
"skipNoticeDuration": {
"message": "“空降提醒弹窗”显示持续时间(秒):"
},
Expand Down Expand Up @@ -862,6 +877,15 @@
"message": "阅读指南!!",
"description": "Show the first time they submit or if they are \"high risk\""
},
"skipFrameShortcutPopupLine1": {
"message": "无法精准定位?可以尝试使用 “,” 和 “.” 按键跳到上一帧或者下一帧!试试吧~"
},
"skipFrameShortcutPopupLine2": {
"message": "(快捷键只有在打开弹窗时可用,按键绑定可以在{0}中修改)"
},
"optionsPage": {
"message": "选项页面"
},
"categoryUpdate1": {
"message": "类别在这里!"
},
Expand Down
26 changes: 25 additions & 1 deletion public/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"409": {
"message": "已經提交過了"
},
"close": {
"message": "關閉"
},
"channelWhitelisted": {
"message": "頻道已加入白名單!"
},
Expand Down Expand Up @@ -450,6 +453,18 @@
"whatManualSkipOnFullVideo": {
"message": "如果您想看推廣影片時不跳過中間的內容,而是觀看完整影片,可以啟用推廣手動跳過"
},
"optionSectionSkipNotice": {
"message": "跳過提醒彈窗"
},
"optionSectionPlayerAndButtons": {
"message": "播放器和按鈕"
},
"optionSectionPortVideo": {
"message": "搬運影片綁定"
},
"optionSectionExtensionRelated": {
"message": "插件相關選項"
},
"skipNoticeDuration": {
"message": "跳過提醒彈窗持續時間(秒):"
},
Expand Down Expand Up @@ -862,6 +877,15 @@
"message": "閱讀指南!!",
"description": "Show the first time they submit or if they are \"high risk\""
},
"skipFrameShortcutPopupLine1": {
"message": "無法精準定位?可以嘗試使用 “,” 和 “.” 按鍵跳到上一幀或下一幀!試試吧~"
},
"skipFrameShortcutPopupLine2": {
"message": "(快捷鍵只有在打開提交彈窗時可用,案件綁定可以在{0}中修改)"
},
"optionsPage": {
"message": "選項頁面"
},
"categoryUpdate1": {
"message": "類別在這裡!"
},
Expand Down Expand Up @@ -1155,4 +1179,4 @@
"bindPortVideoButton": {
"message": "綁定搬運影片"
}
}
}
8 changes: 4 additions & 4 deletions public/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<div id="interface" class="option-group hidden">

<div class="section">
<h3>跳过提醒弹窗</h3>
<h3>__MSG_optionSectionSkipNotice__</h3>

<div data-type="number-change" data-sync="skipNoticeDuration">
<label class="number-container">
Expand Down Expand Up @@ -247,7 +247,7 @@ <h3>跳过提醒弹窗</h3>
</div>

<div class="section">
<h3>播放器和按钮区</h3>
<h3>__MSG_optionSectionPlayerAndButtons__</h3>

<div data-type="toggle" data-toggle-type="reverse" data-sync="hideVideoPlayerControls">
<div class="switch-container">
Expand Down Expand Up @@ -356,7 +356,7 @@ <h3>播放器和按钮区</h3>
</div>

<div class="section">
<h3>搬运视频绑定</h3>
<h3>__MSG_optionSectionPortVideo__</h3>

<div data-type="toggle" data-sync="allowScrollingToEdit">
<div class="switch-container">
Expand Down Expand Up @@ -399,7 +399,7 @@ <h3>搬运视频绑定</h3>
</div>

<div class="section">
<h3>插件选项和弹出页面</h3>
<h3>__MSG_optionSectionExtensionRelated__</h3>

<div data-type="toggle" data-sync="darkMode">
<div class="switch-container">
Expand Down
12 changes: 6 additions & 6 deletions src/components/SubmissionNoticeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,18 +351,18 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
popoverContent = () => {
return (
<>
<p>无法精准定位?可以尝试使用 “,” 和 “.” 按键跳到上一帧或者下一帧!试试吧~</p>
<p>{chrome.i18n.getMessage("skipFrameShortcutPopupLine1")}</p>
<p>
(快捷键只有在打开弹窗时可用,按键绑定可以在
{chrome.i18n.getMessage("skipFrameShortcutPopupLine2").split("{0}")[0]}
<a
style={{ color: "var(--sb-brand-blue)" }}
onClick={() => {
chrome.runtime.sendMessage({ message: "openConfig", hash: "keybinds" });
}}
>
选项页面
{chrome.i18n.getMessage("optionsPage")}
</a>
中修改)
{chrome.i18n.getMessage("skipFrameShortcutPopupLine2").split("{0}")[1]}
</p>
<p style={{ padding: "0 20px", textAlign: "center" }}>
<a
Expand All @@ -371,15 +371,15 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
this.setState({ popoverOpen: false });
}}
>
关闭
{chrome.i18n.getMessage("close")}
</a>
<a
onClick={() => {
Config.config.showShortcutPopover = false;
this.setState({ popoverOpen: false });
}}
>
不再提示
{chrome.i18n.getMessage("Hide")}
</a>
</p>
</>
Expand Down

0 comments on commit e703360

Please sign in to comment.