Skip to content

Commit

Permalink
Merge pull request #673 from WolframResearch/bugfix/447718_InsertionM…
Browse files Browse the repository at this point in the history
…enuText

Bugfix: Allow localization in cell insertion menu
  • Loading branch information
rhennigan authored May 8, 2024
2 parents 4fb3004 + d3df817 commit 3ff11b0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Developer/StylesheetBuilder.wl
Original file line number Diff line number Diff line change
Expand Up @@ -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:: *)
Expand Down Expand Up @@ -448,8 +449,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" ], trBox[ "StylesheetInsertionMenuChatInput" ], "'", "ChatInput" ],
insertionPointMenuItem[ TemplateBox[ { }, "SideChatIcon" ], trBox[ "StylesheetInsertionMenuSideChat" ], "''", "SideChat" ]
]
}
];
Expand Down
22 changes: 19 additions & 3 deletions FrontEnd/StyleSheets/Chatbook.nb
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,15 @@ Notebook[
TemplateBox[{}, "ChatInputIcon"],
BaselinePosition -> Center -> Scaled[0.55]
],
StyleBox["Chat Input", "CellInsertionMenu"],
StyleBox[
DynamicBox[
FEPrivate`FrontEndResource[
"ChatbookStrings",
"StylesheetInsertionMenuChatInput"
]
],
"CellInsertionMenu"
],
StyleBox[
StyleBox["'", "CellInsertionMenuShortcut"],
"CellInsertionMenuShortcut"
Expand Down Expand Up @@ -471,7 +479,15 @@ Notebook[
TemplateBox[{}, "SideChatIcon"],
BaselinePosition -> Center -> Scaled[0.55]
],
StyleBox["Side Chat", "CellInsertionMenu"],
StyleBox[
DynamicBox[
FEPrivate`FrontEndResource[
"ChatbookStrings",
"StylesheetInsertionMenuSideChat"
]
],
"CellInsertionMenu"
],
StyleBox[
StyleBox["''", "CellInsertionMenuShortcut"],
"CellInsertionMenuShortcut"
Expand Down Expand Up @@ -1161,7 +1177,7 @@ Notebook[
],
Cell[
StyleData["ChatStyleSheetInformation"],
TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3923736444"|>
TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3924158197"|>
],
Cell[
StyleData["Text"],
Expand Down
2 changes: 2 additions & 0 deletions FrontEnd/TextResources/ChatbookStrings.tr
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@
"StylesheetChatWidgetButtonTooltip" -> "Send to LLM",
"StylesheetAssistantMenuInitializerButtonTooltip" -> "Disable automatic assistance",
"StylesheetFeedbackButtonTooltip" -> "Send feedback to Wolfram",
"StylesheetInsertionMenuChatInput" -> "Chat Input",
"StylesheetInsertionMenuSideChat" -> "Side Chat",
"StylesheetExplodeCellsInPlace" -> "Explode Cells (In Place)",
"StylesheetExplodeCellsDuplicate" -> "Explode Cells (Duplicate)",
"StylesheetCopyExplodedCells" -> "Copy Exploded Cells",
Expand Down
4 changes: 3 additions & 1 deletion FrontEnd/TextResources/Japanese/ChatbookStrings.tr
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@
"StylesheetExplodeCellsDuplicate" -> "Explode Cells (Duplicate)",
"StylesheetCopyExplodedCells" -> "Copy Exploded Cells",
"StylesheetToggleFormatting" -> "Toggle Formatting",
"StylesheetCopyChatObject" -> "Copy ChatObject"
"StylesheetCopyChatObject" -> "Copy ChatObject",
"StylesheetInsertionMenuChatInput" -> "Chat Input",
"StylesheetInsertionMenuSideChat" -> "Side Chat"
}
@|
@|
Expand Down
4 changes: 3 additions & 1 deletion FrontEnd/TextResources/Spanish/ChatbookStrings.tr
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@
"StylesheetExplodeCellsDuplicate" -> "Explode Cells (Duplicate)",
"StylesheetCopyExplodedCells" -> "Copy Exploded Cells",
"StylesheetToggleFormatting" -> "Toggle Formatting",
"StylesheetCopyChatObject" -> "Copy ChatObject"
"StylesheetCopyChatObject" -> "Copy ChatObject",
"StylesheetInsertionMenuChatInput" -> "Chat Input",
"StylesheetInsertionMenuSideChat" -> "Side Chat"
}
@|
@|
Expand Down

0 comments on commit 3ff11b0

Please sign in to comment.