6
6
import { Input } from "antd" ;
7
7
import { debounce } from "lodash" ;
8
8
import { useEffect , useRef } from "react" ;
9
- import { defineMessage , IntlShape } from "react-intl" ;
9
+ import { defineMessage , IntlShape , useIntl } from "react-intl" ;
10
10
11
11
import { set_account_table } from "@cocalc/frontend/account/util" ;
12
12
import { redux } from "@cocalc/frontend/app-framework" ;
@@ -376,8 +376,11 @@ addCommands({
376
376
377
377
clear : {
378
378
group : "action" ,
379
- button : "Clear" ,
380
- label : "Clear Frame" ,
379
+ button : labels . clear ,
380
+ label : defineMessage ( {
381
+ id : "command.generic.clear.label" ,
382
+ defaultMessage : "Clear Frame" ,
383
+ } ) ,
381
384
icon : < Icon unicode = { 0x2620 } /> ,
382
385
popconfirm : {
383
386
title : "Clear this frame?" ,
@@ -386,9 +389,16 @@ addCommands({
386
389
387
390
pause : {
388
391
group : "action" ,
389
- button : "Pause" ,
390
- icon : "pause" ,
391
- label : ( { props } ) => {
392
+ button : ( { props, intl } ) => (
393
+ < span >
394
+ { intl . formatMessage ( menu . pause_resume , { pause : props . is_paused } ) }
395
+ </ span >
396
+ ) ,
397
+ icon : ( { props } ) => ( props . is_paused ? "play" : "pause" ) ,
398
+ label : ( { props, intl } ) => {
399
+ const label = intl . formatMessage ( menu . pause_resume , {
400
+ pause : props . is_paused ,
401
+ } ) ;
392
402
if ( props . is_paused ) {
393
403
return (
394
404
< div
@@ -399,13 +409,17 @@ addCommands({
399
409
padding : "0 20px" ,
400
410
} }
401
411
>
402
- Resume
412
+ { label }
403
413
</ div >
404
414
) ;
415
+ } else {
416
+ return < span > { label } </ span > ;
405
417
}
406
- return < span > Pause</ span > ;
407
418
} ,
408
- title : "Pause this frame temporarily" ,
419
+ title : defineMessage ( {
420
+ id : "command.generic.pause.tooltip" ,
421
+ defaultMessage : "Temporarily pause output in this terminal." ,
422
+ } ) ,
409
423
onClick : ( { props } ) => {
410
424
if ( props . is_paused ) {
411
425
props . actions . unpause ( props . id ) ;
@@ -618,21 +632,37 @@ addCommands({
618
632
} ,
619
633
clean : {
620
634
group : "build" ,
621
- label : "Delete Aux Files" ,
622
- title : "Delete all temporary files left around from builds" ,
635
+ label : defineMessage ( {
636
+ id : "command.generic.clean.label" ,
637
+ defaultMessage : "Delete Aux Files" ,
638
+ description : "Clean up auxiliary build files" ,
639
+ } ) ,
640
+ title : defineMessage ( {
641
+ id : "command.generic.clean.title" ,
642
+ defaultMessage : "Delete all temporary files left around from builds" ,
643
+ description : "Clean up auxiliary build files" ,
644
+ } ) ,
623
645
icon : "trash" ,
624
646
} ,
625
647
626
648
rescan_latex_directive : {
627
649
group : "scan" ,
628
- label : "Scan for Build Directives" ,
629
- title : (
630
- < >
631
- Rescan the document for build directives, starting{ " " }
632
- < code > '% !TeX program = xelatex, pdflatex, etc'</ code > or{ " " }
633
- < code > '% !TeX cocalc = exact command line'</ code >
634
- </ >
635
- ) ,
650
+ label : defineMessage ( {
651
+ id : "command.generic.rescan_latex_directive.label" ,
652
+ defaultMessage : "Scan for Build Directives" ,
653
+ } ) ,
654
+ title : ( { intl } ) =>
655
+ intl . formatMessage (
656
+ {
657
+ id : "command.generic.rescan_latex_directive.title" ,
658
+ defaultMessage : `Rescan the LaTeX document for build directives.
659
+ This looks for lines starting with {code1} or {code2}.` ,
660
+ } ,
661
+ {
662
+ code1 : < code > '% !TeX program = xelatex, pdflatex, etc'</ code > ,
663
+ code2 : < code > '% !TeX cocalc = exact command line'</ code > ,
664
+ } ,
665
+ ) ,
636
666
icon : "reload" ,
637
667
} ,
638
668
sync : {
@@ -845,8 +875,14 @@ addCommands({
845
875
} ,
846
876
download_pdf : {
847
877
group : "export" ,
848
- label : "Download PDF" ,
849
- title : "Download the PDF file" ,
878
+ label : defineMessage ( {
879
+ id : "menu.generic.download_pdf.label" ,
880
+ defaultMessage : "Download PDF" ,
881
+ } ) ,
882
+ title : defineMessage ( {
883
+ id : "menu.generic.download_pdf.tooltip" ,
884
+ defaultMessage : "Download the PDF file" ,
885
+ } ) ,
850
886
icon : "cloud-download" ,
851
887
} ,
852
888
upload : {
@@ -975,8 +1011,13 @@ addCommands({
975
1011
pos : 5 ,
976
1012
group : "help-link" ,
977
1013
icon : "comment" ,
978
- label : "Chat With Collaborators or AI" ,
979
- button : "Chat" ,
1014
+ label : defineMessage ( {
1015
+ id : "command.generic.chat.label" ,
1016
+ defaultMessage : "Chat with Collaborators or AI" ,
1017
+ description :
1018
+ "Opens a chatroom next to the document to chat with other users (collaborators) or an AI chatbot" ,
1019
+ } ) ,
1020
+ button : labels . chat ,
980
1021
title :
981
1022
"Open chat on the side of this file for chatting with project collaborators or AI about this file." ,
982
1023
onClick : ( { props } ) => {
@@ -988,10 +1029,18 @@ addCommands({
988
1029
pos : 6 ,
989
1030
group : "help-link" ,
990
1031
icon : "medkit" ,
991
- label : "Support Ticket" ,
1032
+ label : defineMessage ( {
1033
+ id : "command.generic.support.label" ,
1034
+ defaultMessage : "Support Ticket" ,
1035
+ description : "Contact support by creating a support ticket to get help" ,
1036
+ } ) ,
992
1037
button : labels . support ,
993
- title :
994
- "Create a support ticket. Ask the people at CoCalc a question, report a bug, etc." ,
1038
+ title : defineMessage ( {
1039
+ id : "command.generic.support.tooltip" ,
1040
+ defaultMessage :
1041
+ "Create a support ticket. Ask the people at CoCalc a question, report a bug, etc." ,
1042
+ description : "Contact support by creating a support ticket to get help" ,
1043
+ } ) ,
995
1044
onClick : ( ) => {
996
1045
openSupportTab ( ) ;
997
1046
} ,
@@ -1001,9 +1050,12 @@ addCommands({
1001
1050
pos : 10 ,
1002
1051
group : "help-link" ,
1003
1052
icon : "youtube" ,
1004
- label : "Videos" ,
1005
- button : "Videos" ,
1006
- title : "Browse videos about CoCalc." ,
1053
+ label : labels . videos ,
1054
+ button : labels . videos ,
1055
+ title : defineMessage ( {
1056
+ id : "command.generic.videos.tooltip" ,
1057
+ defaultMessage : "Browse videos about CoCalc." ,
1058
+ } ) ,
1007
1059
onClick : ( ) => {
1008
1060
openNewTab (
1009
1061
"https://www.youtube.com/playlist?list=PLOEk1mo1p5tJmEuAlou4JIWZFH7IVE2PZ" ,
@@ -1015,7 +1067,12 @@ addCommands({
1015
1067
alwaysShow : true ,
1016
1068
pos : 0 ,
1017
1069
group : "search-commands" ,
1018
- title : "Search through all commands for this document frame." ,
1070
+ title : defineMessage ( {
1071
+ id : "command.generic.search_commands.tooltip" ,
1072
+ defaultMessage : "Search through all commands for this document frame." ,
1073
+ description :
1074
+ "Menu entry, where users can search through all available menu commands" ,
1075
+ } ) ,
1019
1076
label : ( { helpSearch, setHelpSearch } ) => {
1020
1077
return (
1021
1078
< SearchBox helpSearch = { helpSearch } setHelpSearch = { setHelpSearch } />
@@ -1300,7 +1357,9 @@ function fileAction(action) {
1300
1357
}
1301
1358
1302
1359
function SearchBox ( { setHelpSearch, helpSearch } ) {
1360
+ const intl = useIntl ( ) ;
1303
1361
const didFocus = useRef < boolean > ( false ) ;
1362
+
1304
1363
useEffect ( ( ) => {
1305
1364
return ( ) => {
1306
1365
if ( didFocus . current ) {
@@ -1309,10 +1368,11 @@ function SearchBox({ setHelpSearch, helpSearch }) {
1309
1368
}
1310
1369
} ;
1311
1370
} , [ ] ) ;
1371
+
1312
1372
return (
1313
1373
< Input . Search
1314
1374
autoFocus
1315
- placeholder = "Search"
1375
+ placeholder = { intl . formatMessage ( labels . search ) }
1316
1376
allowClear
1317
1377
value = { helpSearch }
1318
1378
onChange = { ( e ) => setHelpSearch ( e . target . value ) }
0 commit comments