Skip to content

Commit

Permalink
Update i18n declaration file
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Jan 11, 2025
1 parent efb8290 commit 8236300
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/__tests__/components/browser.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("Browser", () => {
});

// i18n empty message key
expect(screen.getByText("BROWSER$EMPTY_MESSAGE")).toBeInTheDocument();
expect(screen.getByText("BROWSER$NO_PAGE_LOADED")).toBeInTheDocument();
});

it("renders the url and a screenshot", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function EmptyBrowserMessage() {
return (
<div className="flex flex-col items-center h-full justify-center">
<IoIosGlobe size={100} />
{t(I18nKey.BROWSER$EMPTY_MESSAGE)}
{t(I18nKey.BROWSER$NO_PAGE_LOADED)}
</div>
);
}
5 changes: 4 additions & 1 deletion frontend/src/components/layout/served-app-label.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { useTranslation } from "react-i18next";
import { useActiveHost } from "#/hooks/query/use-active-host";
import { I18nKey } from "#/i18n/declaration";

export function ServedAppLabel() {
const { t } = useTranslation();
const { activeHost } = useActiveHost();

return (
<div className="flex items-center justify-between w-full">
<div className="flex items-center gap-2">
<div className="flex items-center gap-2">App</div>
<div className="flex items-center gap-2">{t(I18nKey.APP$TITLE)}</div>
<span className="border rounded-md text- px-1 font-bold">BETA</span>
</div>
{activeHost && <div className="w-2 h-2 bg-green-500 rounded-full" />}
Expand Down
48 changes: 47 additions & 1 deletion frontend/src/i18n/translation.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
{
"APP$TITLE": {
"en": "App",
"ja": "アプリ",
"zh-CN": "应用",
"zh-TW": "應用",
"ko-KR": "",
"no": "App",
"it": "App",
"pt": "App",
"es": "App",
"ar": "تطبيق",
"fr": "App",
"tr": "Uygulama",
"de": "App"
},
"BROWSER$TITLE": {
"en": "Browser",
"ja": "ブラウザ",
"zh-CN": "浏览器",
"zh-TW": "瀏覽器",
"ko-KR": "브라우저",
"no": "Nettleser",
"it": "Browser",
"pt": "Navegador",
"es": "Navegador",
"ar": "المتصفح",
"fr": "Navigateur",
"tr": "Tarayıcı",
"de": "Browser"
},
"BROWSER$EMPTY_MESSAGE": {
"en": "If you tell OpenHands to start a web server, the app will appear here.",
"ja": "OpenHandsにWebサーバーの起動を指示すると、ここにアプリが表示されます。",
"zh-CN": "如果您告诉OpenHands启动Web服务器,应用将在此处显示。",
"zh-TW": "如果您告訴OpenHands啟動Web伺服器,應用將在此處顯示。",
"ko-KR": "OpenHands에게 웹 서버를 시작하도록 지시하면 여기에 앱이 표시됩니다.",
"no": "Hvis du ber OpenHands om å starte en webserver, vil appen vises her.",
"it": "Se chiedi a OpenHands di avviare un server web, l'app apparirà qui.",
"pt": "Se você disser ao OpenHands para iniciar um servidor web, o aplicativo aparecerá aqui.",
"es": "Si le dices a OpenHands que inicie un servidor web, la aplicación aparecerá aquí.",
"ar": "إذا طلبت من OpenHands بدء خادم ويب، سيظهر التطبيق هنا.",
"fr": "Si vous demandez à OpenHands de démarrer un serveur web, l'application apparaîtra ici.",
"tr": "OpenHands'e bir web sunucusu başlatmasını söylerseniz, uygulama burada görünecektir.",
"de": "Wenn Sie OpenHands anweisen, einen Webserver zu starten, erscheint die App hier."
},
"SETTINGS$TITLE": {
"en": "Settings",
"ja": "設定",
Expand Down Expand Up @@ -4289,8 +4334,9 @@
"fr": "Connecté",
"tr": "Bağlandı"
},
"BROWSER$EMPTY_MESSAGE": {
"BROWSER$NO_PAGE_LOADED": {
"en": "No page loaded.",
"ja": "ページが読み込まれていません。",
"zh-CN": "页面未加载",
"zh-TW": "未加載任何頁面。",
"de": "Keine Seite geladen.",
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/routes/_oh.app/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Outlet } from "react-router";
import { useDispatch, useSelector } from "react-redux";
import { FaServer } from "react-icons/fa";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import {
ConversationProvider,
useConversation,
Expand Down Expand Up @@ -39,6 +41,7 @@ import { MULTI_CONVERSATION_UI } from "#/utils/feature-flags";

function AppContent() {
useConversationConfig();
const { t } = useTranslation();
const { gitHubToken } = useAuth();
const { data: settings } = useSettings();
const { conversationId } = useConversation();
Expand Down Expand Up @@ -126,7 +129,11 @@ function AppContent() {
<Container
className="h-full"
labels={[
{ label: "Workspace", to: "", icon: <CodeIcon /> },
{
label: t(I18nKey.WORKSPACE$TITLE),
to: "",
icon: <CodeIcon />,
},
{ label: "Jupyter", to: "jupyter", icon: <ListIcon /> },
{
label: <ServedAppLabel />,
Expand All @@ -136,7 +143,7 @@ function AppContent() {
{
label: (
<div className="flex items-center gap-1">
Browser
{t(I18nKey.BROWSER$TITLE)}
{updateCount > 0 && <CountBadge count={updateCount} />}
</div>
),
Expand Down

0 comments on commit 8236300

Please sign in to comment.