refactoring translation files using arrays

This commit is contained in:
brownrw8 2025-01-21 10:43:55 -10:00
parent e643a4fbd4
commit a728c8cead
7 changed files with 76 additions and 95 deletions

View file

@ -9,73 +9,58 @@ interface AnnouncementProps {
}
const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
const { t } = useTranslation("translation", { keyPrefix: "announcement", useSuspense: false })
const { t, ready } = useTranslation("translation", { keyPrefix: "announcement", useSuspense: false })
const newChangesList = t("newChangesList", { returnObjects: true }) as Array<string>
const minorVersion = version.split(".").slice(0, 2).join(".") // 2.0.0 -> 2.0
return (
<div
style={{
backgroundColor: "var(--vscode-editor-inactiveSelectionBackground)",
borderRadius: "3px",
padding: "12px 16px",
margin: "5px 15px 5px 15px",
position: "relative",
flexShrink: 0,
}}>
<VSCodeButton appearance="icon" onClick={hideAnnouncement} style={{ position: "absolute", top: "8px", right: "8px" }}>
<span className="codicon codicon-close"></span>
</VSCodeButton>
<h3 style={{ margin: "0 0 8px" }}>{t("newInVersion", { version: minorVersion })}</h3>
<ul style={{ margin: "0 0 8px", paddingLeft: "12px" }}>
<li>
<b>{t("checkpointsTitle")}</b> {t("checkpointsDescription")}
<ul style={{ margin: "4px 0", paddingLeft: 22 }}>
<li>
<span
className="codicon codicon-diff-multiple"
style={{
fontSize: "12px",
marginRight: "4px",
}}></span>
<b>{t("compareTitle")}</b> {t("compareDescription")}
</li>
<li>
<span
className="codicon codicon-discard"
style={{
fontSize: "12px",
marginRight: "4px",
}}></span>
<b>{t("restoreTitle")}</b> {t("restoreDescription")}
</li>
</ul>
</li>
<li>
<b>{t("seeNewChangesTitle")}</b> {t("seeNewChangesDescription")}
</li>
</ul>
<p style={{ margin: "8px 0" }}></p>
<VSCodeLink href="https://x.com/sdrzn/status/1876378124126236949" style={{ display: "inline" }}>
{t("seeDemo")}
</VSCodeLink>
ready && (
<div
style={{
height: "1px",
background: "var(--vscode-foreground)",
opacity: 0.1,
margin: "8px 0",
}}
/>
<p style={{ margin: "0" }}>
<Trans
i18nKey="announcement.joinOurCommunities"
components={{
DiscordLink: <VSCodeLink href="https://discord.gg/cline" />,
RedditLink: <VSCodeLink href="https://www.reddit.com/r/cline/" />,
backgroundColor: "var(--vscode-editor-inactiveSelectionBackground)",
borderRadius: "3px",
padding: "12px 16px",
margin: "5px 15px 5px 15px",
position: "relative",
flexShrink: 0,
}}>
<VSCodeButton
appearance="icon"
onClick={hideAnnouncement}
style={{ position: "absolute", top: "8px", right: "8px" }}>
<span className="codicon codicon-close"></span>
</VSCodeButton>
<h3 style={{ margin: "0 0 8px" }}>{t("newInVersion", { version: minorVersion })}</h3>
<ul style={{ margin: "0 0 8px", paddingLeft: "12px" }}>
{newChangesList.map((transcluded, index) => (
<Trans
components={{
Link: <VSCodeLink href="#" />,
}}>
{transcluded}
</Trans>
))}
</ul>
<div
style={{
height: "1px",
background: "var(--vscode-foreground)",
opacity: 0.1,
margin: "8px 0",
}}
/>
</p>
</div>
<p style={{ margin: "0" }}>
<Trans
i18nKey="announcement.joinOurCommunities"
components={{
DiscordLink: <VSCodeLink href="https://discord.gg/cline" />,
RedditLink: <VSCodeLink href="https://www.reddit.com/r/cline/" />,
}}
/>
</p>
</div>
)
)
}

View file

@ -11,6 +11,11 @@ i18n.use(initReactI18next) // passes i18n down to react-i18next
.init({
fallbackLng: "en",
debug: true,
react: {
bindI18n: "languageChanged",
transSupportBasicHtmlNodes: true,
transKeepBasicHtmlNodesFor: ["b", "i", "strong", "em"],
},
})
i18n.addResourceBundle("de", "translation", translationDE)

View file

