Special Translation Processes:

Special translation processes are performed during the translation of contents from a source language into a target language using one of the translation services configured in the KMFasTrans options.

Frequently there are some sequences of characters in the source text of the translation that are not intended to be translated directly into the target language because they represent a content with special meaning. This is the case of strings that are analyzed by plugins that act according to the content found, such as the string {loadmoduleid xx} to insert the module whose id is xx. If 'loadmoduleid' were translated into another language, the plugin would not recognize the string and therefore would not insert the module.

Following with this example, the value xx will probably be different for the different languages, so in this case it is not only necessary to keep the string 'lodmodule' untranslated, but also to change the value xx to the id of the module that is the translation of the module with id xx. Naturally this requires that there is a translation, known by KMFasTrans, of the module whose id is xx to the target language. This will always be true if the module whose id is xx has been translated with KMFasTrans before translating the article containing the string.

To achieve this functionality, these special translation processes have been designed. Each process is represented by a rule to which some parameters are supplied. Each rule can use a subset of the total. The subset of parameters used by a rule is displayed when selecting the rule in the 'Rule' drop-down.

To identify the process to be performed, both the rule and its parameters must be enclosed between tags. The tags to which the process is applied are selected in the 'Applies to' parameter. The tags themselves are configured in the 'Translations Tags' screen.

Access to the list screen of the special translation processes is done through the 'Special Translation Processes' link from any of the KMFasTrans screens. By clicking on this link you get this screen:

The special translation processes seen in the image, except for the R3, R3A and R3B rules, are created in the installation process. Except 'Preserving text...' the rest are created in disabled state. To use them you just have to enable them.

The columns represent the fields of each special process. Some fields are applicable and others are not applicable depending on the chosen rule. In the list above, empty columns indicate fields that are not applicable.

Rules 3, 3A and 3B require to supply a text for each language. The editing screen for these rules (a Rule 3B in this example) is as folllow:

General tab:

Replacements by language tab:

The following describes the currently available rules and their parameters.

Rule 1. Preserving text (do not translate) between { }

Rule 1 performs a process that consists in preserving, without translation, all the characters contained between the opening tag and the closing tag for any pair of configured tags in the 'Aplies to' parameter.

Example:

Rule 1 is the default rule. It will apply whenever no other applicable rule is found for the string under treatment. The other rules have preference over Rule 1. It is advisable to have Rule 1 enabled.

Rule 2. Partial translation.

The string set in the 'Trigger' parameter will be preserved without translation and the rest of the content between the tags to which this rule applies will be translated into the target language.

Example:

Parameters set on the General tab: (The trigger can not contain spaces)

  • Trigger: tab=
  • Applies to: 'Curly brackets' . We are assumning that 'Curly brackets' is configured as a pair of tags and the tags are { and }

Process performed: Whenever the string is found in the source text, this string will be replaced by the string in the text translated into the target language, where yyy yyy is the translation of xxx xxx into the target language.

If the text is omitted, the result is the same as that of Rule 1 only for the trigger, that is, the trigger will be retained in the target language text. This can be useful if you do not want to apply Rule 1, which preserves any text between tags but you want to preserve only a particular text between tags (the trigger).

Rule 3. Replace content between tags in the source text with specific content for each target language.

The replacement affects all content between the configured pair of tags for this process.

Example:

Parameters set on the General tab:

  • Applies to: 'Gallery' . We are assumming that Gallery is configured as a pair of tags and the tags are  and

Parameters set on the Replacements by Language tab:

  • English: some text in English
  • Spanish: some text in Spanish

Process performed: If the source language is English, whenever the string some text in Englishis found in the English text, this string will be replaced in the text translated into Spanish by the string some text in Spanish.

Warning: If you configure this rule for the same tags as Rule 1, as this one takes precedence over Rule 1, Rule 1 will never apply and whenever any content between these tags is found, this rule will apply. Normally you will have set Rule 1 for tags { } and Rule 3 for other more specific tags.

Rule 3A. Replace content between tags (except Trigger parameter) in the source language with specific content for each target language, when the trigger is found.

The replacement affects all content between the opening and closing tags except the content of the 'Trigger' parameter. The process will only take place when the text entered in the 'Trigger' parameter is found.

Example:

 

Parameters set on the General tab: (The trigger can not contain spaces)

  • Trigger: trigger1
  • Applies to: 'Curly brackets' . We are assumning that 'Curly brackets' is configured as a pair of tags and the tags are { and }

Parameters set on the Replacements by Language tab:

  • English: some_dir/some_english_file.php
  • Spanish: some_dir/some_spanish_file.php

Process performed:

Let's assume that:

  • The source language is English
  • The target language is Spanish

Then: whenever the string is found in the English text, this string will be replaced by the string in the text translated into Spanish language.

Rule 3B. Replace content between delimiters inside tags in the source language with specific content for each target language, when the trigger is found.

