Placeholders, code strings, variables and plural tokens
Placeholders, code strings, variables and plural tokens
The segments that you will translate will include generic words as well as code elements and tags that inject formatting and variable data into the text. It is important that you ALWAYS have full tags displayed.
How to display full tags in Phrase
In all Tableau tasks, it's important to understand what the tags/placeholders represent. To be able to do that, always make sure that the tags are fully visible.
To view the full tags in Phrase (for UI tasks), please go to Three line menu in the upper left corner in Editor → Edit → Tags → and Expand Tags must be toggled on. Alternatively, use shortcut Ctrl+Shift+E.
How to display full tags in Trados Studio
To see full tags in Trados Studio (for UA tasks), go to View menu in the main toolbar in Editor and select Full tag text option.
Placeholders
Placeholders are typically used to:
• Introduce formatting (such as bold or italics).
• Represent hyperlinks and clickable/active elements.
Placeholders come in pairs and they enclose certain part of text. The placeholders within the pair are not interchangeable.
Examples:
❗Important notes
Make sure that you know the meaning of the placeholders in the translated text. Display the full placeholder in the editor and read the keyword. If in doubt, please contact the LA/PM.
Put placeholders in the correct order and in the correct place in the translation.
It is possible to change the position of a pair of placeholders within the target string.
It is not possible to change the order of placeholders within the pair in the target. They must be situated around the corresponding translation of the source word(s).
Usually, it is not possible to remove placeholders from the target. Do not remove them, unless they are incorrect for linguistic reasons, and their removal has been consulted with the LA/PM.
Code strings
Strings in this category are usually left in English:
StudlyCaps, also known as camelCase - words that have been glued together with one or more capitals in the middle. These are parts of the code and should stay untranslated. Example: SchemaRef contentType
Words or strings containing underscores "_" or dollar signs "$"
Examples:
Admin_user
table.c$CustomFieldName
parent_question_id.type
Variables
The variables are used to propagate variable (usually real-time) data into the strings. Different types of information can be represented by variables: full date, day, month, year, number, unit of measurement, first name, last name, company name, design/picture/file name, product name, pieces of code, etc.
When localizing strings containing variables, try to find out what will replace the variables. This is necessary for the sentence to be grammatically correct when the variable is replaced with a word or phrase. Note that the letters used in variables convey a specific meaning, see examples below:
%d, %ld, %u, and %lu means <number>
%c means <letter>
%s means <string>
Plural tokens
!Note! This section has a localized version in the Style Guides.
Plural tokens allow for more natural phrasing than constructions like "1 hour(s)". Plural tokens are used in strings that contain a number followed by a noun and allow authors to write one translatable string, and display different outputs at runtime: it can be “zero”, one (singular), two (dual), few (paucal), many, other.
English, German, Spanish, Italian, Dutch, Danish, Norwegian, Swedish, Finnish, and Greek distinguish one singular form and one plural form:
· I walked 1 kilometer
· I walked 1.5 kilometers
· I walked 0 kilometers
· I walked 10 kilometers
Also French and Portuguese have one singular and one plural form, but with differences from English:
French:
J’ai marché 1 kilomètre
J’ai marché 1,5 kilomètre
J’ai marché 0 kilomètre
J’ai marché 10 kilomètres
Portuguese:
Eu andei 1 quilômetro
Eu andei 1,5 quilômetro
Eu andei 0 quilômetro
Eu andei 10 quilômetros
Many Asian languages (for example, Japanese, Simplified Chinese, Traditional Chinese), Turkish and Hungarian use only one form of the noun, regardless of the preceding number.
Hungarian:
1 kilométert mentem
1,5 kilométert mentem
0 kilométert mentem
10 kilométert mentem
Other languages use one singular form and multiple plural forms - three, four or more different forms of the noun, depending on the number: Arabic, Croatian, Bosnian, Serbian, Czech, Slovak, Polish, Slovenian, Russian, Ukrainian, Arabic, Latvian, Lithuanian, …)
Slovak:
Prešiel som 1 kilometer.
Prešiel som 1,5 kilometra.
Prešiel som 0 kilometrov.
Prešiel som 3 kilometre.
Prešiel som 10 kilometrov.
How to translate plural tokens (cardinals)
❗Note: All the translatable parts will be in green for easier understanding.
Here is how strings with plural tokens look like in the translation kit. (The below examples follow the javascript pattern. Other programming language may differ.)
en-US: Due in {count, plural, one{# day} other {# days}}
or
en-US: “Update {XXXX_COUNT, number} {XXXX_COUNT, plural, one {key} other {keys}}”
XXXX represents item names, for example: PUBLISHED_ITEM_COUNT, ERROR_COUNT, ITEM_COUNT, KEY_COUNT, and others.
At runtime, 2 different strings will be generated:
• Update 1 key (if the variable KEY_COUNT equals to 1 – singular form)
• Update 3 keys (if the variable KEY_COUNT does not equal to singular form, the other option in this case)
In French: “Mettre à jour {KEY_COUNT, number} {KEY_COUNT, plural, one {clé} other {clés}}”
Runtime: Mettre à jour 1 clé
Runtime: Mettre à jour 3 clés
XXXX_COUNT is the token name: do not translate it
plural is the token type: do not translate it
one and other are selectors: do not translate them
number is the type for KeyCount: do not translate it
key and keys are the nouns that get combined with the number at runtime: do translate
Additional examples:
In this example, the token value is represented by #
en-US: You have {count, plural, one {# message} other {# messages}} in your inbox
At runtime, this message will display as:
You have 1 message in your inbox
You have 17 messages in your inbox
'count' is the token name. Do not translate it.
'plural' is the token type. Do not translate it.
'one' and 'other' are selectors. Do not translate them. Languages with multiple plurals need more selectors.
'#' represents the token value. At runtime, '#' is replaced by a number.
'message' and 'messages' are the nouns combined with the number at runtime. Do translate them.
In the following example, numeric selectors are used in addition to textual selectors like ‘one’ and ‘another’.
en-US: This application uses {count, plural, =0 {no authentication methods at all} one {one authentication method} =2 {a couple of authentication methods} =12 {a dozen authentication methods} other {# authentication methods}}
At runtime, this message will display as:
This application uses no authentication methods at all.
This application uses one authentication method.
This application uses a couple of authentication methods.
This application uses 4 authentication methods.
This application uses a dozen authentication methods.
This application uses 24 authentication methods.
❗Important!
Translators of languages that do not use the plural form for nouns combined with numbers can use the same noun form for both selectors – please raise a query in case of uncertainty.
Languages with multiple plurals need more selectors and more than 2 forms for plural – selectors to be provided by the client. Please contact your PM/LA if more selectors are needed for your language.
Gender and number concordance
English verb forms do not vary with the gender of the subject noun and some verb forms are identical for singular and plural.
English adjectives too do not vary with the gender of the noun and are identical for singular and plural.
Translating plural tokens can be challenging. However, to solve gender and number concordance issues, parts of the sentence can be moved inside the token.
Example – Adjective:
en-US: “Update {KEY_COUNT, number} public {KEY_COUNT, plural, one {key} other {keys}}”
Runtime: Update 1 public key
Runtime: Update 3 public keys
fr-FR: “Mettre à jour {KEY_COUNT, number} {KEY_COUNT, plural, one {clé publique} other {clés publiques}}”
Runtime: “Mettre à jour 1 clé publique
Runtime: “Mettre à jour 3 clés publiques”
In this example, not moving the adjective inside the token would generate a grammatically wrong sentence at runtime.
WRONG: “Mettre à jour {KEY_COUNT, number} {KEY_COUNT, plural, one {clé} other {clés}} publiques”
Runtime: Mettre à jour 1 clé publiques
Runtime: Mettre à jour 3 clés publiques
Example – Verb + Adjective:
en-US: “{KEY_COUNT, number} public {KEY_COUNT, plural, one {key} other {keys}} will be updated”
Runtime: 1 public key will be updated
Runtime 3 public keys will be updated
fr-FR: “{KEY_COUNT, number} {KEY_COUNT, plural, one {clé publique sera mise à jour} other {clés publiques seront mises à jour}}”
Runtime: 1 clé publique sera mise à jour
Runtime: 3 clés publiques seront mises à jour
Token value represented by #:
en-US: You don't have any expense reports in the past {NUM_MONTHS, plural, one {# month} other {# months}}.
Runtime:
You don't have any expense reports in the past 1 month.
You don't have any expense reports in the past 2 months.
it-IT: Non sono presenti note spese {NUM_MONTHS, plural, one {nell'ultimo mese} other {negli ultimi # mesi}}.
Negations
English can express negations by simply adding the word "no", without altering the sentence order. Other languages may need to change the sentence order or add more words. In those cases, you can move parts of the sentence inside the token.
How to translate plural tokens (ordinals)
English uses four different suffixes for ordinal numbers
· This is your 1st message.
· This is your 2nd message.
· This is your 3rd message.
· This is your 4th message.
Other languages may use fewer or more suffixes
Strings with ordinal tokens may look something like this:
en-US: This is your {position, selectordinal, one {#st} two {#nd} few {#rd} other {#th}} message.
If you find a token similar to selectordinal, please ask your PM/LA.
Here is a short video to show you how to display what will the string with plural token look like at runtime. Written instructions are below the video.
💡TIP - Display how a string will look at runtime
You can use an online ICU Message Editor to display how the English and translated sentences will look like at runtime.
Go to 🔗https://format-message.github.io/icu-message-format-for-translators/editor.html
To preview the source segment
Paste your string in the Message box.
In the KEY_COUNT number box (the name could change, based on the variable in the segment), click to display the up and down arrows. Click the up or down arrow to display your desired number.
The grey box displays how the string will look like at runtime.
To preview the translated segment
In the Message box, copy and paste the translated segment or translate the text in black in the English segment. Only translate the text in black. Review the previewed translated segment.
How to copy strings with tags from Phrase
Since it is not possible to copy strings from Phrase Online (or Desktop) editor with tags directly and paste them to online ICU Message Editor, you need to download the translated *.json file from Phrase first. To do it, go to “Document → Download Target File”:
Then open the downloaded *.json file in any text editor. We recommend using Notepad++ (🔗https://notepad-plus-plus.org/downloads/) or similar.
Find a string you want to copy to online ICU Message Editor and copy the whole string from the “message” line (or “sourceMessage” line if you want to copy the source English string):
Dos and Don’ts
• Do not translate the token name, token type, and selectors.
• Do not add or delete any selectors.
• Do move words inside the token if necessary.
• Do ask your PM/LA for clarifications if you don’t understand how the string will be rendered at runtime.
• Do ask your PM/LA if you don’t know how to handle strings with plural tokens. Strings can be much more complex than those in the examples.
• Do inform your PM/LA if your language needs more selectors.
References
🔗https://cldr.unicode.org/index/cldr-spec/plural-rules