WordPress.org

Ready to get started?Download WordPress

Forums

Tweet Blender
Language files are not loading (1 post)

  1. Rick Radko
    Member
    Posted 2 years ago #

    Thank you for adding localization to Tweet Blender!

    However, the language files do not load for me.

    For all my plugins, I need to load the language files at init to get them to work. That could be because I have multilingual sites using a language switcher plugin to choose the display language, not just a localized site.

    I modified Tweet Blender as follows to get the files to load:
    Line 31 tweet-blender.php
    function tb_lang_init() {
    load_plugin_textdomain('tweetblender', false, dirname(plugin_basename(__FILE__)) . "/lang/");
    }
    add_action('init', 'tb_lang_init');

    Could you add this change? it should not affect anyone negatively.

    A tip from http://pressedwords.com/6-tips-for-localizing-your-wordpress-plugin/ copied below explains quite nicely why the init load is needed.

    Load the Domain at the Right Time

    For plugin localization to work at all, a plugin must load the .mo file by calling load_plugin_textdomain at some point. However, many plugins load it too soon. It’s a good idea not to call load_plugin_textdomain any sooner than the WordPress “init” action event, so that the plugin will work with other internationalization plugins, plugins which might be doing things that need priority. In the following example, “myplugin” defines a function that is executed at the “init” event:

    function myplugin_init() {
    load_plugin_textdomain('my-plugin');
    }
    add_action('init', 'myplugin_init');

    http://wordpress.org/extend/plugins/tweet-blender/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic