Skip to content

Commit

Permalink
✨ 使用crowdin管理翻译
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Oct 12, 2023
1 parent 3eb84b5 commit c62a559
Show file tree
Hide file tree
Showing 14 changed files with 733 additions and 829 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ coverage
CHANGELOG.md

tailwind.config.js

.env
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ npm run pack
在打包前,请确保在`dist`目录下生成了`scriptcat.pem`文件。

# 注意问题
* 我使用的是yarn install的时候会出问题,不确定是yarn install还是网络问题,所以最好用npm i
* 因为down这个仓库的目的是贡献代码,npm run dev以后还需要执行一下npm run build然后把dist ext里面内容在浏览器扩展里面导入加载,然后开始改代码保存即可,浏览器是实时更新的
* 使用`yarn install`时可能会出现错误,最好使用`npm i`
* `npm run dev`之后需要把`dist/ext`目录里面内容在浏览器扩展里面导入加载,然后开始改代码保存即可,浏览器是实时更新的
8 changes: 8 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
project_id: '620320'
api_token_env: CROWDIN_PERSONAL_TOKEN
preserve_hierarchy: true

files:
# JSON 翻译文件
- source: /src/locales/zh-CN/**/*
translation: /src/locales/%locale%/**/%original_file_name%
40 changes: 1 addition & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"build:no-split": "webpack --mode production --config ./webpack/webpack.no.split.ts",
"dev:linter": "webpack --mode development --config ./webpack/webpack.linter.dev.ts",
"pack": "node ./build/pack.js",
"changlog": "gitmoji-changelog"
"changlog": "gitmoji-changelog",
"crowdin": "crowdin"
},
"dependencies": {
"@arco-design/web-react": "^2.47.0",
Expand Down Expand Up @@ -100,7 +101,6 @@
"webpack": "^5.88.2",
"webpack-bundle-analyzer": "^4.9.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.9.0",
"yaml-loader": "^0.8.0"
"webpack-merge": "^5.9.0"
}
}
14 changes: 7 additions & 7 deletions pkg/cloudscript/cloudscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type ExportCookies = {
[key: string]: any;
domain?: string;
url?: string;
cookie: chrome.cookies.Cookie[];
cookies?: chrome.cookies.Cookie[];
};

export type ExportParams = {
Expand Down Expand Up @@ -44,9 +44,7 @@ export function parseExportCookie(
const result = [];
for (let i = 0; i < lines.length; i += 1) {
const line = lines[i];
const detail: ExportCookies = {
cookie: [],
};
const detail: ExportCookies = {};
if (line.trim()) {
line.split(";").forEach((param) => {
const s = param.split("=");
Expand All @@ -55,11 +53,13 @@ export function parseExportCookie(
}
detail[s[0].trim()] = s[1].trim();
});
if (!detail.url && !detail.domain) {
if (detail.url || detail.domain) {
result.push(
new Promise<ExportCookies>((resolve) => {
detail.cookies = getCookies(detail);
resolve(detail);
getCookies(detail).then((cookies) => {
detail.cookies = cookies;
resolve(detail);
});
})
);
}
Expand Down
Loading

0 comments on commit c62a559

Please sign in to comment.