process-mining
2021.10
true
Process Mining
Automation CloudAutomation Cloud Public SectorAutomation SuiteStandalone
Last updated Sep 2, 2024

Preparing your app for translation

Introduction

To make sure that all visible text is translatable, you must update your application and mark these text strings for translation. You use the translate() function for any text in expressions that end users will see such as labels, info texts, and dashboard-item display names, as well as some expression functions.
From the UiPath Process Mining platform you can automatically generate a translatable file with a list of all display names of visible attributes, metrics, selectors, etc., as well as all texts used in the translate() function.

Guidelines for using the Translate() function

For expressions you need to add translate calls around strings that you want to be translatable. Using this on a string will cause it to be marked for translation. In order to have a maintainable translatable app, follow the guidelines described below.

Guideline 1 Never Use Translated Strings for Logic

To prevent errors that are locale dependent as well as to reduce performance impact of translations, translated strings should never be used for logic, only for displaying. For example:

  • Put the translate call as close to ‘displaying’ as possible which is in the dashboard itself.
  • Do not compare with a translated string inside of an if.

    Note:

    Aside from the translate function, there also exist other functions returning translated strings:

    applicationname,
    dashboarditemname,
    levelattributename,
    dashboardpath;
    displayname,
    selectedlabels (use selecteduids for logic instead).

    Use these functions only for displaying translated text. Do not use them in application logic, as that could lead to unwanted side effects.

    The overlayname function does not return translated text, it only returns the internal name. Only use this function in the logic of your expression, do not present this to end-users.

Naming convention

Be careful with translating constant string expression table items that may be used for logic. For maintainability, it is recommended to have a naming convention indicating the type of string in the constant. (For example, AppOne uses const_tr_ as a prefix for translated constants, and const_internal_ for logic constants).

Guideline 2 Always translate entire sentences and use variables to add values

Translating entire sentences such as ({{records}} of {{total}}) instead of small parts of a sentence will help translators in several ways:
  • The names of the variables will give information about context;
  • Using variables in a string allows the translators to change the order, which is required for certain languages (e.g. in Japanese 2 out of 6 is translated into 6のうち2)

Example: Display a string containing metrics and constant text. Use:

<code>translate(
    "({{records}} of {{total}})", 
    "records", displaytext(metric(Metric_case_count, filter(records, activeperiodfilter))),
    "total", displaytext(any(records).Number_of_filtered_cases_current_period)
)</code><code>translate(
    "({{records}} of {{total}})", 
    "records", displaytext(metric(Metric_case_count, filter(records, activeperiodfilter))),
    "total", displaytext(any(records).Number_of_filtered_cases_current_period)
)</code>

Instead of:

<code>"(" + 
    displaytext(metric(Metric_case_count, filter(records, activeperiodfilter))) + 
    translate(" of ") + 
    displaytext(any(records).Number_of_filtered_cases_current_period) + 
")"</code><code>"(" + 
    displaytext(metric(Metric_case_count, filter(records, activeperiodfilter))) + 
    translate(" of ") + 
    displaytext(any(records).Number_of_filtered_cases_current_period) + 
")"</code>

Known limitations

  • sizemethod and aggregatedsizemethod: These functions always return English text, except for the attribute’s name, which is translated.
  • data values are not translated.

    • Strings like Open/Closed filter must be implemented comparing translated values, which is an exception to the general guideline, and will cause favorites to only work correctly when opened in the same language. If opened in a different language the message “filter value not found” will be presented to the user. This exception also applies to the Variant attribute, since it is derived from the data.
    • value function;
    • displaytext function.
  • Values expression for filters.

    • Use a selector instead of a values expression, possibly with artificial created (global) attributes for the selector options.
  • The displayname function only marks an attribute’s display name for translation when using the following construct (Here attribute_name must be a direct reference to an attribute.)

    displayname(uid(attribute_name))

    It will also return the correctly translated string if the attribute is marked for translation in another way. (automatic or otherwise).

  • Introduction
  • Guidelines for using the Translate() function
  • Guideline 1 Never Use Translated Strings for Logic
  • Known limitations

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.