@@ -66,6 +66,9 @@ import {
6666 formatRelativeTime ,
6767 groupMessageParts ,
6868 isTauriRuntime ,
69+ } from "./utils" ;
70+ import { currentLocale , setLocale , t , type Language } from "../i18n" ;
71+ import {
6972 isWindowsPlatform ,
7073 lastUserModelFromMessages ,
7174 parseModelRef ,
@@ -245,7 +248,7 @@ export default function App() {
245248 if ( ! c || ! sessionID ) return ;
246249
247250 setBusy ( true ) ;
248- setBusyLabel ( "Running " ) ;
251+ setBusyLabel ( "status.running " ) ;
249252 setBusyStartedAt ( Date . now ( ) ) ;
250253 setError ( null ) ;
251254
@@ -589,14 +592,14 @@ export default function App() {
589592
590593 const label = busyLabel ( ) ;
591594 // Allow creating a new session even while a run is in progress.
592- if ( busy ( ) && label === "Running " ) return false ;
595+ if ( busy ( ) && label === "status.running " ) return false ;
593596
594597 // Otherwise, block during engine / connection transitions.
595598 if (
596599 busy ( ) &&
597- ( label === "Connecting " ||
598- label === "Starting engine " ||
599- label === "Disconnecting " )
600+ ( label === "status.connecting " ||
601+ label === "status.starting_engine " ||
602+ label === "status.disconnecting " )
600603 ) {
601604 return true ;
602605 }
@@ -666,7 +669,7 @@ export default function App() {
666669 modelID : DEFAULT_MODEL . modelID ,
667670 title : DEFAULT_MODEL . modelID ,
668671 description : DEFAULT_MODEL . providerID ,
669- footer : "Fallback" ,
672+ footer : t ( "settings.model_fallback" , currentLocale ( ) ) ,
670673 isFree : true ,
671674 isConnected : false ,
672675 } ,
@@ -699,9 +702,9 @@ export default function App() {
699702 for ( const model of models ) {
700703 const isFree = model . cost ?. input === 0 && model . cost ?. output === 0 ;
701704 const footerBits : string [ ] = [ ] ;
702- if ( defaultModelID === model . id ) footerBits . push ( "Default" ) ;
703- if ( isFree ) footerBits . push ( "Free" ) ;
704- if ( model . capabilities ?. reasoning ) footerBits . push ( "Reasoning" ) ;
705+ if ( defaultModelID === model . id ) footerBits . push ( t ( "settings.model_default" , currentLocale ( ) ) ) ;
706+ if ( isFree ) footerBits . push ( t ( "settings.model_free" , currentLocale ( ) ) ) ;
707+ if ( model . capabilities ?. reasoning ) footerBits . push ( t ( "settings.model_reasoning" , currentLocale ( ) ) ) ;
705708
706709 next . push ( {
707710 providerID : provider . id ,
@@ -817,7 +820,7 @@ export default function App() {
817820 setNotionBusy ( true ) ;
818821 setNotionError ( null ) ;
819822 setNotionStatus ( "connecting" ) ;
820- setNotionStatusDetail ( "Reload required" ) ;
823+ setNotionStatusDetail ( t ( "settings.reload_required" , currentLocale ( ) ) ) ;
821824 setNotionSkillInstalled ( false ) ;
822825
823826 try {
@@ -843,10 +846,10 @@ export default function App() {
843846 }
844847
845848 markReloadRequired ( "mcp" ) ;
846- setNotionStatusDetail ( "Reload required" ) ;
849+ setNotionStatusDetail ( t ( "settings.reload_required" , currentLocale ( ) ) ) ;
847850 try {
848851 window . localStorage . setItem ( "openwork.notionStatus" , "connecting" ) ;
849- window . localStorage . setItem ( "openwork.notionStatusDetail" , "Reload required" ) ;
852+ window . localStorage . setItem ( "openwork.notionStatusDetail" , t ( "settings.reload_required" , currentLocale ( ) ) ) ;
850853 window . localStorage . setItem ( "openwork.notionSkillInstalled" , "0" ) ;
851854 } catch {
852855 // ignore
@@ -915,21 +918,21 @@ export default function App() {
915918
916919 if ( mode ( ) !== "host" ) {
917920 console . log ( "[connectMcp] ❌ mode is not host, mode=" , mode ( ) ) ;
918- setMcpStatus ( "MCP connections are only available in Host mode." ) ;
921+ setMcpStatus ( t ( "mcp.host_mode_only" , currentLocale ( ) ) ) ;
919922 return ;
920923 }
921924
922925 const projectDir = workspaceProjectDir ( ) . trim ( ) ;
923926 console . log ( "[connectMcp] projectDir:" , projectDir ) ;
924927 if ( ! projectDir ) {
925928 console . log ( "[connectMcp] ❌ no projectDir" ) ;
926- setMcpStatus ( "Pick a workspace folder first." ) ;
929+ setMcpStatus ( t ( "mcp.pick_workspace_first" , currentLocale ( ) ) ) ;
927930 return ;
928931 }
929932
930933 if ( ! isTauriRuntime ( ) ) {
931934 console . log ( "[connectMcp] ❌ not Tauri runtime" ) ;
932- setMcpStatus ( "MCP connections require the desktop app." ) ;
935+ setMcpStatus ( t ( "mcp.desktop_required" , currentLocale ( ) ) ) ;
933936 return ;
934937 }
935938 console . log ( "[connectMcp] ✓ is Tauri runtime" ) ;
@@ -938,7 +941,7 @@ export default function App() {
938941 console . log ( "[connectMcp] activeClient:" , activeClient ? "exists" : "null" ) ;
939942 if ( ! activeClient ) {
940943 console . log ( "[connectMcp] ❌ no activeClient" ) ;
941- setMcpStatus ( "Connect to the OpenCode server first." ) ;
944+ setMcpStatus ( t ( "mcp.connect_server_first" , currentLocale ( ) ) ) ;
942945 return ;
943946 }
944947
@@ -1026,7 +1029,7 @@ export default function App() {
10261029 setMcpAuthEntry ( entry ) ;
10271030 setMcpAuthModalOpen ( true ) ;
10281031 } else {
1029- setMcpStatus ( "Reload required to activate the new MCP." ) ;
1032+ setMcpStatus ( t ( "mcp.reload_required_after_add" , currentLocale ( ) ) ) ;
10301033 }
10311034
10321035 markReloadRequired ( "mcp" ) ;
@@ -1036,7 +1039,7 @@ export default function App() {
10361039 console . log ( "[connectMcp] ✓ done" ) ;
10371040 } catch ( e ) {
10381041 console . error ( "[connectMcp] ❌ error:" , e ) ;
1039- setMcpStatus ( e instanceof Error ? e . message : "Failed to connect MCP." ) ;
1042+ setMcpStatus ( e instanceof Error ? e . message : t ( "mcp.connect_failed" , currentLocale ( ) ) ) ;
10401043 } finally {
10411044 setMcpConnectingName ( null ) ;
10421045 console . log ( "[connectMcp] finally block, connecting name cleared" ) ;
@@ -1069,7 +1072,7 @@ export default function App() {
10691072 console . log ( "[DEBUG] client found" ) ;
10701073 setBusy ( true ) ;
10711074 console . log ( "[DEBUG] busy set" ) ;
1072- setBusyLabel ( "Creating new task " ) ;
1075+ setBusyLabel ( "status.creating_task " ) ;
10731076 console . log ( "[DEBUG] busy label set" ) ;
10741077 setBusyStartedAt ( Date . now ( ) ) ;
10751078 console . log ( "[DEBUG] busy started at set" ) ;
@@ -1126,7 +1129,7 @@ export default function App() {
11261129 mark ( "health ok" , healthResult ) ;
11271130 } catch ( healthErr ) {
11281131 mark ( "health FAILED" , healthErr ) ;
1129- throw new Error ( "Server connection lost. Please reload." ) ;
1132+ throw new Error ( t ( "app.connection_lost" , currentLocale ( ) ) ) ;
11301133 }
11311134
11321135 let rawResult : Awaited < ReturnType < typeof c . session . create > > ;
@@ -1144,7 +1147,7 @@ export default function App() {
11441147 const session = unwrap ( rawResult ) ;
11451148 mark ( "session unwrapped" ) ;
11461149 // Set selectedSessionId BEFORE switching view to avoid "No session selected" flash
1147- setBusyLabel ( "Loading session " ) ;
1150+ setBusyLabel ( "status.loading_session " ) ;
11481151 await withTimeout (
11491152 loadSessions ( workspaceStore . activeWorkspaceRoot ( ) . trim ( ) ) ,
11501153 12_000 ,
@@ -1159,7 +1162,7 @@ export default function App() {
11591162 setView ( "session" ) ;
11601163 } catch ( e ) {
11611164 mark ( "error caught" , e ) ;
1162- const message = e instanceof Error ? e . message : "Unknown error" ;
1165+ const message = e instanceof Error ? e . message : t ( "app.unknown_error" , currentLocale ( ) ) ;
11631166 setError ( addOpencodeCacheHint ( message ) ) ;
11641167 } finally {
11651168 setCreatingSession ( false ) ;
@@ -1445,6 +1448,8 @@ export default function App() {
14451448 }
14461449 } ) ;
14471450
1451+
1452+
14481453 createEffect ( ( ) => {
14491454 if ( typeof window === "undefined" ) return ;
14501455 try {
@@ -1493,16 +1498,17 @@ export default function App() {
14931498 } ) ;
14941499
14951500 const headerStatus = createMemo ( ( ) => {
1496- if ( ! client ( ) || ! connectedVersion ( ) ) return "Disconnected" ;
1497- const bits = [ `Connected · ${ connectedVersion ( ) } ` ] ;
1498- if ( sseConnected ( ) ) bits . push ( "Live" ) ;
1501+ if ( ! client ( ) || ! connectedVersion ( ) ) return t ( "status.disconnected" , currentLocale ( ) ) ;
1502+ const bits = [ `${ t ( "status.connected" , currentLocale ( ) ) } · ${ connectedVersion ( ) } ` ] ;
1503+ if ( sseConnected ( ) ) bits . push ( t ( "status.live" , currentLocale ( ) ) ) ;
14991504 return bits . join ( " · " ) ;
15001505 } ) ;
15011506
15021507 const busyHint = createMemo ( ( ) => {
15031508 if ( ! busy ( ) || ! busyLabel ( ) ) return null ;
15041509 const seconds = busySeconds ( ) ;
1505- return seconds > 0 ? `${ busyLabel ( ) } · ${ seconds } s` : busyLabel ( ) ;
1510+ const label = t ( busyLabel ( ) ! , currentLocale ( ) ) ;
1511+ return seconds > 0 ? `${ label } · ${ seconds } s` : label ;
15061512 } ) ;
15071513
15081514 const localHostLabel = createMemo ( ( ) => {
@@ -1667,10 +1673,10 @@ export default function App() {
16671673 openDefaultModelPicker,
16681674 showThinking : showThinking ( ) ,
16691675 toggleShowThinking : ( ) => setShowThinking ( ( v ) => ! v ) ,
1670- modelVariantLabel : modelVariant ( ) ?? "(default)" ,
1676+ modelVariantLabel : modelVariant ( ) ?? t ( "common.default_parens" , currentLocale ( ) ) ,
16711677 editModelVariant : ( ) => {
16721678 const next = window . prompt (
1673- "Model variant (provider-specific, e.g. high/max/minimal). Leave blank to clear." ,
1679+ t ( "settings.model_variant_prompt" , currentLocale ( ) ) ,
16741680 modelVariant ( ) ?? ""
16751681 ) ;
16761682 if ( next == null ) return ;
@@ -1724,6 +1730,8 @@ export default function App() {
17241730 refreshMcpServers,
17251731 showMcpReloadBanner : reloadRequired ( ) && reloadReasons ( ) . includes ( "mcp" ) ,
17261732 reloadMcpEngine : ( ) => reloadEngineInstance ( ) ,
1733+ language : currentLocale ( ) ,
1734+ setLanguage : setLocale ,
17271735 } ) ;
17281736
17291737 return (
@@ -1821,6 +1829,7 @@ export default function App() {
18211829 resetModalText ( ) . trim ( ) . toUpperCase ( ) === "RESET"
18221830 }
18231831 hasActiveRuns = { anyActiveRuns ( ) }
1832+ language = { currentLocale ( ) }
18241833 onClose = { ( ) => setResetModalOpen ( false ) }
18251834 onConfirm = { confirmReset }
18261835 onTextChange = { setResetModalText }
@@ -1831,6 +1840,7 @@ export default function App() {
18311840 client = { client ( ) }
18321841 entry = { mcpAuthEntry ( ) }
18331842 projectDir = { workspaceProjectDir ( ) }
1843+ language = { currentLocale ( ) }
18341844 onClose = { ( ) => {
18351845 setMcpAuthModalOpen ( false ) ;
18361846 setMcpAuthEntry ( null ) ;
@@ -1839,7 +1849,7 @@ export default function App() {
18391849 setMcpAuthModalOpen ( false ) ;
18401850 setMcpAuthEntry ( null ) ;
18411851 markReloadRequired ( "mcp" ) ;
1842- setMcpStatus ( "OAuth completed. Reload the engine to activate the MCP." ) ;
1852+ setMcpStatus ( t ( "mcp.auth.oauth_completed_reload" , currentLocale ( ) ) ) ;
18431853 } }
18441854 onReloadEngine = { ( ) => reloadEngineInstance ( ) }
18451855 />
0 commit comments