Combine merge tags safely
A selector markup template is repeated for every available locale. It can contain several merge tags, literal separators, and HTML allowed by the WordPress post-content policy.
Select the target surface
Open Settings → POM Translate → Language switcher and edit one of these fields:
- Nav menus markup;
- Shortcodes markup;
- Floating language switcher markup.
A non-empty markup attribute on [pom_translate_language_switcher] overrides Shortcodes markup for that shortcode instance.
Compose the label
Begin with a value that always has a fallback:
{%local_label%}
Add decoration only when it helps distinguish the languages:
{%flag_html%} <strong>{%local_label%}</strong>
The template controls only the contents of the generated language link. Do not add an <a>, list item, dropdown container, script, or event handler; the selector renderer owns those elements and the destination.
Plan for missing values
Merge tags do not support conditions or fallback expressions. An absent value is replaced with an empty string, but surrounding text remains:
{%local_label%} ({%local_country%})
This pattern is appropriate only when every enabled locale has a local country label. Otherwise, use {%local_label%} alone or choose a separator that remains acceptable without the optional value.
Unknown tags are also removed. If the rendered markup itself is empty, POM Translate supplies the language code. Do not depend on that last-resort behavior for templates containing otherwise empty HTML or punctuation.
Save and inspect the result
- Save the relevant markup field or shortcode.
- Open a page where that selector appears.
- Check every language entry, including the current language.
- Inspect a locale without custom country or flag data.
- Confirm the text left after removing decoration still identifies the language.
- Follow each link and verify its route independently from the displayed
code,slug, or country value.
For ready-made combinations, see Selector label recipes.