Skip to main content

Rigi Documentation

Advanced editing

Warning

This is only for experts. Editing the files in an editor might corrupt the structure.

Always make a backup before you start editing.

The Solution Editor tool helps users define a Rigi solution and its projects. It does not support all editing features in the user interface (yet).

Under the hood, the editor creates a Rigi Solution file (.rigsln and .rigproj). You can edit these files in a text editor such as Notepad++. For details, see the Rigi Solution file (.rigsln and .rigproj) section.

Mapping of variables in target rules

A target rule in a project specifies variables that are resolved when the target file location and name are needed.

For example, variable $(targetLocaleUnderscore) is resolved as it_IT for locale Italian (Italy).

There can be exceptions when the developers do not follow the standard rules.

Definition

Use the mappings element in the .rigproj file to override the default behavior.

  • The mappings element is the root element. It has a mapping element with the following characteristics.

    • Attributes:

      • id. The ID of the mapping rule.

      • var. This specifies the variable to which the mapping applies.

    • The map element defines map elements. Each map element has the following attributes:

      • iso. The ISO language/locale. For example, de-DE, it-IT, en-US, en-UK, en, de, nl.

      • value. The replacement for that specific locale.

      • remove. Defines the number of characters that must be removed before and after the replacement. Examples:

        • -1: removes one character before the match.

        • -2: removes two characters before the match

        • 1: removes one character before the match.

        • 2: removes one character before the match.

        • -1,2: removes one character before and two after the match.

  • Targetrule elements have an optional mapping attribute. That mapping attribute contains a comma-separated list of the mapping IDs.

Example 24.

Assume that we have a project with 20 languages. For two variables, there are exceptions for it-IT and en-US.

  • Exception 1: variable $(targetLocaleUnderscore).

    • for Italian (Italy), it must be resolved as ita_ITA.

    • for English (United States), nothing shall be written, and the preceding underscore must be removed. This is typically the case when the source files must be overwritten.

  • Exception 2: variable $(sourceFileNameNoExt). Normally, this is the name of the source file without the extension. E.g., "messages" if the filename is "messages.properties".

    • for Italian (Italy), it must be resolved as "ItalianMessages" instead of "messages."

The project file for this example is:

<?xml version="1.0" encoding="utf-8"?>
<project name="Test" relbasepath=".">
  <parsersettings />
  <targetrules>
    <targetrule id="TR"
 mapping="map1,map2">targets\$(sourceFileNameNoExt)_$(targetLocaleUnderscore).properties</targetrule>
  </targetrules>
  <mappings>
    <mapping id="map1" var="targetLocaleUnderscore">
      <map iso="it-IT" value="ita_ITA" />
      <map iso="en-US" value="" remove="-1" />
    </mapping>
    <mapping id="map2" var="sourceFileNameNoExt">
      <map iso="it-IT" value="ItalianMessages" />
    </mapping>
  </mappings>
  <resources>
    <file relpath="source\messages.properties" guid="MSG" parser="properties" targetrule="TR" />
  </resources>
</project>

For example, the resolved variables for the following ISO codes are:

  • it-IT: targets\ItalianMessages_ita_ITA.properties

  • en-US: targets\messages.properties

  • de-DE: targets\messages.de_DE.properties