Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better tooltip formatting for resource file values?

When using resource files (*.resx) to implement translations, Visual Studio helpfully provides the base-language file's value in a tool-tip whenever you hover over a key:

screenshot of tool-tip

(there I have an entry Named "str_message" with the value "Message").

It's a minor annoyance, but is there any way to override or change that tooltip's format?

It puts the value directly in-line and always appends a period (like String.Format("Looks up a localized string similar to {0}.", ...), which is okay but can get confusing at a glance, especially if your values are longer and (may) contain their own punctuation at the end. Is there any way I can change that to something like: String.Format("Looks up a localized string similar to:\n\n{0}", ...), or even just show the "Comment" value from the .resx file?

like image 608
DaveD Avatar asked Mar 29 '13 20:03

DaveD


1 Answers

Well, I think it picks it up from the property comments in the Resources.Designer.cs that has been created. I am on a MAC and don't have a visual studio installation to try this out, so you could try changing the comment and see if that is reflected.

For eg. you should be seeing something like this in your Resources.Designer.cs

        /// <summary>
        ///   Looks up a localized string similar to Message
        /// </summary>
        internal static string str_message {
            get {
                return ResourceManager.GetString("str_message", resourceCulture);
            }
        }

If not, then I am not sure it can be changed.

@Brduca says, changes to this WILL be overwritten if you rerun the tools, so this might not be the best way, but if it is the only way, then you'll have to manage redoing the .cs file everytime you rerun the tools

like image 92
Vrashabh Irde Avatar answered Oct 12 '22 05:10

Vrashabh Irde