@@ -28,6 +28,7 @@ import * as util from "@/util/util";
2828import { cn , makeIconClass } from "@/util/util" ;
2929import * as jotai from "jotai" ;
3030import * as React from "react" ;
31+ import { useTranslation } from "react-i18next" ;
3132import { BlockEnv } from "./blockenv" ;
3233import { BlockFrameProps } from "./blocktypes" ;
3334
@@ -40,17 +41,18 @@ function handleHeaderContextMenu(
4041) {
4142 e . preventDefault ( ) ;
4243 e . stopPropagation ( ) ;
44+ const t = window . __waveI18n . t ;
4345 const magnified = globalStore . get ( nodeModel . isMagnified ) ;
4446 const menu : ContextMenuItem [ ] = [
4547 {
46- label : magnified ? "Un-Magnify Block" : "Magnify Block" ,
48+ label : magnified ? t ( "app.unMagnifyBlock" ) : t ( "app.magnifyBlock" ) ,
4749 click : ( ) => {
4850 nodeModel . toggleMagnify ( ) ;
4951 } ,
5052 } ,
5153 { type : "separator" } ,
5254 {
53- label : "Copy BlockId" ,
55+ label : t ( "app.copyBlockId" ) ,
5456 click : ( ) => {
5557 navigator . clipboard . writeText ( blockId ) ;
5658 } ,
@@ -61,7 +63,7 @@ function handleHeaderContextMenu(
6163 menu . push (
6264 { type : "separator" } ,
6365 {
64- label : "Close Block" ,
66+ label : t ( "app.closeBlock" ) ,
6567 click : ( ) => uxCloseBlock ( blockId ) ,
6668 }
6769 ) ;
@@ -76,6 +78,7 @@ type HeaderTextElemsProps = {
7678} ;
7779
7880const HeaderTextElems = React . memo ( ( { viewModel, blockId, preview, error } : HeaderTextElemsProps ) => {
81+ const { t } = useTranslation ( ) ;
7982 const waveEnv = useWaveEnv < BlockEnv > ( ) ;
8083 const frameTextAtom = waveEnv . getBlockMetaKeyAtom ( blockId , "frame:text" ) ;
8184 const frameText = jotai . useAtomValue ( frameTextAtom ) ;
@@ -102,7 +105,7 @@ const HeaderTextElems = React.memo(({ viewModel, blockId, preview, error }: Head
102105 < div className = "iconbutton disabled" key = "controller-status" onClick = { copyHeaderErr } >
103106 < i
104107 className = "fa-sharp fa-solid fa-triangle-exclamation"
105- title = { "Error Rendering View Header: " + error . message }
108+ title = { t ( "app.errorRenderingViewHeader" , { error : error . message } ) }
106109 />
107110 </ div >
108111 ) ;
@@ -119,6 +122,7 @@ type HeaderEndIconsProps = {
119122} ;
120123
121124const HeaderEndIcons = React . memo ( ( { viewModel, nodeModel, blockId } : HeaderEndIconsProps ) => {
125+ const { t } = useTranslation ( ) ;
122126 const blockEnv = useWaveEnv < BlockEnv > ( ) ;
123127 const endIconButtons = util . useAtomValueSafe ( viewModel ?. endIconButtons ) ;
124128 const magnified = jotai . useAtomValue ( nodeModel . isMagnified ) ;
@@ -136,7 +140,7 @@ const HeaderEndIcons = React.memo(({ viewModel, nodeModel, blockId }: HeaderEndI
136140 const splitHorizontalDecl : IconButtonDecl = {
137141 elemtype : "iconbutton" ,
138142 icon : "columns" ,
139- title : "Split Horizontally" ,
143+ title : t ( "app.splitHorizontally" ) ,
140144 click : ( e ) => {
141145 e . stopPropagation ( ) ;
142146 const blockAtom = WOS . getWaveObjectAtom < Block > ( WOS . makeORef ( "block" , blockId ) ) ;
@@ -150,7 +154,7 @@ const HeaderEndIcons = React.memo(({ viewModel, nodeModel, blockId }: HeaderEndI
150154 const splitVerticalDecl : IconButtonDecl = {
151155 elemtype : "iconbutton" ,
152156 icon : "grip-lines" ,
153- title : "Split Vertically" ,
157+ title : t ( "app.splitVertically" ) ,
154158 click : ( e ) => {
155159 e . stopPropagation ( ) ;
156160 const blockAtom = WOS . getWaveObjectAtom < Block > ( WOS . makeORef ( "block" , blockId ) ) ;
@@ -167,15 +171,15 @@ const HeaderEndIcons = React.memo(({ viewModel, nodeModel, blockId }: HeaderEndI
167171 const settingsDecl : IconButtonDecl = {
168172 elemtype : "iconbutton" ,
169173 icon : "cog" ,
170- title : "Settings" ,
174+ title : t ( "app.settings" ) ,
171175 click : ( e ) => handleHeaderContextMenu ( e , blockId , viewModel , nodeModel , blockEnv ) ,
172176 } ;
173177 endIconsElem . push ( < IconButton key = "settings" decl = { settingsDecl } className = "block-frame-settings" /> ) ;
174178 if ( ephemeral ) {
175179 const addToLayoutDecl : IconButtonDecl = {
176180 elemtype : "iconbutton" ,
177181 icon : "circle-plus" ,
178- title : "Add to Layout" ,
182+ title : t ( "app.addToLayout" ) ,
179183 click : ( ) => {
180184 nodeModel . addEphemeralNodeToLayout ( ) ;
181185 } ,
@@ -198,7 +202,7 @@ const HeaderEndIcons = React.memo(({ viewModel, nodeModel, blockId }: HeaderEndI
198202 const closeDecl : IconButtonDecl = {
199203 elemtype : "iconbutton" ,
200204 icon : "xmark-large" ,
201- title : "Close" ,
205+ title : t ( "app.close" ) ,
202206 click : ( ) => uxCloseBlock ( nodeModel . blockId ) ,
203207 } ;
204208 endIconsElem . push ( < IconButton key = "close" decl = { closeDecl } className = "block-frame-default-close" /> ) ;
0 commit comments