@ -1,16 +1,14 @@
{
"announcement": {
"newInVersion": "Neu in Version {{version}}",
"checkpointsTitle": "Checkpunkte",
"checkpointsDescription": "Erstellen Sie Checkpunkte, um den Fortschritt zu speichern.",
"compareTitle": "Vergleichen",
"compareDescription": "Vergleichen Sie Änderungen zwischen Checkpunkten.",
"restoreTitle": "Wiederherstellen",
"restoreDescription": "Stellen Sie frühere Versionen wieder her.",
"seeNewChangesTitle": "Neue Änderungen anzeigen",
"seeNewChangesDescription": "Sehen Sie sich die neuesten Änderungen an.",
"seeDemo": "Demo ansehen",
"joinOurCommunities": "Tritt unserem <DiscordLink>Discord</DiscordLink> oder <RedditLink>Reddit</RedditLink> bei für weitere Updates!"
"newInVersion": "New in version {{version}}",
"newChangesList": [
"<b>Plan/Act mode toggle:</b> Plan mode lets Cline focus on gathering information, asking clarifying questions, brainstorm ideas, and architect a solution. Switch back to Act mode to let him execute the plan!",
"<b>Quick API/model switching</b> with a new popup menu under the chat field",
"<b>VS Code LM API</b> lets you use models from other extensions like GitHub Copilot",
"<b>MCP server improvements:</b> On/off toggle to disable servers when not in use, and Auto-approve option for individual tools",
"In case you missed it, Cline now supports Checkpoints! <Link href=\"https://x.com/sdrzn/status/1876378124126236949\">See it in action here.</Link>"
],
"joinOurCommunities": "Join our <DiscordLink>Discord</DiscordLink> or <RedditLink>Reddit</RedditLink> for more updates!"
},
"settingsView": {
"settings": "Einstellungen",

View file

@ -1,15 +1,13 @@
{
"announcement": {
"newInVersion": "New in version {{version}}",
"checkpointsTitle": "Checkpoints",
"checkpointsDescription": "Create checkpoints to save progress.",
"compareTitle": "Compare",
"compareDescription": "Compare changes between checkpoints.",
"restoreTitle": "Restore",
"restoreDescription": "Restore previous versions.",
"seeNewChangesTitle": "See new changes",
"seeNewChangesDescription": "View the latest changes.",
"seeDemo": "See demo",
"newChangesList": [
"<b>Plan/Act mode toggle:</b> Plan mode lets Cline focus on gathering information, asking clarifying questions, brainstorm ideas, and architect a solution. Switch back to Act mode to let him execute the plan!",
"<b>Quick API/model switching</b> with a new popup menu under the chat field",
"<b>VS Code LM API</b> lets you use models from other extensions like GitHub Copilot",
"<b>MCP server improvements:</b> On/off toggle to disable servers when not in use, and Auto-approve option for individual tools",
"In case you missed it, Cline now supports Checkpoints! <Link href=\"https://x.com/sdrzn/status/1876378124126236949\">See it in action here.</Link>"
],
"joinOurCommunities": "Join our <DiscordLink>Discord</DiscordLink> or <RedditLink>Reddit</RedditLink> for more updates!"
},
"settingsView": {

View file

@ -7,8 +7,7 @@
"compareDescription": "チェックポイント間の変更を比較します。",
"restoreTitle": "復元",
"restoreDescription": "以前のバージョンを復元します。",
"seeNewChangesTitle": "新しい変更を見る",
"seeNewChangesDescription": "最新の変更を表示します。",
"seeNewChanges": "見逃した場合、Clineは現在チェックポイントをサポートしています <NewChangesLink>ここでアクションを確認してください。</NewChangesLink>",
"seeDemo": "デモを見る",
"joinOurCommunities": "最新情報を入手するには、私たちの <DiscordLink>Discord</DiscordLink> または <RedditLink>Reddit</RedditLink> に参加してください!"
},

View file

@ -7,8 +7,7 @@
"compareDescription": "比较检查点之间的更改。",
"restoreTitle": "恢复",
"restoreDescription": "恢复以前的版本。",
"seeNewChangesTitle": "查看新更改",
"seeNewChangesDescription": "查看最新更改。",
"seeNewChanges": "如果您错过了Cline 现在支持检查点!<NewChangesLink>在这里查看操作。</NewChangesLink>",
"seeDemo": "查看演示",
"joinOur": "加入我们的",
"joinOurCommunities": "加入我们的 <DiscordLink>Discord</DiscordLink> 或 <RedditLink>Reddit</RedditLink> 以获取更多更新。"

View file

@ -1,17 +1,14 @@
{
"announcement": {
"newInVersion": "版本 {{version}} 中的新功能",
"checkpointsTitle": "檢查點",
"checkpointsDescription": "創建檢查點以保存進度。",
"compareTitle": "比較",
"compareDescription": "比較檢查點之間的更改。",
"restoreTitle": "恢復",
"restoreDescription": "恢復以前的版本。",
"seeNewChangesTitle": "查看新更改",
"seeNewChangesDescription": "查看最新更改。",
"seeDemo": "查看演示",
"joinOur": "加入我們的",
"joinOurCommunities": "加入我們的 <DiscordLink>Discord</DiscordLink> 或 <RedditLink>Reddit</RedditLink> 以獲取更多更新。"
"newChangesList": [
"<b>計劃/執行模式切換:</b> 計劃模式讓 Cline 專注於收集信息、提出澄清問題、頭腦風暴和架構解決方案。切換回執行模式,讓他執行計劃!",
"<b>快速 API/模型切換</b>,在聊天字段下有一個新的彈出菜單",
"<b>VS Code LM API</b> 允許您使用其他擴展中的模型,如 GitHub Copilot",
"<b>MCP 伺服器改進:</b> 開/關切換以在不使用時禁用伺服器,並為單個工具提供自動批准選項",
"如果您錯過了Cline 現在支持檢查點!<Link href=\"https://x.com/sdrzn/status/1876378124126236949\">在這裡查看。</Link>"
],
"joinOurCommunities": "加入我們的 <DiscordLink>Discord</DiscordLink> 或 <RedditLink>Reddit</RedditLink> 獲取更多更新!"
},
"settingsView": {
"settings": "設置",