From 87c5317ec341f0097616f0429e0dc2a40c3aec33 Mon Sep 17 00:00:00 2001 From: Kevin Daily Date: Fri, 3 May 2024 15:07:49 -0700 Subject: [PATCH 1/4] Fix 447718: let cell insertion menu text be localizable --- Developer/StylesheetBuilder.wl | 4 ++-- FrontEnd/StyleSheets/Chatbook.nb | 22 ++++++++++++++++--- FrontEnd/TextResources/ChatbookStrings.tr | 4 +++- .../TextResources/Japanese/ChatbookStrings.tr | 4 +++- .../TextResources/Spanish/ChatbookStrings.tr | 4 +++- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Developer/StylesheetBuilder.wl b/Developer/StylesheetBuilder.wl index 7f4272a0..26ec9068 100644 --- a/Developer/StylesheetBuilder.wl +++ b/Developer/StylesheetBuilder.wl @@ -448,8 +448,8 @@ $cellInsertionPointCell := $cellInsertionPointCell = ReplaceAll[ item: HoldPattern[ _ :> FrontEndTokenExecute[ EvaluationNotebook[ ], "Style", "ExternalLanguage" ] ] :> Sequence[ item, - insertionPointMenuItem[ TemplateBox[ { }, "ChatInputIcon" ], "Chat Input", "'", "ChatInput" ], - insertionPointMenuItem[ TemplateBox[ { }, "SideChatIcon" ], "Side Chat", "''", "SideChat" ] + insertionPointMenuItem[ TemplateBox[ { }, "ChatInputIcon" ], tr[ "StylesheetInsertionMenuChatInput" ], "'", "ChatInput" ], + insertionPointMenuItem[ TemplateBox[ { }, "SideChatIcon" ], tr[ "StylesheetInsertionMenuSideChat" ], "''", "SideChat" ] ] } ]; diff --git a/FrontEnd/StyleSheets/Chatbook.nb b/FrontEnd/StyleSheets/Chatbook.nb index 232994aa..58b4c844 100644 --- a/FrontEnd/StyleSheets/Chatbook.nb +++ b/FrontEnd/StyleSheets/Chatbook.nb @@ -398,7 +398,15 @@ Notebook[ TemplateBox[{}, "ChatInputIcon"], BaselinePosition -> Center -> Scaled[0.55] ], - StyleBox["Chat Input", "CellInsertionMenu"], + StyleBox[ + Dynamic[ + FEPrivate`FrontEndResource[ + "ChatbookStrings", + "StylesheetInsertionMenuChatInput" + ] + ], + "CellInsertionMenu" + ], StyleBox[ StyleBox["'", "CellInsertionMenuShortcut"], "CellInsertionMenuShortcut" @@ -471,7 +479,15 @@ Notebook[ TemplateBox[{}, "SideChatIcon"], BaselinePosition -> Center -> Scaled[0.55] ], - StyleBox["Side Chat", "CellInsertionMenu"], + StyleBox[ + Dynamic[ + FEPrivate`FrontEndResource[ + "ChatbookStrings", + "StylesheetInsertionMenuSideChat" + ] + ], + "CellInsertionMenu" + ], StyleBox[ StyleBox["''", "CellInsertionMenuShortcut"], "CellInsertionMenuShortcut" @@ -1161,7 +1177,7 @@ Notebook[ ], Cell[ StyleData["ChatStyleSheetInformation"], - TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3922429268"|> + TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3923737613"|> ], Cell[ StyleData["Text"], diff --git a/FrontEnd/TextResources/ChatbookStrings.tr b/FrontEnd/TextResources/ChatbookStrings.tr index 469d7b88..e106cafc 100644 --- a/FrontEnd/TextResources/ChatbookStrings.tr +++ b/FrontEnd/TextResources/ChatbookStrings.tr @@ -149,7 +149,9 @@ "StylesheetChatWidgetButtonTooltip" -> "Send to LLM", "StylesheetAssistantMenuInitializerButtonTooltip" -> "Disable automatic assistance", -"StylesheetFeedbackButtonTooltip" -> "Send feedback to Wolfram" +"StylesheetFeedbackButtonTooltip" -> "Send feedback to Wolfram", +"StylesheetInsertionMenuChatInput" -> "Chat Input", +"StylesheetInsertionMenuSideChat" -> "Side Chat" } @| @| diff --git a/FrontEnd/TextResources/Japanese/ChatbookStrings.tr b/FrontEnd/TextResources/Japanese/ChatbookStrings.tr index 39ff4af7..d92270b2 100644 --- a/FrontEnd/TextResources/Japanese/ChatbookStrings.tr +++ b/FrontEnd/TextResources/Japanese/ChatbookStrings.tr @@ -149,7 +149,9 @@ "StylesheetChatWidgetButtonTooltip" -> "\:5927\:898f\:6a21\:8a00\:8a9e\:30e2\:30c7\:30eb\:306b\:9001\:4fe1", "StylesheetAssistantMenuInitializerButtonTooltip" -> "\:81ea\:52d5\:30a2\:30b7\:30b9\:30bf\:30f3\:30c8\:3092\:7121\:52b9\:306b\:3059\:308b", -"StylesheetFeedbackButtonTooltip" -> "\:30d5\:30a3\:30fc\:30c9\:30d0\:30c3\:30af\:3092Wolfram\:306b\:9001\:4fe1\:3059\:308b" +"StylesheetFeedbackButtonTooltip" -> "\:30d5\:30a3\:30fc\:30c9\:30d0\:30c3\:30af\:3092Wolfram\:306b\:9001\:4fe1\:3059\:308b", +"StylesheetInsertionMenuChatInput" -> "Chat Input", +"StylesheetInsertionMenuSideChat" -> "Side Chat" } @| @| diff --git a/FrontEnd/TextResources/Spanish/ChatbookStrings.tr b/FrontEnd/TextResources/Spanish/ChatbookStrings.tr index e25c757e..501d0c23 100644 --- a/FrontEnd/TextResources/Spanish/ChatbookStrings.tr +++ b/FrontEnd/TextResources/Spanish/ChatbookStrings.tr @@ -149,7 +149,9 @@ "StylesheetChatWidgetButtonTooltip" -> "Enviar a LLM", "StylesheetAssistantMenuInitializerButtonTooltip" -> "Deshabilitar asistencia autom\[AAcute]tica", -"StylesheetFeedbackButtonTooltip" -> "Enviar comentarios a Wolfram" +"StylesheetFeedbackButtonTooltip" -> "Enviar comentarios a Wolfram", +"StylesheetInsertionMenuChatInput" -> "Chat Input", +"StylesheetInsertionMenuSideChat" -> "Side Chat" } @| @| From dc96d1f7db8c39f7488844ac8e9ad75f02dc1d25 Mon Sep 17 00:00:00 2001 From: Rick Hennigan Date: Wed, 8 May 2024 11:52:56 -0400 Subject: [PATCH 2/4] Rebuilt stylesheet --- FrontEnd/StyleSheets/Chatbook.nb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrontEnd/StyleSheets/Chatbook.nb b/FrontEnd/StyleSheets/Chatbook.nb index 4d511270..e85320ae 100644 --- a/FrontEnd/StyleSheets/Chatbook.nb +++ b/FrontEnd/StyleSheets/Chatbook.nb @@ -1177,7 +1177,7 @@ Notebook[ ], Cell[ StyleData["ChatStyleSheetInformation"], - TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3923737613"|> + TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3924157945"|> ], Cell[ StyleData["Text"], From 2311e1dd6578a1d05a2d174709f631cdbfcbad2b Mon Sep 17 00:00:00 2001 From: Rick Hennigan Date: Wed, 8 May 2024 11:59:28 -0400 Subject: [PATCH 3/4] Bugfix: fix missing comma from bad merge --- FrontEnd/TextResources/ChatbookStrings.tr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrontEnd/TextResources/ChatbookStrings.tr b/FrontEnd/TextResources/ChatbookStrings.tr index 3d17f516..73735a1d 100644 --- a/FrontEnd/TextResources/ChatbookStrings.tr +++ b/FrontEnd/TextResources/ChatbookStrings.tr @@ -155,7 +155,7 @@ "StylesheetAssistantMenuInitializerButtonTooltip" -> "Disable automatic assistance", "StylesheetFeedbackButtonTooltip" -> "Send feedback to Wolfram", "StylesheetInsertionMenuChatInput" -> "Chat Input", -"StylesheetInsertionMenuSideChat" -> "Side Chat" +"StylesheetInsertionMenuSideChat" -> "Side Chat", "StylesheetExplodeCellsInPlace" -> "Explode Cells (In Place)", "StylesheetExplodeCellsDuplicate" -> "Explode Cells (Duplicate)", "StylesheetCopyExplodedCells" -> "Copy Exploded Cells", From d3df81747fb1a4982fa28887b799b591e29dde42 Mon Sep 17 00:00:00 2001 From: Rick Hennigan Date: Wed, 8 May 2024 12:00:02 -0400 Subject: [PATCH 4/4] Bugfix: Need DynamicBox instead of Dynamic in cell insertion menu --- Developer/StylesheetBuilder.wl | 5 +++-- FrontEnd/StyleSheets/Chatbook.nb | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Developer/StylesheetBuilder.wl b/Developer/StylesheetBuilder.wl index e2f57847..f84b9ff2 100644 --- a/Developer/StylesheetBuilder.wl +++ b/Developer/StylesheetBuilder.wl @@ -59,6 +59,7 @@ Get[ "Wolfram`Chatbook`" ]; tr[name_?StringQ] := Dynamic[FEPrivate`FrontEndResource["ChatbookStrings", name]] +trBox[name_?StringQ] := DynamicBox[FEPrivate`FrontEndResource["ChatbookStrings", name]] (* ::Subsection::Closed:: *) @@ -448,8 +449,8 @@ $cellInsertionPointCell := $cellInsertionPointCell = ReplaceAll[ item: HoldPattern[ _ :> FrontEndTokenExecute[ EvaluationNotebook[ ], "Style", "ExternalLanguage" ] ] :> Sequence[ item, - insertionPointMenuItem[ TemplateBox[ { }, "ChatInputIcon" ], tr[ "StylesheetInsertionMenuChatInput" ], "'", "ChatInput" ], - insertionPointMenuItem[ TemplateBox[ { }, "SideChatIcon" ], tr[ "StylesheetInsertionMenuSideChat" ], "''", "SideChat" ] + insertionPointMenuItem[ TemplateBox[ { }, "ChatInputIcon" ], trBox[ "StylesheetInsertionMenuChatInput" ], "'", "ChatInput" ], + insertionPointMenuItem[ TemplateBox[ { }, "SideChatIcon" ], trBox[ "StylesheetInsertionMenuSideChat" ], "''", "SideChat" ] ] } ]; diff --git a/FrontEnd/StyleSheets/Chatbook.nb b/FrontEnd/StyleSheets/Chatbook.nb index e85320ae..449e1fbc 100644 --- a/FrontEnd/StyleSheets/Chatbook.nb +++ b/FrontEnd/StyleSheets/Chatbook.nb @@ -399,7 +399,7 @@ Notebook[ BaselinePosition -> Center -> Scaled[0.55] ], StyleBox[ - Dynamic[ + DynamicBox[ FEPrivate`FrontEndResource[ "ChatbookStrings", "StylesheetInsertionMenuChatInput" @@ -480,7 +480,7 @@ Notebook[ BaselinePosition -> Center -> Scaled[0.55] ], StyleBox[ - Dynamic[ + DynamicBox[ FEPrivate`FrontEndResource[ "ChatbookStrings", "StylesheetInsertionMenuSideChat" @@ -1177,7 +1177,7 @@ Notebook[ ], Cell[ StyleData["ChatStyleSheetInformation"], - TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3924157945"|> + TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3924158197"|> ], Cell[ StyleData["Text"],