WordPress.org

Ready to get started?Download WordPress

Forums

Codestyling Localization
[resolved] Textdomain conflict (5 posts)

  1. themesforge
    Member
    Posted 1 year ago #

    Hi there,

    Awesome plugin!

    I have a small issue which you be able to assist with resolving which I'm sure impacts other users of your plugin.

    I have a theme which has .po/.mo files contained within a /languages subdir within the theme

    e.g.

    /footheme
    --/languages/foolang.po
    --/languages/foolang.mo

    These are called from within the theme functions.php as follows:

    load_theme_textdomain('foothemetextdomain', get_template_directory() . '/languages');

    So far so good.

    In addition, there is a plugin bundled with the theme which resides in:

    /footheme
    --/plugin/barrplugin/
    ---/languages/barlang.po
    ---/languages/barlong.mo

    This plugin also calls it's lang files with it's down text domain and with a different type of call:

    load_textdomain( 'barlang', $mofile );

    The net effect of all this is that when I attempt to create po files with your plugin I have a few problems:

    1.) The default text domain appears to be "barlang" instead of "foothemetextdomain"
    2.) I see this error:
    Loading Issue: Author is using load_textdomain instead of load_theme_textdomain or load_child_theme_textdomain function. This may break behavior of WordPress, because some filters and actions won't be executed anymore. Please contact the Author about that.

    3.) When I try to edit the po file I see this error:
    Error: The actual loaded translation content does not match the textdomain

    Warning: The actual loaded translation content contains mixed textdomains and is not pure translateable within one textdomain.
    It seems, that there is code contained extracted out of other plugins, themes or widgets and used by copy & paste inside some source files.
    The affected unknown textdomains are:

    All 3 issues go away when I remove the plugin but I need the plugin for some key parts of the themes functionality. Is there some workaround or code I can add to the theme to stop your scans from picking up on the plugin?

    http://wordpress.org/extend/plugins/codestyling-localization/

  2. codestyling
    Member
    Plugin Author

    Posted 1 year ago #

    How gets the plugin loaded cause I don't know a core way to provide plugins from other dirs than wp-content/plugins or wp-content/mu-plugins ?
    Did your call require within the functions.php the plugins main file by your own?
    If a theme has pre-conditions, than it should either perform an API base sub-install and activation of the required plugins or switch back to the default theme, if some dependencies are not available.

  3. themesforge
    Member
    Posted 1 year ago #

    How gets the plugin loaded cause I don't know a core way to provide plugins from other dirs than wp-content/plugins or wp-content/mu-plugins ?

    the plugin is loaded via the theme functions file:

    see details here:
    http://www.deluxeblogtips.com/meta-box/include-meta-box-plugin-in-themes/

    Did your call require within the functions.php the plugins main file by your own? If a theme has pre-conditions, than it should either perform an API base sub-install and activation of the required plugins or switch back to the default theme, if some dependencies are not available.

    It's doesn't need the API sub install step - it's a simple include like any other functions call in a themes functions file. Regardless it still doesn't help solve an issue whereby a theme might have multiple text domains. I think your plugin scans the entire theme directory. Is there any way to narrow this by selecting a specific directory?

    Ed

  4. codestyling
    Member
    Plugin Author

    Posted 1 year ago #

    There are 3 problems doing it this way instead of installing it as ordinary plugin:
    1.) potential any other plugin can utilize the same thing and loads twice the classes, result: will crash the blog.
    2.) if the plugin is already installed, then the theme activation will crash anyway.
    3.) it can't be translated by it's own, while not part of ordinary plugin registration.

    If you pre-package it to your theme, than you are the owner of this copy of plugin while you bundle it! Thatswhy you have to maintain it within your theme scope too. This said, you are also responsible to modify your copy to meet your themes textdomain and also remove the plugins load call. Doing so, you can do all the stuff within your theme.

    I don't think, that this type of plugin usage will ever be supported by my plugin, it's miles away from the WordPress standard and provokes potential crashes at users WordPress installations.

  5. themesforge
    Member
    Posted 1 year ago #

    Thanks for the update.

    I know the other way of doing things is better from a developer perspective.

    It's also very common for theme devs to bundle functionality like this within the theme to make life much easier for users who are not that tech savvy.

    I'll probably fork the plugin and fully integrate their lang files into the theme.

    Thanks,

    Ed

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.