Configure target rules
Target rules define the file path of the target files based on the file path of the source file. They are used to:
generate target files.
read translations from target resource files (alignment).
In the project menu, select Workspace > Rules.
To create a target rule from scratch, click the New target rule button in the top right-hand corner.
To edit an existing rule, hover over it and click the
icon. The rule editor popup will be displayed.
Configure the target rule.
The resulting target rule will be displayed at the bottom of the popup.
Enter or (optional) change the rule Name.
From the Locales dropdown, select the locale for testing the target rule.
In the Source file path field, enter the source file path to test the target rule.
Click the
icon to select file paths from the current workspace instead of configuring them manually.
Create your target rule by dragging and dropping variables into the Target rule field.
Variables and their current values are based on the locale and source file path. Variables that are resolved to an empty string are marked dark gray.
To find more about variables, see the Target rule variables overview section below.
Click the
icon to change the default target rule by selecting another parser.
To create a new variable, perform the following steps:
Click the
icon in the Target rule field.
In the Create new variable popup, enter its value.
Click the Create button. The new variable will be displayed at the end of the target rule.
Drag and drop it to the required position.
Check the resulting file path at the bottom of the popup.
The
icon means the target file is available in the workspace. This information can be useful when planning an alignment.
The
icon means the target file is not available in the workspace.
Click the Save or Create button.
Rigi supports the following variables:
Variable | Description | Examples |
---|---|---|
SourceFileName | Source file name with extension. | sub1/sub2/sub3/sub4/file.json → file.json |
SourceFileNameNoExt | Source file name without extension. | sub1/sub2/sub3/sub4/file.json → file |
SourceFileNameNoExtNoLocale | Source file name without extension. If the last part of the file name is a language code, removes that, too. | sub1/sub2/sub3/sub4/file.en-US.json→ file |
SourceFileNameNoExtNoPostfix | sub1/sub2/A.B.default.json → A.B.json | |
SourceFileNameNoExtNoPostfixNoLocale | sub1/sub2/A.B_en-US.default.json → A.B.json sub1/sub2/A.B_en-US.default.json → A.B.json | |
SourceFileExt | File extension, including the dot. | sub1/sub2/sub3/sub4/file.json→ .json |
SourceFilePath | Folder to the file. | sub1/sub2/sub3/sub4/file.json→ sub1/sub2/sub3/sub4 |
SourceFilePath1 | Folder to the file without the folder at the first level (root). | sub1/sub2/sub3/sub4/file.json → sub2/sub3/sub4 |
SourceFilePath2 | Folder to the file without the folder at the first level (root) and the second level. | sub1/sub2/sub3/sub4/file.json → sub3/sub4 |
SourceFilePathTargetLocale | Folder in which each source locale name is replaced with the target locale names. The generated target locale name will use the same casing and separator as the source locale name. If the casing is not regular, the default casing (e.g., de-DE) will be used. | sub1/en-US/sub3/en-US/file.json → sub1/de-DE/sub3/de-DE sub1/en-us/sub3/en-US/file.json → sub1/de-de/sub3/de-DE sub1/en_US/sub3/sub4/file.json → sub1/de_DE/sub3/sub4 sub1/en_us/sub3/sub4/file.json → sub1/de_de/sub3/sub4 sub1/En-uS/sub3/sub4/file.json → sub1/de-DE/sub3/sub4 sub1/En_uS/sub3/sub4/file.json → sub1/de_DE/sub3/sub4 |
SourceFilePathTargetLocale1 | Similar to SourceFilePathTargetLocale. This variable also replaces locales that are part of a subfolder. | sub1/XXen-USYY/sub3/en-US/file.json → sub1/XXde-DEYY/sub3/de-DE sub1/XXen-usYY/sub3/en-US/file.json → sub1/XXde-deYY/sub3/de-DE sub1/XXen_USYY/sub3/sub4/file.json → sub1/XXde_DEYY/sub3/sub4 sub1/XXen_usYY/sub3/sub4/file.json → sub1/XXde_deYY/sub3/sub4 sub1/XXEn-uSYY/sub3/sub4/file.json → sub1/XXde-DEYY/sub3/sub4 sub1/XXEn_uSYY/sub3/sub4/file.json → sub1/XXde_DEYY/sub3/sub4 |
TargetLocale | Target language name code. | cs-CZ en-US de-DE |
TargetLocale1 | cs-CZ → cs de → DE | |
TargetLocale2 | The second part of the language name code. This is the region. | cs-CZ → CZ de → empty |
TargetLocale2Lowercase | The second part of the language name code. This is the region in lowercase. | cs-CZ → cz de → empty |
TargetLocaleLANG | Target language name code, where the language is in uppercase if there is no region. | pt-BR → pt-BR pt → PT |
TargetLocale1Uppercase | The first part of the language name code (uppercase). This is the language. | cs-CZ → CS de → DE |
TargetLocaleLCID | Language code. | cs-CZ → 1029 |
TargetLocaleUnderscore | Replaces the - in the locale with an underscore. | cs-CZ → cs_CZ de → de |
TargetLocaleUnderscoreLowercase | Replaces the - in the locale with an underscore and returns the result in lowercase. | cs-CZ → cs_cz de → de |
TargetLocaleUnderscoreLANG | Target language name code, where the language is uppercase if there is no region. Use underscore as a separator. | pt-BR → pt_BR pt → PT |
TargetLocaleLowercase | Language name code in lowercase. | cs-CZ → cs-cz |
TargetLocaleName | Fully written country and region in English. | cs-CZ → Czech (Czech Republic) |
TargetLocaleLang | Fully written language in English. | cs-CZ → Czech |
TargetLocaleLang2 | Extracts the specific language variant or dialect from the full locale description. | Norwegian, Bokmal (Norway) → Bokmal |
TargetLocaleCountry | cs-CZ→ Czech Republic | |
TargetLocaleCountryPre | Splits the English string into its components. | L1, L2 (C1, country) C3 → C1 |
TargetLocaleCountryPost | Splits the English string into its components. | L1, L2 (C1, country) CPOST → CPOST |