Untranslated strings in patterns; question regarding footer offset patterns
There are several untranslated strings in the patterns which I discovered while looking through the files of the theme. For the majority of this strings adding a translation isn't a big deal.
However there is one string, that might be a bit tricky to translate and keep the styling in place. In the footer-offset-* patterns, there's this big Let's Work Together. The words are put separately in span elements, with the first one having a bunch of additional CSS. It would be wrong to translate the words individually without the spans, because in different languages the grammar can be in a different order. Let's take German for example:
- Translated word by word: "Lass arbeiten zusammen"
- Translated meaningfully, informal version: "Lass uns zusammen arbeiten"
- Translated meaningfully, formal version: "Lassen Sie uns zusammen arbeiten"
As you can see, not only the word order changes from the original English string, but in German there need more words to be added to make it grammatically correct. So it's not possible to translate each word individually, instead the entire string with the span tags and additional CSS must be included to ensure correct translation. And then this leads to the fact that a translator is now in charge of the design decision which words to highlight with the first span. The final question is: shall this string remain untranslated to ensure it follows the design, or is the entire string added to the translation to ensure it can be translated correctly?
Here's an overview of the untranslated strings per pattern file:
footer-call-to-action-dark.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-call-to-action-dark.php#L14 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-call-to-action-dark.php#L19 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-call-to-action-dark.php#L29
footer-call-to-action.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-call-to-action.php#L24 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-call-to-action.php#L32 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-call-to-action.php#L39 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-call-to-action.php#L47
footer-default.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-default.php#L21
footer-logo-desc-two-nav.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-logo-desc-two-nav.php#L14 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-logo-desc-two-nav.php#L19 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-logo-desc-two-nav.php#L29
footer-logo-nav.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-logo-nav.php#L3 I guess the TEST can be removed here, it currently shows up in the translation strings.
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-logo-nav.php#L17
footer-offset-heading-buttons-dark.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-dark.php#L15 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-dark.php#L22 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-dark.php#L26 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-dark.php#L41
footer-offset-heading-buttons-primary.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-primary.php#L15 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-primary.php#L22 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-primary.php#L26 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons-primary.php#L41
footer-offset-heading-buttons.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons.php#L15 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons.php#L22 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons.php#L26 https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/footer-offset-heading-buttons.php#L41
header-title-nav-button.php
https://github.com/extendify/extendable/blob/8a71561a370fdb886f76934e01d2e47bbea3cb8e/patterns/header-title-nav-button.php#L19
Hmm... thanks @luminuu. Good catch.
The final question is: shall this string remain untranslated to ensure it follows the design, or is the entire string added to the translation to ensure it can be translated correctly?
I think this is my overall question. Maybe it is fine for this string to be untranslated. That ensures the pattern structure remains intact (both the styling and the space that the text takes up).
One option is using wp_sprintf with _x you can format it with the <span> tags in a responsible way. The translator would have to decide where to place the tags but the inline styling would be abstracted.
wp_sprintf(
_x(
'<span %1$s>Let's</span><span>Work</span><span>Together</span>',
'Translators, chose meaningful places to break the sentence apart, but keep the inline styles in the first span',
'extendable'
),
'style="color: revert; font-family: var(--wp--preset--font-family--source-serif-4); font-size: clamp(3.5rem, 8vw, 8rem); display: inline !important;"'
);