Skip to content

Commit 44b2497

Browse files
committed
feat: 去掉语言切换按钮(域名自动判断中英文)+ 插件package.json英文完善
1 parent b408a2c commit 44b2497

3 files changed

Lines changed: 34 additions & 26 deletions

File tree

extension/package.json

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
11
{
22
"name": "testpilot-ai",
33
"displayName": "TestPilot AI",
4-
"description": "AI驱动的自动化测试机器人 — 像人类一样操作UI、发现Bug、自动修复",
4+
"description": "AI-powered automated testing robot — operates UI like a human, finds bugs, and auto-fixes them. Supports Web, Android, iOS, Mini Program & Desktop.",
55
"version": "1.3.0",
66
"publisher": "testpilot-ai",
77
"engines": {
88
"vscode": "^1.85.0"
99
},
1010
"categories": [
1111
"Testing",
12+
"Machine Learning",
1213
"Other"
1314
],
1415
"keywords": [
1516
"testing",
1617
"ai",
1718
"automation",
18-
"bug",
19-
"repair"
19+
"test automation",
20+
"bug detection",
21+
"auto repair",
22+
"playwright",
23+
"appium",
24+
"ui testing",
25+
"blueprint",
26+
"android",
27+
"ios",
28+
"miniprogram",
29+
"desktop testing"
2030
],
31+
"repository": {
32+
"type": "git",
33+
"url": "https://github.com/zcj220/TestPilotAI"
34+
},
35+
"galleryBanner": {
36+
"color": "#1e1e2e",
37+
"theme": "dark"
38+
},
2139
"icon": "resources/icon.png",
2240
"activationEvents": ["onStartupFinished"],
2341
"main": "./out/extension.js",

web/src/components/Navbar.jsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useLocale } from '../context/LocaleContext';
44

55
export default function Navbar() {
66
const { user, logout } = useAuth();
7-
const { t, locale, setLocale } = useLocale();
7+
const { t, locale } = useLocale();
88
const navigate = useNavigate();
99

1010
return (
@@ -27,16 +27,7 @@ export default function Navbar() {
2727

2828
<div className="flex-1" />
2929

30-
<div className="flex items-center gap-3 text-sm">
31-
{/* 语言切换 */}
32-
<button
33-
onClick={() => setLocale(locale === 'zh' ? 'en' : 'zh')}
34-
className="text-[#24292f] hover:text-black text-xs cursor-pointer px-1.5 py-0.5 rounded border border-[#d1d9e0] hover:bg-[#ebeef1]"
35-
>
36-
{locale === 'zh' ? 'EN' : '中文'}
37-
</button>
38-
39-
{user ? (
30+
<div className="flex items-center gap-3 text-sm"> {user ? (
4031
<>
4132
<Link to="/dashboard" className="text-[#24292f] hover:text-black no-underline hover:no-underline">{t('nav.dashboard')}</Link>
4233
<Link to={`/user/${user.id}`} className="text-[#24292f] hover:text-black no-underline hover:no-underline">{user.username}</Link>

web/src/context/LocaleContext.jsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,25 @@ import { messages } from '../lib/i18n';
44
const LocaleContext = createContext(null);
55

66
export function LocaleProvider({ children }) {
7-
const [locale, setLocale] = useState(() => {
8-
const saved = localStorage.getItem('locale');
9-
if (saved) return saved;
10-
// 国际站(pages.dev 或未来绑定的 .com 域名)默认英文,国内站默认中文
7+
// 语言由域名自动决定,不允许手动切换,不读 localStorage
8+
// 国际站(pages.dev / .com / testpilot 相关 .com)→ 英文
9+
// 国内站(xinzaoai.com / localhost 等)→ 中文
10+
const locale = (() => {
1111
const host = window.location.hostname;
12-
if (host.includes('pages.dev') || host.includes('.com')) return 'en';
12+
if (
13+
host.includes('pages.dev') ||
14+
host.endsWith('.com') ||
15+
host === 'localhost' && false // 开发时如需测试英文版,改为 true
16+
) return 'en';
1317
return 'zh';
14-
});
15-
16-
function changeLocale(l) {
17-
setLocale(l);
18-
localStorage.setItem('locale', l);
19-
}
18+
})();
2019

2120
function t(key) {
2221
return messages[locale]?.[key] || messages.zh[key] || key;
2322
}
2423

2524
return (
26-
<LocaleContext.Provider value={{ locale, setLocale: changeLocale, t }}>
25+
<LocaleContext.Provider value={{ locale, t }}>
2726
{children}
2827
</LocaleContext.Provider>
2928
);

0 commit comments

Comments
 (0)