Support » Plugin: Theme and plugin translation for Polylang (TTfP) » Mixing different textdomains with same string

  • Resolved Pavel Mares

    (@pavelmares)


    So I have string “Search” – see below. But it seems WP Core also has this exact string. So in translations I can see “TTfP: WordPress: Core” string. When changed, my string for my text domain is also translated.

    Is this correct behaviour?

    <?php _e( 'Search', 'sikpre' ); ?>

    WP 6.4. 1
    TTfP: 3.4.0

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

    @pavelmares thanks for your issue – good issue 🙂

    I spent a lot of time to fix this…
    But the problem is on the side of the Polylang plugin.

    Polylang string registration function does not support the domain:
    pll_register_string [@param string $context Optional, the group in which the string is registered, defaults to 'polylang'. ]
    This optional $context is not the same as context in the class Translations (from WordPress core):
    Translations()->translate( $singular, $context = null ) In Translations context means the domain of the text.

    To fix this I need to make changes inside Polylang plugin- I think.

    In summary, Polylang plugin does not support domains in text translations from the admin panel.

    Thread Starter Pavel Mares

    (@pavelmares)

    So when there are mixed strings like __( ‘string’, ‘my-theme’ ); and __( ‘string’, ‘wordpress’ );

    In Polylang translations there will be one and the same but the “wordpress” wins because it is first loaded.

    Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

    Yes exactly.
    I tried to implement this in my plugin, but I failed to do that.
    This is an interesting problem. Perhaps I need to read more code of the Polylang plugin and find some filter or action to fix this?
    But I need more time 🙁

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.