This project has moved and is read-only. For the latest updates, please go here.

Query Help File Language in BuildComponent

Topics: Developer Forum
Mar 27, 2014 at 11:30 AM
is it possible to get the value of the Help File Language property from the project when in a custom BuildComponent?
I'm writing a BuildComponent that filters inline comments given in multiple languages for the desired one.
Mar 27, 2014 at 4:59 PM
Add a configuration element to your component such as the following:
    <locale value="{@Locale}" />
The replacement tag will get changed to the project language when built.

Mar 28, 2014 at 8:53 AM
Edited Mar 28, 2014 at 8:53 AM
Thanks for your quick response.
I'll try that.
Mar 28, 2014 at 10:06 AM
Tried it. Works great!

I can now switch the language in the SHFB project and my component filters the correct language specific comments out.
        /// <summary>
        /// Changes the visibility rules of zoom dependent elements.
        /// The value null activates automatic zoom (default), other values set
        /// the viewport size in km, that defines the visibility of elements.
        /// </summary>
        /// <summary xml:lang="de">
        /// Ändert die Sichtbarkeitsregeln der zoomabhängig angezeigten Kartenelemente.
        /// Der Wert null aktiviert die Zoomautomatik (Default), andere Werte setzen
        /// die äquivalente Fensterausdehnung in km, die die Sichtbarkeit der Elemente festlegt.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Thrown when a negative value is set.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException" xml:lang="de">
        /// Setzen eines negativen Werts wirft eine ArgumentOutOfRangeException.
        /// </exception>
        /// <example>
        /// The value 5 means: Show all elements independent of current viewport size as if
        /// the viewport were max. 5 km wide or high.
        /// </example>
        /// <example xml:lang="de">
        /// 5 bedeutet z.B.: Zeige die Elemente unabhängig von der tatsächlichen
        /// Fensterausdehnung so an, als wenn das Fenster maximal 5 km breit bzw. hoch wäre.
        /// </example>
However I have one suggestion. The project should differentiate the metadata (e.g. namespace descriptions or header/footer texts) by language. I have to copy the project file for each language now and this is error prone.

Thanks again,
Mar 28, 2014 at 4:05 PM
Edited Mar 28, 2014 at 4:08 PM
You can manage the project and namespace comments in a standalone XML comments file. See this help topic as the process is similar:

A plug-in could be created to manage the other project properties such as the header and footer text. It would then update the resource item file in the working folder at build time with the items for the appropriate language.

Apr 2, 2014 at 9:07 AM
Thanks a lot.
I was able to solve most of my issues with the comments file.