This is a migrated thread and some comments may be shown as answers.

Localize hyperlink tooltip

2 Answers 133 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Mihajlo
Top achievements
Rank 1
Iron
Mihajlo asked on 23 Mar 2020, 06:40 PM

How can I completely localize hyperlink tooltip? I see that parameter value for RichTextBoxLocalizationProvider.GetLocalizedString is "Documents_RadRichTextBox_HyperlinkToolTipFormatString". I have to return my version of text "{0} {1} to follow link", but I don't see a way to localize those two parameters inside, I suppose "Ctrl +" and "Click".

I could just return a finished string without parameters, my version of "Ctrl + Click to follow link" instead of "{0} {1} to follow link", but could I run into a situation where those two parameters are not "Ctrl +" and "Click"?

2 Answers, 1 is accepted

Sort by
0
Mihajlo
Top achievements
Rank 1
Iron
answered on 24 Mar 2020, 12:12 PM

Found it. There are additional localizable strings, found in github:

Documents_RadRichTextBox_HyperlinkToolTipFormatString
Documents_RadRichTextBox_HyperlinkToolTipCtrlClick
Documents_RadRichTextBox_HyperlinkToolTipClick
Documents_RadRichTextBox_HyperlinkToolTipCurrentDocument

Localization is fine. But if I may now change the subject, is it possible to change the hyperlink style to be normal text, but underlined on mouse hover?

0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Mar 2020, 12:28 PM
Hello, Mihajlo,

As you have already found out, the appropriate way to localize any text in RadRichTextEditor is to use a custom RichTextBoxLocalizationProvider's implementation and override its GetLocalizedString method.

The RadDocument.HyperlinkToolTipFormatString internal property uses this format string from the RichTextBoxLocalizationProvider. In order to produce the final tool tip text, the HyperlinkNavigationMode is considered as well. It is set to HyperlinkNavigationMode.CtrlClick by default. An alternative HyperlinkNavigationMode is Click. The "Documents_RadRichTextBox_HyperlinkToolTipCtrlClick" and "Documents_RadRichTextBox_HyperlinkToolTipClick" texts from the localization provider gives you the opportunity to specify what text to be displayed for the Ctrl+Click text:
        public RadForm1()
        {

            RichTextBoxLocalizationProvider.CurrentProvider = new MyRichTextBoxLocalizationProvider();
            InitializeComponent();
             
        }

        public class MyRichTextBoxLocalizationProvider : RichTextBoxLocalizationProvider
        {
            public override string GetLocalizedString(string id)
            {
                switch (id)
                {
                    case "Documents_RadRichTextBox_HyperlinkToolTipFormatString":
                        return "{0} {1} to follow link";
                    case "Documents_RadRichTextBox_HyperlinkToolTipCtrlClick":
                        return "My Ctrl+Click";
                }
                return base.GetLocalizedString(id);
            }
        }
I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
RichTextEditor
Asked by
Mihajlo
Top achievements
Rank 1
Iron
Answers by
Mihajlo
Top achievements
Rank 1
Iron
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or