Skip to content

Commit 8eaadfd

Browse files
committed
chore: force copy zh lang
1 parent 314f031 commit 8eaadfd

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cSpell.words": [
3+
"rspack"
4+
]
5+
}
File renamed without changes.

packages/force-copy/script/if-def/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const path = require("path");
22
const fs = require("fs");
33

4-
// 条件编译: `process.env.PLATFORM`的深层次嵌套
5-
// #IFDEF #ENDIF: `C/C++`预处理指令 平台层面扩展性
4+
// 条件编译: process.env.PLATFORM 的深层次嵌套
5+
// #IFDEF #ENDIF: C/C++ 预处理指令 平台层面扩展性
66

77
/**
8-
* @this {import('@rspack/core').LoaderContext}
8+
* @this {import("@rspack/core").LoaderContext}
99
* @param {string} source
1010
* @returns {string}
1111
*/
@@ -59,10 +59,10 @@ function IfDefineLoader(source) {
5959
const target = lines.map((line, index) => {
6060
// 去掉首尾的空白 去掉行首注释符号与空白符(可选)
6161
const code = line.trim().replace(/^\/\/\s*/, "");
62-
// 检查预处理指令起始 `#IFDEF`只会置`true`
62+
// 检查预处理指令起始 #IFDEF 只会置 true
6363
if (/^#IFDEF/.test(code)) {
6464
stack.push(index);
65-
// 如果是`true`继续即可
65+
// 如果是 true 继续即可
6666
if (terser) return "";
6767
const match = code.replace("#IFDEF", "").trim();
6868
const group = match.split("|").map(item => item.trim().toLowerCase());
@@ -73,10 +73,10 @@ function IfDefineLoader(source) {
7373
}
7474
return "";
7575
}
76-
// 检查预处理指令结束 `#IFDEF`只会置`false`
76+
// 检查预处理指令结束 #IFDEF 只会置 false
7777
if (/^#ENDIF$/.test(code)) {
7878
const index = stack.pop();
79-
// 额外的`#ENDIF`忽略
79+
// 额外的 #ENDIF 忽略
8080
if (index === undefined) return "";
8181
if (index === terserIndex) {
8282
terser = false;

packages/force-copy/src/popup/components/app/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,17 @@ import { Console } from "../console";
77
import { Header } from "../header";
88
import { Footer } from "../footer";
99

10+
// https://www.rfc-editor.org/rfc/rfc9110.html#name-language-tags
11+
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n
1012
const i18n = new I18n(cross.i18n.getUILanguage());
1113

1214
export const App: FC = () => {
1315
return (
1416
<div className={cs(styles.container)}>
1517
<Header i18n={i18n}></Header>
16-
1718
<div className={styles.hr}></div>
18-
1919
<Console i18n={i18n}></Console>
20-
2120
<div className={styles.hr}></div>
22-
2321
<Footer i18n={i18n}></Footer>
2422
</div>
2523
);

packages/force-copy/src/popup/i18n/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class I18n {
1111
this.config = I18n.getFullConfig(language);
1212
}
1313

14-
t = (key: keyof I18nTypes, defaultValue = "") => {
14+
public t = (key: keyof I18nTypes, defaultValue = "") => {
1515
return this.config[key] || defaultValue || key;
1616
};
1717

0 commit comments

Comments
 (0)