Patterns & Dynamic Text
Most text on a WordPress site is static — a heading, a paragraph, a button label. But some text changes depending on what the visitor is doing or what is on the page: a cart count, a search result total, a username greeting. This kind of text is called dynamic content, and it requires special handling to translate correctly.
The Problem with Dynamic Text
Section titled “The Problem with Dynamic Text”Consider the text “You have 3 items in your cart.” If a visitor has 5 items, it reads “You have 5 items in your cart.” If they have 1 item, it reads “You have 1 item in your cart.”
Without pattern detection, Omnalingo would need to store and translate each variation as a separate string — one entry for every possible number. That is not practical, and many of those variations would never be seen during a scan.
How Patterns Work
Section titled “How Patterns Work”When Omnalingo scans your site and finds multiple strings that share the same structure but differ only in their variable parts — numbers, counts, or other values — it recognizes them as instances of the same pattern.
Instead of translating each variation separately, Omnalingo creates a single template. For the cart example, the template would be:
You have \{n\} items in your cart.That template is translated once. When a visitor’s page contains “You have 7 items in your cart”, Omnalingo matches it against the template, plugs in the number 7 into the translated version, and displays the result. No matter what number appears, the translation is always correct.
When Patterns Are Created Automatically
Section titled “When Patterns Are Created Automatically”Omnalingo detects patterns automatically during scanning. When it sees the same text structure appearing multiple times with different numbers, it creates a pattern template and links all the matching strings to it.
Examples of text that commonly become patterns:
- Pagination: “Page 1 of 10”, “Page 2 of 10”, “Page 3 of 10” →
Page \{n\} of \{n\} - Search results: “Showing 1–10 of 238 results” →
Showing \{n\}–\{n\} of \{n\} results - Cart: “3 items in your cart” →
\{n\} items in your cart - Prices: “$49.99”, “$12.00” →
$\{n\}
Translating Patterns
Section titled “Translating Patterns”Patterns appear in your translation list just like regular strings, but instead of showing the full text, they show the template with placeholders. Translate the template once and all variations are covered.
In the visual editor, you can see a preview of how a specific variation looks with the translation applied.
When a Pattern Is Wrong
Section titled “When a Pattern Is Wrong”Sometimes Omnalingo may incorrectly group strings into a pattern, or you may want a specific variation to have its own separate translation rather than using the template.
In the Omnalingo dashboard, you can exempt a specific string from a pattern. The exempted string keeps its own individual translation and is not affected by the pattern template. Other strings that match the pattern continue to use the template as normal.
If a pattern is causing problems across the board, you can suppress it entirely. A suppressed pattern stops matching, and all the strings it previously covered revert to being individually translatable.