• Resolved digiblogger

    (@digiblogger)


    Hello,

    I am using your plugin for a long time now and I absolutely love it.

    Sometimes, there is an issue when creating the mo/po files. I think, this could be solved.

    The Plugin seems to create the files like the according plugin directory is called. So, if the plugin directory is named “my-pretty-wpplugin”, then the language file is named for example “my-pretty-wpplugin-de_DE” with mo/po extension.

    The better way would be to read the load_plugin_textdomain function, because this is the function, where the correct file name is set.

    Sometimes, a plugin is called “my-pretty-wpplugin” and the textdomain is just “mpw”. So the files should be named “mwp-de_DE”.

    For users:

    To correct this, open the main php file of your plugin, search for load_plugin_textdomain and rename the generated po/mo files. example:

    Code is:

    load_plugin_textdomain('mpwpp', false, dirname(plugin_basename(__FILE__)).'/languages/');

    Filename must be:

    mpwpp-xx_XX

    where xx_XX are the shortcuts for your language, for example de_DE.

    Remember: Since 4.1, calling the WP_LANG function in wp-config.php is no longer necessary

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

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

    (@timwhitlock)

    You are right, scanning the source code for text domain loaders would help work out what they are supposed to be. Unfortunately I have seen plugins and themes that load multiple domains and sometimes even domains from other plugins that don’t exist.

    Future versions of this plugin might have a go at doing this, but for now there is an even easier way to ensure that Loco identifies the text domain and location of files:

    Add a header like this to your theme’s style.css or your plugin’s functions.php file:

    /*
     ..
     Text Domain: mydomain
     Domain Path: /my/languages
     ..
     */

    Plugin Author Tim W

    (@timwhitlock)

    I’m closing this support issue, but I have noted the feature request.

    Better Text Domain identification is at the top of my list of the harder problems that need solving.

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

The topic ‘Fixing the File-Name Issue’ is closed to new replies.