Translating the messages of the generated Web Help to another language

Let's suppose you want to translate the messages of the generated Web Help (tab labels, button tool tips, etc) to Portuguese (language code: pt-PT, or —recommended— more generic pt).

  1. Edit whc_install_dir/whc_template/_wh/NNmessages.js. The encoding used for file NNmessages.js is UTF-8.
  2. The messages to be translated are listed at the top of NNmessages.js:
    var messages = [
        "Contents",
        "Index",
        ...
    ];

    The translations are found in the messageTranslations JavaScript object. In this object, a property name specifies the target language and the corresponding property value specifies the list of translated messages.

    Add your translation as a new property of messageTranslations.

    var messageTranslations = {
    ...
    "pt": [
        "Sumário",
        "Índice",
        ...
        
    ]
    
    };
  3. Important: make sure to use the UTF-8 encoding when saving back to disk modified NNmessages.js.
  4. Use whc to generate a new Web Help.
  5. Use this Web Help to test your translation in a Web browser where pt-PT, pt-BR, etc, is the language preferred by the user for the user interface of the browser and/or to display Web pages. (This setting is often found in the user preferences of the Web browser.)