You have the option to trigger TM auto fill-up tasks when both source and context matches are identified. This can easily be done by enabling the option "Translation Memory Context Matching," which can be found under your project's settings.
These TM suggestions where both context and source string are a match will be shown as a 101% TM suggestion under the suggestions tab in the editor.
Those matches where only the source string is a match and the context is different are shown as a 100% match.
📝Note: TM with Context will work with the following file formats: XLIFF, PO, XLSX, QT, and FILELESS.
Enabling TM with Context
From your Project, click Settings, then Workflow. Enable the option as indicated by the green arrow below:
📝Note: "Translation Memory Context Matching" option is available only when the "Translation Memory Fill-up" setting is enabled
Examples of How TM with Context Works
TM Suggestions List in the Editor:
Let's say the following suggestions are available in TM:
Scenario A: User selects a resource string "Hello" without context (Context = none). In the Suggestions tab, the following suggestions will be visible (in this particular order): #2, #3, #4 (#1 will not be visible, since it is the same as #4 but older). Each suggestion will be marked with a 100% match
Scenario B: User selects a resource string "Hello" with context "Greeting". In the Suggestions tab, the following suggestions will be visible (in this particular order): #4, #3, #2 (#1 will not be visible, since it is the same as #4 but older). The #4 will be marked as 101%, because it is 100% text match + 100% context match
Scenario C: User selects a resource string "Hello" with context "greeting". In the Suggestions box, the following suggestions will be visible (in this particular order): #3, #4, #2 (#1 will not be visible, since it is the same as #4 but older). Each suggestion will be marked with a 100% match since no context matching occurs
TM Auto-Fill
1. Scenario - If "fill-up with context" is enabled:
The source string has context, ie. the context field has a value.
If TM contains an entry with the same source string, context, and target language, the translation text will be filled in.
If TM contains an entry with the same source string and target language but different context (or no context), the string will be left untranslated.
The source string has no context.
If TM contains an entry with the same source string and target language but no context, the translation text will be filled in.
If TM contains an entry with the same source string and target language, but context is also present, the string will be left untranslated.
2. Scenario - If "fill-up with context" is not enabled:
The source string has context.
If TM contains an entry with the same source string and target language, irrespective of the context, the translation text will be filled in using the last updated translation version.
The source string has no context.
If TM contains an entry with the same source string and target language, irrespective of the context, the translation text will be filled in using the last updated translation version.
Example:
A JSON file with the following source string is uploaded - Source: Hello, Translation: γεια, Context: -
Then, a PO file with the following source string is uploaded - Source: Hello, Translation: -, Context: greeting
Fill-up with context is enabled: The string "Hello" in the PO resource won't automatically be translated by TM.
Fill-up with context is disabled: The string "Hello" in the PO resource will automatically be translated by TM.
Uploading and Downloading TMX files with Context
If the localization file format you use supports context (XLIFF, PO, XLSX, QT), then you have the option to upload and download translation memory files with this information.
A TMX file where entries do not include context looks like this:
<tu>
<prop type="context"></prop>
<tuv xml:lang="en">
<seg>Answer</seg>
</tuv>
<tuv xml:lang="fr">
<seg>Répondre</seg>
</tuv>
</tu>
A TMX file where translatable entries include context has the following syntax instead:
<tu>
<prop type="context">Text style</prop>
<tuv xml:lang="en">
<seg>Answer</seg>
</tuv>
<tuv xml:lang="fr">
<seg>Répondre</seg>
</tuv>
</tu>
In order to download a TMX file with context, the checkbox 'Include string context' should be enabled as follows:
How Context Affects Source String Updates
More information on how Transifex handles source string updates can be found here.
Updating a source string with different context - Context, for the relevant file formats, is part of the source string definition, along with key and source text. Therefore changing the context also changes the string. This means that a new resource string is created, any existing translations are lost
Updating the context through the UI or the API is not allowed
How Context is Defined in the Source Files Themselves
XLIFF Sample:
<!--?xml version="1.0" ?--><xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file datatype="plaintext" original="en.lproj/Localizable.txt" source-language="en">
<trans-unit datatype="html" id="edc96753971323c438706da1820e74730a79d1af">
<source>Your response to this survey has already been recorded. Thank You.
</trans-unit>
</file>
</xliff>
Context in case of an XLIFF file is defined by the attributes in the XLIFF header as well as entity's id i.e.
original:source_language:datatype: id
e.g.
context = en.lproj/Localizable.txt:English (en):plaintext:edc96753971323c438706da1820e74730a79d1af
PO Sample:
msgctxt "Greeting"
msgid "Hello"
msgstr ""
QT Sample:
<context>
<name>Greeting</name>
<message> <source>Hello</source></message>
</context>
Continue Reading