Support » Plugin: Loco Translate » Sync when theme domain is a defined costant

  • Resolved Samuele Carpene

    (@samuelecarpene)


    Usually in theme i use a constant to define my theme domain.
    So in functions.php i have
    define(‘THEME_DOMAIN’, “abc”);
    and in the php files of the theme i use for example
    <?php _e(“Search”, THEME_DOMAIN); ?>
    or
    <?php __(“Search”, THEME_DOMAIN); ?>
    but with the new version of the plugin i have some problems.
    Can you check?

    Thank you in advance.

    https://wordpress.org/plugins/loco-translate/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tim W

    (@timwhitlock)

    This is bad localization practice, and Loco will not be able to extract strings that require run time evaluation of text domains. https://localise.biz/help/wordpress/theme-localization#gotchas

    You should ask the author to ship a template file with their theme so you don’t have to extract strings yourself. https://localise.biz/wordpress/plugin/manual/templates

    Marking as resolved because this isn’t a bug. Sorry, it’s just how it works.

    Plugin Author Tim W

    (@timwhitlock)

    The latest release (2.0.11) introduces an experimental setting. Configuring a wildcard “*” as your text domain will force Loco to extract ALL valid strings from source code regardless of their text domain.

    This will include calls with dynamic text domain arguments (such as a constant). But beware it will also extract every other domain it finds in the same files so make sure you handle this in your configuration.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sync when theme domain is a defined costant’ is closed to new replies.