You can call load_plugin_textdomain()
multiple times in each plugin, but I would not do that.
Put the common files into a separate plugin, for example luke-carbis-library
. In that plugin create two simple functions for setup and loading extra files:
add_action( 'plugins_loaded', 'lcl_init' );
function lcl_init()
{
$dir = plugin_dir_path( __FILE__ );
$url = plugins_url( __FILE__ );
// maybe load necessary files and translation
do_action( 'lcl_init', $dir, $url );
}
function lcl_load( $file )
{
require_once plugin_dir_path( __FILE__ ) . $file;
}
In your depending plugins hook into your custom action:
add_action( 'lcl_init', 'depending_plugin_init', 10, 2 );
Now you can change the inner structure of the base plugin any time; the other plugins just use $dir
and $url
from your hook.
Related Posts:
- Translation not working for Constant strings in Plugin
- How to make a WordPress plugin translation ready?
- How to provide translations for a WordPress TinyMCE plugin?
- Preparing a string in an array for localization
- Shortcodes, output buffering, and WordPress functions
- Problems with localization
- How can I translate the name of my Plugin for other languages?
- How to properly load text domain of custom mu plugin
- `wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin
- WordPress Localization and Templating
- How to properly load text domain of custom mu plugin
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- How to update the language used by wordpress from a plugin
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- Singular name Plugin localization
- How to i18n text coming from the db or from an external source
- Should I always prefer esc_attr_e & esc_html_e instead of _e?
- Some strings from a .mo file do not load
- Should shorcodes in i18n plugins be translated and if so, how?
- A better way to include localized labels in WordPress plugins
- How to render a time-of-day string like ’16:42′ with a site’s chosen time format?
- Frontend language per user
- Plugin translations not installed but… strings are translated!
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- Generate JSON files for language translation from po file without wp-cli i18n make-json
- Shortcode returning localized HTML part
- load_plugin_textdomain doestn’t work with add_action plugins_loaded
- How to prevent someone from entering strings without making it available for translation?
- I18n not working in plugin
- Mixing l18n string from my plugin with WordPress’ translations
- Plugin language always shows WP site language, not profile language
- Is hint for translator compulsory while internationalizing a string containing variables?
- Translations only load from `wp-content/languages/plugins` but not from the plugin’s languages folder
- Do I lose translations when I change my Text domain for my plugin on wp.org?
- Transform internationalized plugin into internationalized mu-plugin?
- Load textdomain from global languages directory
- How are themes and plugins localized using the gettext GNU framework?
- Save translation file of third party plugin in a custom plugin?
- React Plugin Settings Page Localization
- How to get locale within WP REST Request?
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- WordPress Plugin Development – Headers Already Sent Message
- Get page content using slug
- $wpdb->insert_id
- Remove profile picture option (and other things) from profile.php (in admin)
- How to disable plugin update notification for a specific plugin in Multisite
- How Can I Add a Filter to Class Instance Only?
- Getting old term value with edited_{$taxonomy} | Hook
- Call activation hook multiple times
- Adding custom code into header.php using a plugin
- Building a better media uploader for WordPress
- Dropdown list of pages to get page id to store in plugin options
- What is the best way to overwrite /wp-admin/ms-delete-site.php
- Create a new page in a plugin
- Find source of notice / warning / errors efficiently
- Sharing common functionality (functions, template parts) between plugins and themes?
- Use wp_set_post_terms() instead of wp_insert_post()
- TinyMCE 4.7.11 custom styles using styleselect – what does the ‘attributes’ argument do?
- Modifying meta tags after doing ajax call in plugin
- Create a free scripts and styles template within a plugin
- Is there a way to list all actions registered by a plugin or theme?
- WordPress Plugin with a shortcode that dynamically generates javascript. Can I use add_action without wrapping the javascript in a function?
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- How to enqueue style in WordPress plugin from theme files?
- Bootstrap version conflict 3 with 4 for wordpress theme and plugin [closed]
- pre_get_post alter current post id
- 3rd Party Plugin dependency – how to correctly load classes
- Problems with cron
- How do I add a favicon that only shows during viewing of my plugin’s admin panel?
- Remove Default Blogroll Links via Plugin script
- Catching Form Submission in WordPress Admin Panel
- Filter posts in pre_get_posts order by meta value date (desc or asc)
- How to display the category id along with category name on categories list?
- Save temporary registration data
- Activate / Deactivate plugin
- Serial Number from custom table not appear in woocommerce_email_before_order_table action
- How to replace the existing metatag using the backend to insure a thumbnail image gets fetched when we share on social media?
- When setting styles to an extended block that was saved as a pattern, it doesn’t remove the style that was there
- Always hide a page from the menu
- Author Meta in Author URL Link
- Different style for specific rows in custom list table using WP_List_Table
- get_comment_meta() for a filter hook in a plugin
- form does not generate $_POST request
- Callback function quicktags that uses variable in start tag
- Font Awesome stopped showing icons, shows &# text instead [closed]
- WordPress Plugin Tool Tip Helpers
- How can I add the Post ID to Class Name in Jquery?
- How to show metabox just in post.php in admin?
- Can I use a hook other than ‘init’ to handle form submissions?
- Managing Custom Designed Content
- Stop theme displaying comments
- Can’t switch theme after activation
- Plugin capabilities
- plugin will not offer update even though a new version is available
- How do I replace title with my plugin?
- How to filter manage categories listing
- Enqueue Script in custom plugin before other
- How to remove a class [closed]
- How do I add multiple custom menu Woo-commerce my account page?