Skip to content

Commit

Permalink
i18n准备中
Browse files Browse the repository at this point in the history
  • Loading branch information
SSShooter committed Sep 8, 2020
1 parent 559d43e commit c0b0ee9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
10 changes: 10 additions & 0 deletions syncHime/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"websocketConnectStart": {
"message": "websocket connect start",
"description": "The string we search for. Put %20 between words that go together."
},
"save": {
"message": "save",
"description": "The string we search for. Put %20 between words that go together."
}
}
10 changes: 10 additions & 0 deletions syncHime/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"websocketConnectStart": {
"message": "websocket 开始连接",
"description": "The string we search for. Put %20 between words that go together."
},
"save": {
"message": "保存",
"description": "The string we search for. Put %20 between words that go together."
}
}
6 changes: 3 additions & 3 deletions syncHime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ document.addEventListener("DOMContentLoaded", async function () {
}

const socket = io("wss://" + websocketUrl + "/");
pushMessage("websocket 开始连接", "sys");
pushMessage(chrome.i18n.getMessage("websocketConnectStart"), "sys");
socket.on("connect", () => {
pushMessage("websocket 连接成功", "sys");
document.querySelector("#socket-id").value = socket.id;
Expand Down Expand Up @@ -264,11 +264,11 @@ document.addEventListener("DOMContentLoaded", async function () {
}
}

function transformTime(time){
function transformTime(time) {
let min = Math.floor(time / 60);
let sec = Math.floor(time % 60);
if (sec < 10) sec = "0" + sec;
return min + ":" + sec
return min + ":" + sec;
}

function setState(state, type) {
Expand Down
5 changes: 3 additions & 2 deletions syncHime/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "syncHime",
"description": "一个 bilibili 视频时间同步插件,附带聊天功能",
"version": "1.1",
"version": "1.2",
"homepage_url": "https://github.com/ssshooter/syncHime",
"background": {
"scripts": [
Expand Down Expand Up @@ -43,5 +43,6 @@
"web_accessible_resources": [
"icon/*.svg"
],
"manifest_version": 2
"manifest_version": 2,
"default_locale": "zh_CN"
}
2 changes: 1 addition & 1 deletion syncHime/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="center">
<span class="item-name">websocket-url</span><input id="websocket-url" type="text">
<span class="item-name">connection-type</span><input id="connection-type" type="text">
<button id="save">保存</button>
<button id="save">__save__</button>
</div>
<p>注意事项</p>
<p>1. 保存后请刷新页面</p>
Expand Down
2 changes: 1 addition & 1 deletion syncHime/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ save.onclick = (e) => {
console.log("set");
save.innerText = "已保存";
setTimeout(() => {
save.innerText = "保存";
save.innerText = chrome.i18n.getMessage("save");
}, 1000);
}
);
Expand Down

0 comments on commit c0b0ee9

Please sign in to comment.