Skip to content

Commit 0470ab3

Browse files
authored
Merge pull request #171 from ccagml/main
add nls
2 parents 09b5f42 + f155833 commit 0470ab3

File tree

7 files changed

+521
-5
lines changed

7 files changed

+521
-5
lines changed

CHANGELOG.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
## version 2.13.4
1+
## version 2.14.1
2+
3+
- 尝试增加语言本地化
24

3-
- US站一些报错
5+
## version 2.13.4
46

7+
- US 站一些报错
58

69
## version 2.13.3
710

8-
- 修改README.md
11+
- 修改 README.md
912

1013
## version 2.13.2
1114

nls.js

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
var __generator = (this && this.__generator) || function (thisArg, body) {
12+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14+
function verb(n) { return function (v) { return step([n, v]); }; }
15+
function step(op) {
16+
if (f) throw new TypeError("Generator is already executing.");
17+
while (_) try {
18+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19+
if (y = 0, t) op = [op[0] & 2, t.value];
20+
switch (op[0]) {
21+
case 0: case 1: t = op; break;
22+
case 4: _.label++; return { value: op[1], done: false };
23+
case 5: _.label++; y = op[1]; op = [0]; continue;
24+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
25+
default:
26+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30+
if (t[2]) _.ops.pop();
31+
_.trys.pop(); continue;
32+
}
33+
op = body.call(thisArg, _);
34+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36+
}
37+
};
38+
exports.__esModule = true;
39+
var fse = require("fs-extra");
40+
var result_json = {};
41+
function check_key(object, father) {
42+
var main_join = father.join(".");
43+
if (object["description"]) {
44+
var key = main_join + ".description";
45+
if (result_json[key]) {
46+
console.log("重复", key, object);
47+
}
48+
result_json[key] = object["description"];
49+
}
50+
if (object["title"]) {
51+
var key = main_join + ".title";
52+
if (result_json[key]) {
53+
console.log("重复", key);
54+
}
55+
result_json[key] = object["title"];
56+
}
57+
if (object["name"]) {
58+
var key = main_join + ".name";
59+
if (result_json[key]) {
60+
console.log("重复", key);
61+
}
62+
result_json[key] = object["name"];
63+
}
64+
if (object["label"]) {
65+
var key = main_join + ".label";
66+
if (result_json[key]) {
67+
console.log("重复", key);
68+
}
69+
result_json[key] = object["label"];
70+
}
71+
if (object["enumDescriptions"]) {
72+
var key = main_join + ".enumDescriptions";
73+
if (result_json[key]) {
74+
console.log("重复", key);
75+
}
76+
result_json[key] = object["enumDescriptions"];
77+
}
78+
}
79+
function print_obj(object, father) {
80+
var obj_key = object["command"] || object["id"];
81+
if (obj_key) {
82+
father.push(obj_key);
83+
}
84+
check_key(object, father);
85+
for (var key in object) {
86+
if (Object.prototype.hasOwnProperty.call(object, key)) {
87+
var element = object[key];
88+
father.push(key);
89+
if (Array.isArray(element)) {
90+
print_arr(element, father);
91+
}
92+
else if (typeof element == "object") {
93+
print_obj(element, father);
94+
}
95+
father.pop();
96+
}
97+
}
98+
if (obj_key) {
99+
father.pop();
100+
}
101+
}
102+
function print_arr(object, father) {
103+
for (var i = 0; i < object.length; i++) {
104+
var element = object[i];
105+
if (Array.isArray(element)) {
106+
print_arr(element, father);
107+
}
108+
else if (typeof element == "object") {
109+
print_obj(element, father);
110+
}
111+
}
112+
}
113+
function test() {
114+
return __awaiter(this, void 0, void 0, function () {
115+
var temp_data, ob;
116+
return __generator(this, function (_a) {
117+
switch (_a.label) {
118+
case 0: return [4 /*yield*/, fse.readFile("./package.json", "utf8")];
119+
case 1:
120+
temp_data = _a.sent();
121+
ob = JSON.parse(temp_data);
122+
print_obj(ob, ["main"]);
123+
return [4 /*yield*/, fse.writeFile("./nls.json", JSON.stringify(result_json))];
124+
case 2:
125+
_a.sent();
126+
return [2 /*return*/];
127+
}
128+
});
129+
});
130+
}
131+
test();

nls.json

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"main.description": "LeetCode 官方插件增强, 代码开源, 增加 LeetCode 题目难度分, 给个star吧, 球球了",
3+
"main.name": "vscode-leetcode-problem-rating",
4+
"main.contributes.commands.lcpr.deleteCache.title": "Delete Cache",
5+
"main.contributes.commands.lcpr.toggleLeetCodeCn.title": "Switch Endpoint",
6+
"main.contributes.commands.lcpr.signin.title": "Sign In",
7+
"main.contributes.commands.lcpr.signout.title": "Sign Out",
8+
"main.contributes.commands.lcpr.refreshExplorer.title": "刷新",
9+
"main.contributes.commands.lcpr.pickOne.title": "手气一下",
10+
"main.contributes.commands.lcpr.deleteAllCache.title": "删除题目缓存",
11+
"main.contributes.commands.lcpr.showProblem.title": "做题",
12+
"main.contributes.commands.lcpr.previewProblem.title": "预览题目",
13+
"main.contributes.commands.lcpr.setBricksType0.title": "设置不出现在工地",
14+
"main.contributes.commands.lcpr.setBricksType1.title": "最后一次提交在14天前,出现在工地",
15+
"main.contributes.commands.lcpr.setBricksType2.title": "最后一次提交在7天前,出现在工地",
16+
"main.contributes.commands.lcpr.setBricksType3.title": "最后一次提交在5天前,出现在工地",
17+
"main.contributes.commands.lcpr.setBricksType4.title": "最后一次提交在3天前,出现在工地",
18+
"main.contributes.commands.lcpr.setBricksType5.title": "最后一次提交在2天前,出现在工地",
19+
"main.contributes.commands.lcpr.setBricksType6.title": "最后一次提交在1天前,出现在工地",
20+
"main.contributes.commands.lcpr.setBricksType7.title": "最后一次提交在1天前,出现在工地",
21+
"main.contributes.commands.lcpr.searchProblem.title": "Search Problem",
22+
"main.contributes.commands.lcpr.getHelp.title": "获取题解",
23+
"main.contributes.commands.lcpr.testSolution.title": "Test in LeetCode",
24+
"main.contributes.commands.lcpr.submitSolution.title": "Submit to LeetCode",
25+
"main.contributes.commands.lcpr.addFavorite.title": "Add to Favorite List",
26+
"main.contributes.commands.lcpr.removeFavorite.title": "Remove from Favorite List",
27+
"main.contributes.commands.lcpr.setDefaultLanguage.title": "Switch Default Language",
28+
"main.contributes.commands.lcpr.problems.sort.title": "Sort Problems",
29+
"main.contributes.commands.lcpr.remarkCreateNote.title": "Create Note",
30+
"main.contributes.commands.lcpr.remarkClose.title": "关闭?",
31+
"main.contributes.commands.lcpr.remarkReplyNote.title": "New Note",
32+
"main.contributes.commands.lcpr.remarkEditNote.title": "Edit Note",
33+
"main.contributes.commands.lcpr.remarkDeleteNoteComment.title": "Delete Note",
34+
"main.contributes.commands.lcpr.remarkSaveNote.title": "Save Note",
35+
"main.contributes.commands.lcpr.remarkCancelsaveNote.title": "Cancel Note",
36+
"main.contributes.commands.lcpr.remarkDispose.title": "Remove All Notes",
37+
"main.contributes.commands.lcpr.newBrickGroup.title": "新建一个自定义分类",
38+
"main.contributes.commands.lcpr.addQidToGroup.title": "添加题目到自定义分类",
39+
"main.contributes.commands.lcpr.removeBrickGroup.title": "移除这个自定义分类",
40+
"main.contributes.commands.lcpr.removeQidFromGroup.title": "从分类中移除这个题目",
41+
"main.contributes.commands.lcpr.includeTemplates.title": "插入头文件模板",
42+
"main.contributes.viewsContainers.activitybar.lcpr_bar.title": "LCPR",
43+
"main.contributes.views.lcpr_bar.QuestionExplorer.name": "Problems",
44+
"main.contributes.views.lcpr_bar.BricksExplorer.name": "搬砖工地",
45+
"main.contributes.submenus.lcpr.editorAction.label": "LCPR菜单",
46+
"main.contributes.submenus.lcpr.setBricksType_sub.label": "设置砖头类型",
47+
"main.contributes.submenus.lcpr.setBricksType_sub1.label": "设置砖头类型",
48+
"main.contributes.configuration.title": "leetcode-problem-rating",
49+
"main.contributes.configuration.properties.leetcode-problem-rating.includeTemplates.description": "引入一些默认内容,防止vscode都是波浪红线",
50+
"main.contributes.configuration.properties.leetcode-problem-rating.includeTemplates.items.properties.language.description": "哪种语言",
51+
"main.contributes.configuration.properties.leetcode-problem-rating.includeTemplates.items.properties.template.description": "模板内容",
52+
"main.contributes.configuration.properties.leetcode-problem-rating.hideSolved.description": "Hide solved problems.",
53+
"main.contributes.configuration.properties.leetcode-problem-rating.showLocked.description": "Show locked problems.",
54+
"main.contributes.configuration.properties.leetcode-problem-rating.defaultLanguage.description": "Default language for solving the problems.",
55+
"main.contributes.configuration.properties.leetcode-problem-rating.showDescription.description": "Specify where to show the description.",
56+
"main.contributes.configuration.properties.leetcode-problem-rating.showDescription.enumDescriptions": [
57+
"Show the problem description in a new webview window",
58+
"Show the problem description in the file's comment"
59+
],
60+
"main.contributes.configuration.properties.leetcode-problem-rating.showCommentDescription.description": "[Deprecated] Include problem description in comments.",
61+
"main.contributes.configuration.properties.leetcode-problem-rating.hint.setDefaultLanguage.description": "Show a hint to set the default language.",
62+
"main.contributes.configuration.properties.leetcode-problem-rating.hint.configWebviewMarkdown.description": "Show a hint to change webview appearance through markdown config.",
63+
"main.contributes.configuration.properties.leetcode-problem-rating.hint.commentDescription.description": "Show a hint to enable comment description in solution code file.",
64+
"main.contributes.configuration.properties.leetcode-problem-rating.hint.commandShortcut.description": "Show a hint to configure commands key binding.",
65+
"main.contributes.configuration.properties.leetcode-problem-rating.useVscodeNode.description": "Try the node version of vecode.",
66+
"main.contributes.configuration.properties.leetcode-problem-rating.useWsl.description": "Use the Windows Subsystem for Linux.",
67+
"main.contributes.configuration.properties.leetcode-problem-rating.endpoint.description": "Endpoint of the user account.",
68+
"main.contributes.configuration.properties.leetcode-problem-rating.useEndpointTranslation.description": "Use endpoint's translation (if available)",
69+
"main.contributes.configuration.properties.leetcode-problem-rating.answerDiffColor.description": "答案不同地方上色",
70+
"main.contributes.configuration.properties.leetcode-problem-rating.workspaceFolder.description": "The path of the workspace folder to store the problem files.",
71+
"main.contributes.configuration.properties.leetcode-problem-rating.filePath.description": "The output folder and filename to save the problem files.",
72+
"main.contributes.configuration.properties.leetcode-problem-rating.enableStatusBar.description": "Show the LeetCode status bar or not.",
73+
"main.contributes.configuration.properties.leetcode-problem-rating.editor.shortcuts.description": "Customize the shortcuts in editors.",
74+
"main.contributes.configuration.properties.leetcode-problem-rating.editor.shortcuts.items.enumDescriptions": [
75+
"Submit your answer to LeetCode.",
76+
"Test your answer with customized test cases.",
77+
"Star or unstar the current problem.",
78+
"Show the top voted solution for the current problem.",
79+
"Show the problem description page.",
80+
"Test default case",
81+
"Test all default case"
82+
],
83+
"main.contributes.configuration.properties.leetcode-problem-rating.enableSideMode.description": "Determine whether to group all webview pages into the second editor column when solving problems.",
84+
"main.contributes.configuration.properties.leetcode-problem-rating.nodePath.description": "The Node.js executable path. for example, C:\\Program Files\\nodejs\\node.exe",
85+
"main.contributes.configuration.properties.leetcode-problem-rating.colorizeProblems.description": "Add difficulty badge and colorize problems files in explorer tree.",
86+
"main.contributes.configuration.properties.leetcode-problem-rating.problems.sortStrategy.description": "Sorting strategy for problems list.",
87+
"main.contributes.configuration.properties.leetcode-problem-rating.pickOneByRankRangeMin.description": "Minimum score for a random question(your score + pickOneByRankRangeMin) ",
88+
"main.contributes.configuration.properties.leetcode-problem-rating.pickOneByRankRangeMax.description": "Highest score for a random question(your score + pickOneByRankRangeMax)",
89+
"main.contributes.configuration.properties.leetcode-problem-rating.hideScore.description": "Precinct Score Hidden Questions.",
90+
"main.contributes.configuration.properties.leetcode-problem-rating.hideScore.enumDescriptions": [
91+
"Don't hide",
92+
"Hide questions with scores",
93+
"Hide questions with no scores",
94+
"Hide questions outside the range of scores [pickOneByRankRangeMin, pickOneByRankRangeMax]"
95+
],
96+
"main.contributes.configuration.properties.leetcode-problem-rating.openClearProblemCache.description": "Clear the Problems cache when opening the app to avoid out-of-sync state",
97+
"main.contributes.configuration.properties.leetcode-problem-rating.openClearProblemCacheTime.description": "Open the app to clear the cache interval by default 3600 seconds"
98+
}

