Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Allow localization in cell insertion menu #673

Merged
merged 5 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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