Localize hyperlink tooltip

3 posts, 1 answers
  1. Mihajlo
    Mihajlo avatar
    47 posts
    Member since:
    Aug 2018

    Posted 23 Mar Link to this post

    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. Mihajlo
    Mihajlo avatar
    47 posts
    Member since:
    Aug 2018

    Posted 24 Mar Link to this post

    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?

  3. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3906 posts

    Posted 24 Mar Link to this post

    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.
Back to Top