nls.ts

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import * as fse from "fs-extra";
2+
3+
let result_json = {};
4+
5+
function check_key(object, father: Array<any>) {
6+
let main_join = father.join(".");
7+
8+
if (object["description"]) {
9+
let key = main_join + ".description";
10+
11+
if (result_json[key]) {
12+
console.log("重复", key, object);
13+
}
14+
15+
result_json[key] = object["description"];
16+
}
17+
if (object["title"]) {
18+
let key = main_join + ".title";
19+
if (result_json[key]) {
20+
console.log("重复", key);
21+
}
22+
result_json[key] = object["title"];
23+
}
24+
if (object["name"]) {
25+
let key = main_join + ".name";
26+
if (result_json[key]) {
27+
console.log("重复", key);
28+
}
29+
result_json[key] = object["name"];
30+
}
31+
if (object["label"]) {
32+
let key = main_join + ".label";
33+
if (result_json[key]) {
34+
console.log("重复", key);
35+
}
36+
result_json[key] = object["label"];
37+
}
38+
if (object["enumDescriptions"]) {
39+
let key = main_join + ".enumDescriptions";
40+
if (result_json[key]) {
41+
console.log("重复", key);
42+
}
43+
result_json[key] = object["enumDescriptions"];
44+
}
45+
}
46+
47+
function print_obj(object, father) {
48+
let obj_key = object["command"] || object["id"];
49+
if (obj_key) {
50+
father.push(obj_key);
51+
}
52+
check_key(object, father);
53+
for (const key in object) {
54+
if (Object.prototype.hasOwnProperty.call(object, key)) {
55+
const element = object[key];
56+
father.push(key);
57+
if (Array.isArray(element)) {
58+
print_arr(element, father);
59+
} else if (typeof element == "object") {
60+
print_obj(element, father);
61+
}
62+
father.pop();
63+
}
64+
}
65+
if (obj_key) {
66+
father.pop();
67+
}
68+
}
69+
function print_arr(object, father) {
70+
for (let i = 0; i < object.length; i++) {
71+
const element = object[i];
72+
73+
if (Array.isArray(element)) {
74+
print_arr(element, father);
75+
} else if (typeof element == "object") {
76+
print_obj(element, father);
77+
}
78+
}
79+
}
80+
81+
async function test() {
82+
let temp_data = await fse.readFile("./package.json", "utf8");
83+
let ob = JSON.parse(temp_data);
84+
print_obj(ob, ["main"]);
85+
await fse.writeFile("./nls.json", JSON.stringify(result_json));
86+
}
87+
88+
test();

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "vscode-leetcode-problem-rating",
33
"displayName": "LeetCode",
4-
"description": "LeetCode 官方插件增强, 代码开源, 增加 LeetCode 题目难度分, 给个star吧, 球球了",
5-
"version": "2.13.4",
4+
"description": "%main.description%",
5+
"version": "2.14.1",
66
"author": "ccagml",
77
"publisher": "ccagml",
88
"license": "MIT",

0 commit comments

Comments
 (0)