Click here to Skip to main content
15,892,674 members
Articles / Programming Languages / C#
Tip/Trick

How to Use Localized Help in English Visual Studio 2012 & 2013 & 2015

Rate me:
Please Sign up or sign in to vote.
4.80/5 (5 votes)
7 Aug 2016CPOL2 min read 25.8K   8   8
English Visual Studio and localized Help.

Introduction

This article contains a lot of C# code and instructions for using translated Help on pressing F1 in Visual Studio IDE text editor.

Background

Some developers in my team switch to C# from other languages. But its skill in English is not enough for fast reading and understanding a new language with new technology. Ok. You can say: install VS with Russian or German and use it. But there is a difficulty. One man who can help them with IDE is me, but I used VS a long long time ago only in English and at this point I can't help my friends with its questions.

I spent some time and investigated how VS call help by F1. If you skip some detail IDE run HlpViewer.exe with command line. AHA, I say.

Preliminary Steps

  1. Install English VS 2015 (10-12-13)
  2. Run Add and remove Help content (Ctrl+Alt+F1) and install documentation in English
  3. Change VS language to Russian (German or other) (https://www.microsoft.com/en-US/download/details.aspx?id=48157)
  4. Run Add and remove Help content (Ctrl+Alt+F1) and install documentation in Russian (German or other)
  5. Load binaires or source files
  6. Rename 'C:\Program Files (x86)\Microsoft Help Viewer\v2.2\HlpViewer.exe' to HlpViewer2.exe (or other name)
  7. Copy binaries to 'C:\Program Files (x86)\Microsoft Help Viewer\v2.2' folder

Code

The code is trivial for C# and there is no need for any comments.

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.ComponentModel;
using System.Windows.Forms ;

namespace VSHelpViewer
{
  class Program
  {
    static NLog.Logger m_logger = NLog.LogManager.GetCurrentClassLogger();
    static void Main(string[] args)
    {
      LogSettings(args);

      Process proc = new Process();
      proc.StartInfo.UseShellExecute = false;
      proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
      proc.StartInfo.CreateNoWindow = true;
      proc.StartInfo.FileName = Properties.Settings.Default.RenamedHlpViewer;
      List<string> arguments = new List<string>();
      foreach (string s in args)
      {

        if (s == Properties.Settings.Default.OriginalLocale)
        {
          arguments.Add(Properties.Settings.Default.TargetLocale);
        }
        else
        {
          arguments.Add(s);
        }
      }

      proc.StartInfo.Arguments = String.Join(" ", arguments);
      m_logger.Info("Dispatching with " + proc.StartInfo.Arguments);
      proc.Start();
      proc.Dispose();
      m_logger.Info("Exit");
    }
    private static void LogSettings(string[] args)
    {
      m_logger.Info("Starting with " + string.Join(" ", args));
      m_logger.Info("Settings:");
      m_logger.Info("OriginalLocale:" + Properties.Settings.Default.OriginalLocale);
      m_logger.Info("TargetLocale:" + Properties.Settings.Default.TargetLocale);
      m_logger.Info("RenamedHlpViewer:" + Properties.Settings.Default.RenamedHlpViewer);
    }
  }
}  

Using the Source

Compile to Debug or Release.

Rename original 'HlpViewer.exe' to 'HlpViewer2.exe' and copy of project 'HlpViewer.exe', 'HlpViewer.exe.config', 'NLog.config', 'NLog.dll' in 'C:\Program Files (x86)\Microsoft Help Viewer\v2.0" for MS VS 2012 or 'C:\Program Files (x86)\Microsoft Help Viewer\v2.1' for MS VS 2013 or 'C:\Program Files (x86)\Microsoft Help Viewer\v2.2' for MS VS 2015 directory.

Edit config for change settings:

XML
 <userSettings>
    <VSHelpViewer.Properties.Settings>
        <setting name="TargetLocale" serializeAs="String">
            <value>ru-RU</value>
        </setting>
        <setting name="RenamedHlpViewer" serializeAs="String">
            <value>HlpViewer2.exe</value>
        </setting>
        <setting name="HlpViewerFolder" serializeAs="String">
            <value>C:\Program Files (x86)\Microsoft Help Viewer\v2.2</value>
        </setting>
        <setting name="OriginalLocale" serializeAs="String">
            <value>en-US</value>
        </setting>
    </VSHelpViewer.Properties.Settings>
</userSettings>

That's all!

Now when you press F1 on line with code you get localized Help. If you ask help which has no translation of your language, try to set checked "English content in all navigation tabs and F1 requests" check box and you get English help or set 'TargetLocale' property in the necessary language.

History

  • 1.0 Init version article
  • 1.1 Change code, add source project and binaries for VS 2015

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
SuggestionUser-script solution Pin
Yves Goergen1-Feb-15 2:05
Yves Goergen1-Feb-15 2:05 
GeneralRe: User-script solution Pin
Konstantin Samsonov7-Aug-16 1:25
Konstantin Samsonov7-Aug-16 1:25 
QuestionCan I use VS 2012 Help file on VS 2010 installed System ? Pin
Member 777731419-Aug-14 6:21
Member 777731419-Aug-14 6:21 
AnswerRe: Can I use VS 2012 Help file on VS 2010 installed System ? Pin
Konstantin Samsonov7-Aug-16 1:28
Konstantin Samsonov7-Aug-16 1:28 
Bugdoesn't working in VS2013 (update1) Pin
Рустем Кулисов28-Apr-14 3:07
Рустем Кулисов28-Apr-14 3:07 
GeneralRe: doesn't working in VS2013 (update1) Pin
Konstantin Samsonov17-May-14 3:13
Konstantin Samsonov17-May-14 3:13 
GeneralRe: doesn't working in VS2013 (update1) Pin
Рустем Кулисов19-May-14 0:30
Рустем Кулисов19-May-14 0:30 
GeneralRe: doesn't working in VS2013 (update1) Pin
Konstantin Samsonov7-Aug-16 1:20
Konstantin Samsonov7-Aug-16 1:20 
This not worked for online help only for downloaded help, change your settings
Help-Set Help Preferences-Launch in Help Viewer

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.