Official Content

Lists the exceptions that must not be translated.

Scope

Level: Environment

Description

When using GeneXus Application Localization, there may be many string constants in an application that must not be translated. They can be marked as not translatable by preceding each one with the "!" (bang) sign. Doing so one at a time is usually an error-prone and time-consuming task.

In many situations, you will notice that untranslatable strings share certain patterns (Regular Expressions (RegEx)). To name a few untranslatable string constant patterns:

  • String constants holding HTML (or XML) code usually start with a "<" and end with a ">" sign.
  • Numeric constants only have numbers, a decimal separator, and an optional sign.
  • String constants holding a single character are usually codes.

This property is intended as a "development time saver" holding a list of regular expressions. If a string constant matches any of these expressions, it is considered as if it were preceded by a “!” symbol (i.e. not translatable).

It will be considered when the value of the Translation type property is Run-time or Static.

Examples are: HTML code, SQL Statements (using the standard create/update/delete/insert keywords), strings representing numbers, underlining, etc. Regular expression syntax is described below (it is a partial list of the default regular expressions):

[- ]?\d \.?\d* Strings representing numbers
[ \t\-_=x\*] Underlining
#[0123456789ABCDEF]{6} HTML color
.*javascript.* Javascript code
<.*> XML or HTML code

GeneXus incorporates a list of default values displayed in the property. They can be deleted and changed, and new ones can be entered using the associated editor.

Translation Exceptions Property Example

The Add, Delete, and Edit buttons will allow you to add, delete and change an exception. Case sensitivity can be changed with the Toggle Case button to determine the interpretation of uppercase and lowercase characters.

To enter or edit an exception, read the document Regular Expressions (RegEx) that explains the rules for writing exceptions.

Translating untranslatable string constants

Having, for example, “<.*>” as a Translation Exception so that HTML (or XML) tags are not translatable will make the string constant “<Enter>” to be considered untranslatable too. To translate the constant, follow one of the alternatives below:

  • Replace the constant with:

format(“<%1>”, “Enter”)

Note that here the “Enter” constant is to be translated but not the “<%1>” constant.

  • Delete the Translation Exception and in the code look for all the constants starting with “<” and ending with “>” to add a “!” symbol in front of them.

Considerations

Since GeneXus 17 upgrade 4 the following exceptions were removed:

create[[:blank:]]+.*
delete[[:blank:]]+.*[[:blank:]]+from[[:blank:]]+.*
insert[[:blank:]]+into[[:blank:]]+.*
select[[:blank:]]+ .*[[:blank:]]+from[[:blank:]]+.*
truncate[[:blank:]]+table[[:blank:]]+.*
update[[:blank:]]+.*[[:blank:]]+set[[:blank:]]+.*

 

Runtime/Design time

This property applies only at design-time.

How to apply changes

To apply the corresponding changes when the property value is configured, execute a Rebuild All.

See Also

Translation type property
Translate to language property
Regular Expressions (RegEx)

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant