Add language switch on login page with English as default
Browse filesFiles changed (2)
2 unmodified lines3456789101112131415161718191 unmodified line212223242526273 unmodified lines31323334353637383940413 unmodified lines4546474849505152535455565758595 unmodified lines656667686970714 unmodified lines767778798081822 unmodified lines85868788899091929394951 unmodified line97989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714843 unmodified lines19219319419519619719819920020120220320420520620720824 unmodified lines2332342352362372382 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>QA 标注系统 - 登录/注册</title><link rel="stylesheet" href="/static/css/auth.css"></head><body><div class="container"><div class="auth-container"><div class="auth-header"><h1 data-i18n="auth.loginTitle">QA 标注系统</h1><div class="tab-buttons"><button class="tab-btn active" data-tab="login" data-i18n="auth.login">登录</button><button class="tab-btn" data-tab="register" data-i18n="auth.register">注册</button></div></div>1 unmodified line<div class="form-container active" id="login-form"><form id="loginForm"><div class="form-group"><label for="login-username" data-i18n="auth.username">用户名</label><inputtype="text"id="login-username"3 unmodified linesmaxlength="50"value="admin"data-i18n-placeholder="auth.usernamePlaceholder"placeholder="请输入用户名"></div><div class="form-group"><label for="login-password" data-i18n="auth.password">密码</label><div class="password-field"><inputtype="password"3 unmodified linesminlength="6"value="123456"data-i18n-placeholder="auth.passwordPlaceholder"placeholder="请输入密码"><buttontype="button"class="password-toggle"id="login-password-toggle"data-i18n-aria-label="auth.showPassword"aria-label="显示密码"title="显示密码"><svg class="icon-eye" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C7 5 2.73 8.11 1 12c1.73 3.89 6 7 11 7s9.27-3.11 11-7c-1.73-3.89-6-7-11-7zm0 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8z" fill="currentColor"/>5 unmodified lines</div></div><div class="form-group"><button type="submit" class="btn btn-primary"><span data-i18n="auth.login">登录</span></button><p class="demo-hint" data-i18n="auth.demoHint">Demo: Default admin credentials are pre-filled. Click Login to get started.</p></div><div class="message" id="login-message"></div>4 unmodified lines<div class="form-container" id="register-form"><form id="registerForm"><div class="form-group"><label for="register-username" data-i18n="auth.username">用户名</label><inputtype="text"id="register-username"2 unmodified linesminlength="3"maxlength="50"data-i18n-placeholder="auth.usernamePlaceholderWithHint"placeholder="请输入用户名(3-50个字符)"></div><div class="form-group"><label for="register-password" data-i18n="auth.password">密码</label><inputtype="password"id="register-password"1 unmodified linerequiredminlength="6"data-i18n-placeholder="auth.passwordPlaceholderWithHint"placeholder="请输入密码(至少6个字符)"></div><div class="form-group"><label for="register-fullname" data-i18n="auth.fullnameOptional">全名(可选)</label><inputtype="text"id="register-fullname"name="full_name"maxlength="100"data-i18n-placeholder="auth.fullnamePlaceholder"placeholder="请输入全名"></div><div class="form-group"><label for="register-organization" data-i18n="auth.organizationOptional">单位(可选)</label><select id="register-organization" name="organization"><option value="" data-i18n="auth.selectOrganization">请选择</option><option value="崖州湾实验室">崖州湾实验室</option><option value="之江实验室">之江实验室</option></select></div><div class="form-group"><label for="register-team" data-i18n="auth.teamOptional">团队(可选)</label><inputtype="text"id="register-team"name="team"maxlength="100"data-i18n-placeholder="auth.teamPlaceholder"placeholder="请输入团队"></div><div class="form-group"><label for="register-species" data-i18n="auth.speciesOptional">物种(可选)</label><inputtype="text"id="register-species"name="species"maxlength="100"data-i18n-placeholder="auth.speciesPlaceholder"placeholder="请输入物种"></div><div class="form-group"><button type="submit" class="btn btn-primary"><span data-i18n="auth.register">注册</span></button></div><div class="message" id="register-message"></div></form>43 unmodified lines};updatePageLanguage();} catch (error) {console.error('i18next 初始化失败:', error);}});function updatePageLanguage() {if (!window.i18next) return;const lang = window.i18next.language;document.documentElement.lang = lang;// 更新所有带有 data-i18n 属性的元素document.querySelectorAll('[data-i18n]').forEach(element => {const key = element.getAttribute('data-i18n');24 unmodified lineselement.setAttribute('title', window.i18next.t(key));});// 更新页面标题document.title = window.i18next.t('auth.loginTitle') + ' - ' + window.i18next.t('auth.login');}2 unmodified lines3456789101112131415161718192021221 unmodified line242526272829303 unmodified lines34353637383940414243443 unmodified lines4849505152535455565758596061625 unmodified lines686970717273744 unmodified lines798081828384852 unmodified lines88899091929394959697981 unmodified line10010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015143 unmodified lines19519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223324 unmodified lines2582592602612622632642652662672682692702712 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>QA Annotation System - Login</title><link rel="stylesheet" href="/static/css/auth.css"></head><body><div class="container"><div class="auth-container"><div class="auth-header"><button class="auth-lang-switch" id="languageSwitchBtn" type="button" title="Switch Language"><span id="currentLanguage">English</span></button><h1 data-i18n="auth.loginTitle">QA Annotation System</h1><div class="tab-buttons"><button class="tab-btn active" data-tab="login" data-i18n="auth.login">Login</button><button class="tab-btn" data-tab="register" data-i18n="auth.register">Register</button></div></div>1 unmodified line<div class="form-container active" id="login-form"><form id="loginForm"><div class="form-group"><label for="login-username" data-i18n="auth.username">Username</label><inputtype="text"id="login-username"3 unmodified linesmaxlength="50"value="admin"data-i18n-placeholder="auth.usernamePlaceholder"placeholder="Please enter username"></div><div class="form-group"><label for="login-password" data-i18n="auth.password">Password</label><div class="password-field"><inputtype="password"3 unmodified linesminlength="6"value="123456"data-i18n-placeholder="auth.passwordPlaceholder"placeholder="Please enter password"><buttontype="button"class="password-toggle"id="login-password-toggle"data-i18n-aria-label="auth.showPassword"aria-label="Show password"title="Show password"><svg class="icon-eye" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C7 5 2.73 8.11 1 12c1.73 3.89 6 7 11 7s9.27-3.11 11-7c-1.73-3.89-6-7-11-7zm0 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8z" fill="currentColor"/>5 unmodified lines</div></div><div class="form-group"><button type="submit" class="btn btn-primary"><span data-i18n="auth.login">Login</span></button><p class="demo-hint" data-i18n="auth.demoHint">Demo: Default admin credentials are pre-filled. Click Login to get started.</p></div><div class="message" id="login-message"></div>4 unmodified lines<div class="form-container" id="register-form"><form id="registerForm"><div class="form-group"><label for="register-username" data-i18n="auth.username">Username</label><inputtype="text"id="register-username"2 unmodified linesminlength="3"maxlength="50"data-i18n-placeholder="auth.usernamePlaceholderWithHint"placeholder="Please enter username (3-50 characters)"></div><div class="form-group"><label for="register-password" data-i18n="auth.password">Password</label><inputtype="password"id="register-password"1 unmodified linerequiredminlength="6"data-i18n-placeholder="auth.passwordPlaceholderWithHint"placeholder="Please enter password (at least 6 characters)"></div><div class="form-group"><label for="register-fullname" data-i18n="auth.fullnameOptional">Full Name (optional)</label><inputtype="text"id="register-fullname"name="full_name"maxlength="100"data-i18n-placeholder="auth.fullnamePlaceholder"placeholder="Please enter full name"></div><div class="form-group"><label for="register-organization" data-i18n="auth.organizationOptional">Organization (optional)</label><select id="register-organization" name="organization"><option value="" data-i18n="auth.selectOrganization">Please select</option><option value="崖州湾实验室">崖州湾实验室</option><option value="之江实验室">之江实验室</option></select></div><div class="form-group"><label for="register-team" data-i18n="auth.teamOptional">Team (optional)</label><inputtype="text"id="register-team"name="team"maxlength="100"data-i18n-placeholder="auth.teamPlaceholder"placeholder="Please enter team"></div><div class="form-group"><label for="register-species" data-i18n="auth.speciesOptional">Species (optional)</label><inputtype="text"id="register-species"name="species"maxlength="100"data-i18n-placeholder="auth.speciesPlaceholder"placeholder="Please enter species"></div><div class="form-group"><button type="submit" class="btn btn-primary"><span data-i18n="auth.register">Register</span></button></div><div class="message" id="register-message"></div></form>43 unmodified lines};updatePageLanguage();const langBtn = document.getElementById('languageSwitchBtn');if (langBtn) {langBtn.addEventListener('click', toggleLanguage);}} catch (error) {console.error('i18next 初始化失败:', error);}});function toggleLanguage() {if (!window.i18next) return;const currentLang = window.i18next.language;const newLang = currentLang === 'zh-CN' ? 'en-US' : 'zh-CN';window.i18next.changeLanguage(newLang, () => {localStorage.setItem('appLanguage', newLang);updatePageLanguage();});}function updatePageLanguage() {if (!window.i18next) return;const lang = window.i18next.language;document.documentElement.lang = lang;const langBtn = document.getElementById('currentLanguage');if (langBtn) {langBtn.textContent = lang === 'zh-CN' ? '中文' : 'English';}// 更新所有带有 data-i18n 属性的元素document.querySelectorAll('[data-i18n]').forEach(element => {const key = element.getAttribute('data-i18n');24 unmodified lineselement.setAttribute('title', window.i18next.t(key));});const loginPassword = document.getElementById('login-password');const loginToggle = document.getElementById('login-password-toggle');if (loginPassword && loginToggle && loginPassword.type === 'text') {const label = window.i18next.t('auth.hidePassword');loginToggle.setAttribute('aria-label', label);loginToggle.setAttribute('title', label);}// 更新页面标题document.title = window.i18next.t('auth.loginTitle') + ' - ' + window.i18next.t('auth.login');}
46 unmodified lines47484950515246 unmodified linescolor: white;padding: 40px 30px 30px;text-align: center;}.auth-header h1 {46 unmodified lines4748495051525354555657585960616263646566676869707146 unmodified linescolor: white;padding: 40px 30px 30px;text-align: center;position: relative;}.auth-lang-switch {position: absolute;top: 16px;right: 16px;padding: 6px 12px;background: rgba(255, 255, 255, 0.15);border: 1px solid rgba(255, 255, 255, 0.25);border-radius: 8px;color: white;font-size: 13px;cursor: pointer;transition: all 0.3s ease;}.auth-lang-switch:hover {background: rgba(255, 255, 255, 0.25);}.auth-header h1 {
qa_annotate/html/auth.html+57-24
qa_annotate/static/css/auth.css+19