The replacement affects all content between the opening delimiter and the closing delimiter between tags. The process will only take place when the text entered in the 'Trigger' parameter is found.

Example:

Parameters set on the General tab: (The trigger can not contain spaces)

  • Trigger: jumi (this is an example, it may be any string)
  • Applies to: 'Curly brackets' . We are assumning that 'Curly brackets' is configured as a pair of tags and the tags are { and }
  • Opening delimiter: [
  • Closing delimiter: ]

Parameters set on the Replacements by Language tab:

  • English: some_dir/some_english_file.php
  • Spanish: some_dir/some_spanish_file.php

Process performed:

Let's assume that:

  • 'trigger' be jumi
  • The source language is English
  • The target language is Spanish

Then: whenever the string is found in the English text, this string will be replaced by the string in the text translated into Spanish language.

Rule 4. Replace an id between tags in the text of the source language with the id translation into the target language.

In this rule the Trigger is mandatory. The id is in the string between the configured tags except the trigger.

For this process to work properly, there must be a module in the target language associated in KMFasTrans with the module in the source language. This will always be true if the target language module was created using KMFasTrans as a translation of the source language module before translating the article containing the string. If no module is found in the target language associated in KMFasTrans with the module in the source language, the same existing xx in the source language will be preserved in the target language.

Example:

Parameters set on the General tab: (The trigger can not contain spaces)

  • Trigger: loadmoduleid
  • Applies to: 'Curly brackets' . We are assumning that 'Curly brackets' is configured as a pair of tags and the tags are { and }
  • Component: Modules

Process performed:

Let's assume that:

  • The source language is English and the target language is Spanish
  • 'xx' is the id of the module in English
  • 'yy' is the id of the module that is associated with the module with id xx in KMFasTrans, that is, the module with id yy is the Spanish translation of the module with id xx.

Then: whenever the string {loadmoduleid xx} is found in the English text, this string will be replaced by the string {loadmoduleid yy} in the text translated into Spanish.

Below are processes that use the R4 rule for customizable fields and field groups:

Rule 4A. Replace an id between delimiters in the text of the source language with the id translation into the target language.

In this rule the Trigger is mandatory. The id is the string between delimiters.

For this process to work properly, there must be a module in the target language associated in KMFasTrans with the module in the source language. This will always be true if the target language module was created using KMFasTrans as a translation of the source language module before translating the article containing the string. If no module is found in the target language associated in KMFasTrans with the module in the source language, the same existing xx in the source language will be preserved in the target language.

Example:

Parameters set on the General tab: (The trigger can not contain spaces)

  • Trigger: module
  • Applies to: 'Curly brackets' . We are assumning that 'Curly brackets' is configured as a pair of tags and the tags are { and }
  • Opening delimiter: [
  • Closing delimiter: ]
  • Component: Modules

Process performed:

Let's assume that:

  • The source language is English and the target language is Spanish
  • 'xx' is the id of the module in English
  • 'yy' is the id of the module that is associated with the module with id xx in KMFasTrans, that is, the module with id yy is the Spanish translation of the module with id xx.

Then: whenever the string {module [xx]} is found in the English text, this string will be replaced by the string {module [yy]} in the text translated into Spanish.

Below is a process that uses rule R4A for customizable fields:

Rule 5. Special for modules. Replace the title xxx of a module in the source language, by the corresponding title in the target language.

For this process to work properly, there must be a module in the target language associated in KMFasTrans with the module in the source language. This will always be true if the target language module was created using KMFasTrans as a translation of the source language module before translating the article containing the string. If no module is found in the target language associated in KMFasTrans with the module in the source language, the same existing title xx in the source language will be preserved in the target language.

This rule must be configured in the following way:

Example

Parameters set on the General tab: (The trigger can not contain spaces)

  • Trigger: loadmodule
  • Applies to: 'Curly brackets' . We are assumning that 'Curly brackets' is configured as a pair of tags and the tags are { and }
  • Component: Modules

Process performed:

Let's assume that:

  • 'trigger' is loadmodule
  • 'type' is the module type
  • 'source_title' is the module title in the source language
  • style is the module style (which is optional)
  • 'target_title' is the title of the module that is associated with the module with title 'source_title' in KMFasTrans, that is, the module with title 'target_title' is the Spanish translation of the module with title 'source_title'.

Then: whenever the string , is found in the text in the source language, this string will be replaced by the string  in the text translated into the target language. 

Rule 7. Translation of the value of the 'title' attribute in HTML tags.

Special translation processes that use this rule will automatically translate the value of the 'title' attribute of the tags to which the process applies. In the image you can see a translation process that will translate the value of the 'title' attribute of the <a and <hr tags.

The case of the <hr tag is important because when it is used to create a Table of Contents in an article, this special translation process translates the links in the Table of Contents.