Type | Function block |
Description | The function block searches for a localized (translated) string, based on a string identifier and a language code. The translation is read from the specified 'Resources' table and, if found, written to the WSTRING variable connected to the LOCALIZED_STRING output.
With a rising edge at the REQ input, the specified localized string is searched. The BUSY output is set to TRUE while the search is running. If the function block has finished the execution and the localized string has been successfully found, the DONE output is set to TRUE and the localized string is applied at the LOCALIZED_STRING output. The ERROR output indicates whether an error occurred while executing the function block. The STATUS output indicates details on the execution and, if applicable, the reason for an occurred error. |
Notes | Function blocks of this type have to be instantiated. The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used. The instance name must be unique within the POU. |
Parameters | Inputs
REQ
Data type: | BOOL |
Description: | The function block is triggered for execution with a rising edge (TRUE). The execution continues even if REQ is cleared (reset to FALSE) before the completion of the operation.
Note
Resetting REQ to FALSE clears the BUSY, DONE, and ERROR outputs. Only reset REQ (in preparation for a new execution) after the completion of the current execution. The completion of the current execution is indicated by either the DONE or ERROR output. |
|
LANG_CODE
Data type: | ANY_STRING |
Description: | Language code, as defined in the 'Extras > Options' dialog under the 'International | Default Language Settings' category. Typically (but not mandatory) it will comply with the tags defined by RFC5646. |
STRING_NAME
Data type: | ANY_STRING |
Description: | Unique identifier of the localized string composed of the POU name, the section name within the 'Resources' table and the string 'Name', each separated by a dot: POUname.TableSection.NameValue Note that the 'Resources' editor of a POU only contains variables with activated 'Translate' checkbox in the relating 'Variables' table. |
Outputs
DONE
Data type: | BOOL |
Description: | Set to TRUE after the function block has finished the execution successfully. |
BUSY
Data type: | BOOL |
Description: | Set to TRUE while the function block is executed. |
ERROR
Data type: | BOOL |
Description: |
-
FALSE: Function block execution has been completed without an error.
As a result, STATUS contains one of the values 0x0000, 0x0001, or 0x0002 and LOCALIZED_STRING contains a valid string.
-
TRUE: Function block execution has failed.
As a result, STATUS contains one of the values 0x000B, or 0x000C and LOCALIZED_STRING is empty.
|
STATUS
Data type: | WORD |
Description: | Status code of the FB. Evaluate this output, in particular if ERROR = TRUE. The STATUS values are describe below. |
LOCALIZED_STRING
Data type: | WSTRING |
Description: | The localized string read from the respective 'Resources' table, if found. |
|
Status codes
| STATUS values
Status code (hex) | Meaning |
0x0000 | No error. The localized string has been found and applies at the LOCALIZED_STRING output. |
0x0001 | Instead of the requested language (specified by LANG_CODE), the default language applies at the LOCALIZED_STRING output. |
0x0002 | The found localized string has been truncated to 1024 characters (translation was longer). |
0x000B | The string could not be found neither in the default language nor in the requested target language (LANG_CODE). No value applies at the LOCALIZED_STRING output. |
0x000C | STRING_NAME undefined in the PLCnext Engineer project for LANG_CODE, or the default language. |
0x0011 | Underlying service temporarily unavailable. |
0x0014 | The variable connected to the LANG_CODE input has an unexpected type. |
0x0015 | The variable connected to the STRING_NAME input has an unexpected type. |
|