Support » Plugin: Theme and plugin translation for Polylang (TTfP) » Issue with custom registered text-domain

  • Resolved gts85

    (@gts85)


    Hi we did try to registered the new custom text-domain with below code and also ticked it in the setting page

    add_filter(‘ttfp_domains’, ‘custom_ttfp_domains’, 10, 1);
    function custom_ttfp_domains(array $domains) {
    $domains[] = “custom-textdomain”;
    return $domains;
    }

    But we did not tick the scan for any theme in the setting.

    Then we added the sample string in the theme header code.
    <?php echo __(‘Hello there!’, ‘custom-textdomain’); ?>

    But we cannot seem to able to found or search the string “Hello there!” in the translation page.

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

    (@marcinkazmierski)

    Hi @gts85 , did you select your text domain on Languages->TTfP Settings page under “WordPress core and admin domains” section?

    And where did you add this filter add_filter(‘ttfp_domains’, ‘custom_ttfp_domains’, 10, 1); ? on your theme in functions.php?

    Please also select your theme on Languages->TTfP Settings page.

    Thread Starter gts85

    (@gts85)

    Hi Marcin, OK we tick the scan for theme and it works. Just wonder if we able to have text-domain as “group” instead of theme name? Because we found that we cannot have 2 or more same string but with different domain: Eg: it will just show 1 in the admin translation page.

    _e(‘String 1’, ‘text-domain-1’);
    _e(‘String 1’, ‘text-domain-2’);
    _e(‘String 1’, ‘text-domain-3’);

    Plugin Author Marcin Kazmierski

    (@marcinkazmierski)

    This is a good point:

    _e(‘String 1’, ‘text-domain-1’);
    _e(‘String 1’, ‘text-domain-2’);
    _e(‘String 1’, ‘text-domain-3’);

    I’ll analyse it later 🙂 Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Issue with custom registered text-domain’ is closed to new replies.