Completed
Last Updated: 13 Jul 2023 08:43 by ADMIN
Release R2 2023 SP1
Martin Ivanov
Created on: 04 Jul 2023 15:46
Category: SyntaxEditor
Type: Feature Request
1
SyntaxEditor: Localize the tooltips of the search option buttons

Localize the tooltips for the match case button, the match word button and the use regular expression button.

Currently, the tooltips of the buttons are using hardcoded strings in English.

To translate the tooltips, you can get the corresponding buttons on load of the syntax editor control and replace their tooltips manually.

private void syntaxEditor_Loaded(object sender, RoutedEventArgs e)
{
	var buttons = this.syntaxEditor.ChildrenOfType<RadToggleButton>();
	var matchCaseButton = buttons.FirstOrDefault(x => x.Name == "PART_MatchCaseButton");
	var matchWordButton = buttons.FirstOrDefault(x => x.Name == "PART_MatchWordButton");
	var useRegularExpressionsButton = buttons.FirstOrDefault(x => x.Name == "PART_UseRegularExpressionsButton");

	matchCaseButton.ToolTip = CreateToolTip("SyntaxEditor_MatchCase"); // these are custom localization resource keys that should be manually defined by the developer that uses this solution
	matchWordButton.ToolTip = CreateToolTip("SyntaxEditor_MatchWord");
	useRegularExpressionsButton.ToolTip = CreateToolTip("SyntaxEditor_UseRegularExpressions");
}

private static ToolTip CreateToolTip(string resourceKey)
{
	var toolTip = new ToolTip();
	toolTip.Content = LocalizationManager.Manager.GetStringOverride(resourceKey);
	return toolTip;
}

0 comments