• Hello,
    I have problem with code extraction functionality in new version of this plugin.
    It works perfectly, if I have textdomain as string in my l10n functions like __('Text','textdomain'). But in my plugin, I’d rather not have hardcoded textdomain all over my code, so I use for example: __('Text', $this->config->get('textdomain')). In this case, Loco is not able to extract those strings. It actually works with legacy version, but version 2 probably use some other logic to extract strings, which is not compatible with that.

    You can see more of this plugin on: https://github.com/jakub-klapka/wp-secure-post-with-link if it helps you. Also let me know, if I can help you in any way to fix this.

    Thanks a lot for great plugin! Jakub

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

    (@timwhitlock)

    Hi. This was a deliberate change in version 2 so Loco can target individual domains rather than extracting all strings from all PHP files.

    As you’ve already established, the text domain will only be identified when it’s a string literal. This is because it’s impossible to resolve dynamic arguments without executing the the code.

    There is no fix as such. If you have to use dynamic text domain arguments, you’ll have to generate POT files via some other software.

    Thread Starter Jakub Klapka

    (@lapak)

    Well, that is unfortunate 🙂 I wonder, if that is really common, that plugins have more than one textdomain?
    It would be nice, if there was some way, how to “bypass” the string, which is used as textdomain to look for strings. For example if I could set, that this plugins “textdomain” is “$this->config->get(‘textdomain’)” (or regexp would be awesome). Or just option, to use same logic as v1 for specific plugin.
    Loco is really handy for plugin authors, as the interface and usability is even better, than usual standalone apps – like poedit. And I think, that hardcoded textdomain is not really good practice.

    But I understand, that this is subject of demand, so just count my vote in 🙂

    Thanks for your time, J.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Code extraction don’t work in version 2 with injected textdomain’ is closed to new replies.