Skip to content

Commit 17c37f9

Browse files
cgsvcgsv
cgsv
authored and
cgsv
committed
add show all lang checkbox
1 parent cb01341 commit 17c37f9

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/lang.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const suportedLangZh = `
177177
僧伽罗语
178178
斯洛伐克语
179179
斯洛文尼亚语
180-
斯洛文尼亚语
180+
斯洛文尼亚语()
181181
西班牙语
182182
斯瓦希里语
183183
瑞典语

pages/srt.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ export default function Srt() {
119119
const [filename, setFilename] = useState("");
120120
const [loading, setLoading] = useState(false);
121121
const [transFileStatus, setTransFileStatus] = useState<TranslateFileStatus>({isTranslating: false, transCount: 0});
122+
const [showAllLang, setShowAllLang] = useState(false);
122123
const {t} = useTranslation("common");
123-
const [langs, setLangs] = useState(commonLangZh);
124+
const langs = showAllLang ? suportedLangZh : commonLangZh;
124125
const isEnglish = t("English") === "English";
125126

126127
const getUseGoogle = () => {
@@ -322,7 +323,8 @@ export default function Srt() {
322323
<select className={styles.selectLang} id="langSelect">
323324
{langs.map(lang => <option key={lang} value={lang}>{isEnglish? langBiMap.get(lang) : lang}</option>)}
324325
</select>
325-
{!loading ? <button onClick={translate} type="button" title={t("API-Slow-Warn")!} className={styles.genButton} style={{ marginLeft: "20px", height: "30px", width: "80px" }}>{t("Translate-This")}</button>
326+
<input type="checkbox" title={t("Show All languages")!} style={{ marginLeft: "5px" }} checked={showAllLang} onChange={e => setShowAllLang(e.target.checked)}></input>
327+
{!loading ? <button onClick={translate} type="button" title={t("API-Slow-Warn")!} className={styles.genButton} style={{ marginLeft: "5px", height: "30px", width: "80px" }}>{t("Translate-This")}</button>
326328
: <button disabled type="button" className={styles.genButton} style={{ marginLeft: "20px", height: "30px", width: "80px" }}>
327329
<div style={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
328330
<Image

public/locales/zh-CN/common.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@
3232
"No subtitle selected": "未选择字幕",
3333
"Progress": "进度",
3434
"OpenAI API key successfully set":"成功设置API Key",
35-
"OpenAI API key is invalid":"API key无效"
35+
"OpenAI API key is invalid":"API key无效",
36+
"Show All languages": "显示所有语言"
3637
}

0 commit comments

Comments
 (0)