We've launched a new support center at help.smartling.com. This site will continue to be maintained into January 2017. Please update your bookmarks.
Follow

Global Delivery Network: Create and Manage Patterns

The following article applies to the Global Delivery Network project type. 

Smartling’s Patterns feature avoids re-translating strings needlessly when part of the string’s  content is dynamic. Consider the instances below where the content in green varies:

  Hello Julia 
  37 Comments 
  Page 3 out of 10

Smartling defines patterns as strings that include placeholders. Patterns are composed of static and variable content, whereas static content needs to be translated only once and variable content is replaced by a placeholder, which will then be filled-in by the application at run-time.

Most use cases for patterns involve numbers. For example, a string like "You have 8 items in your cart". The GDN automatically creates patterns to handle most strings with numbers. However, you may still need to manually create patterns for other use cases, such as handling user information.

When using the Global Delivery Network there are two ways of creating patterns: using a “notranslate” class in your HTML file or in the dashboard, using the Smartling pattern creation feature. In both cases Smartling replaces the variable in your pattern with a placeholder, then matches the pattern with the rest of the content or any new content captured, excluding repetitive content from translation.

If a pattern has more than one placeholder, each will be given a number. For example:

Page [0] of [1].

This allows translators to change the order placeholders appear in the string without altering their meaning.

Please note that you should not use patterns for date and time. 

To create patterns:

(1) Under Translations Go to Awaiting Authorization or In Progress.

(2) Select one or more strings to create a pattern from

(3) Go to the Actions drop down and select Create Patterns.

 

(4) If you have selected multiple strings, Smartling will analyze the differences between them and try to create placeholders for you automatically. Otherwise, you can select any part of the string and click Placeholder from Selection.

(5) Confirm the rules for the placeholder match. 

(6) Smartling will display a list of strings in your authorization queue that would match your pattern. By default, the pattern must match the full string. Checking Match Partial Strings will capture instances where your pattern appears in longer strings. For example, the pattern 'You drove [1+digits] miles.' will not match the string 'You drove 90 miles. That's too many miles.' unless the Match Partial Strings box is checked.

If there is a string in the list you don't want to include in the pattern, click Keep String. Otherwise, click Apply Pattern.

(7) All strings matching the pattern will be removed from your Authorization queue. Now that you have your pattern, you only need to translate it once.

Note: Content replaced by placeholders will not be translated, so deploy patterns with care. For example, these strings might seem suitable for pattern matching:

"Yellow Gold Wedding Band"
"Rose Gold Wedding Band"

But if you apply a pattern, "Yellow" and "Rose" will appear untranslated on your site.

Troubleshoot Pattern Creation 

If you think your selected strings should form a pattern, but it's not automatically recognized, look for small variations in the original content that might require you to have two separate patterns. For example: 

<div>Hello, <span style="{0}">John</span><br/></div>
<div>Hello, <span id="{0}">Mark</span><br/></div> 
<div>Hello, <span style="{0}">John</span><br/></div>
<div>Hello, <span id="{0}" style="{0}">Mark</span><br/></div> 

While the two below can be handled by a single pattern:

<div>Hello, <span style="{0}">John</span><br/></div>
<div>Hello, <span style="{0}">Mark</span><br/></div>

Manage the Pattern Library

From Content > Patterns you can find a list of all of your patterns and the placeholders you have created for each one of them. From this view, you can:

  • Customize any of your placeholders: click on the placeholder and replace the parameter with text that can help the translator better understand the value the placeholder will be replaced with on the live site.
  • Delete patterns: click on Delete to the right of your pattern. (For patterns created from the Dashboard only)
  • Deactivate patterns: click Deactivate. The pattern will be stored but not applied to new strings. 

Note: patterns that are not used for more than six months are automatically deactivated. To reactivate an inactive pattern, set the filter to show inactive patterns, find the pattern you want to activate and click Activate.

Create Patterns using markup language

Instead of creating patterns manually in the dashboard you can tag the HTML of your site so that patterns are created with placeholders as they are captured.  This is the recommend way to handle pattern strings for your site or web application.

In your HTML source, use the notranslate class within inline tags such as <span> or <strong>. When the HTML is processed, Smartling replaces the content marked notranslate with a placeholder.

<div> Hello, <span class="notranslate">Jack</span>!<div>
In Smartling, the string will be captured  as: Hello,{0}!

Other examples of pattern creation using the notranslate class:

  • Example 1: Single placeholders
<div> <span class="notranslate">37</span>comments<div>
displayed as: {0} comments in Smartling
  • Example 2: Multiple placeholders
<div><span class="notranslate">1</span> of <span class="notranslate">10</span><div>
displayed as Page {0} of {1} comments in Smartling

Please note that the notranslate class cannot be used to create patterns with block tags. I.e. <h1>, <p>, <table>. When you add a notranslate class to block tags, Smartling ignores the entire block element from the translation workflow.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Powered by Zendesk