Add translation support and internationalization improvements

This commit is contained in:
2025-04-11 23:49:22 +01:00
parent df344d76ae
commit 4b4987fbb8
4 changed files with 173 additions and 13 deletions

View File

@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.6.0] - 2024-05-15
### Added
- Full translation support with POT file
- JavaScript localization for better multilingual support
- Plugin constants for improved code organization
### Changed
- Updated code to follow WordPress internationalization best practices
- Improved asset loading with version constants
## [1.5.0] - 2024-05-15 ## [1.5.0] - 2024-05-15
### Added ### Added
- Improved compatibility with WordPress 6.4 - Improved compatibility with WordPress 6.4

View File

@ -10,7 +10,7 @@
* @wordpress-plugin * @wordpress-plugin
* Plugin Name: Fix 'Plugin file does not exist.' Notices * Plugin Name: Fix 'Plugin file does not exist.' Notices
* Description: Adds missing plugins to the plugins list with a "Remove Reference" link so you can permanently clean up invalid plugin entries and remove error notices. * Description: Adds missing plugins to the plugins list with a "Remove Reference" link so you can permanently clean up invalid plugin entries and remove error notices.
* Version: 1.5.0 * Version: 1.6.0
* Author: Marcus Quinn * Author: Marcus Quinn
* Author URI: https://www.wpallstars.com * Author URI: https://www.wpallstars.com
* License: GPL-2.0+ * License: GPL-2.0+
@ -39,6 +39,27 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
// Define plugin constants
define( 'FPDEN_VERSION', '1.6.0' );
define( 'FPDEN_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'FPDEN_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'FPDEN_PLUGIN_FILE', __FILE__ );
define( 'FPDEN_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
/**
* Load plugin text domain.
*
* @return void
*/
function fpden_load_textdomain() {
load_plugin_textdomain(
'fix-plugin-does-not-exist-notices',
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages/'
);
}
add_action( 'plugins_loaded', 'fpden_load_textdomain' );
/** /**
* Main class for the plugin. * Main class for the plugin.
*/ */
@ -82,28 +103,33 @@ class Fix_Plugin_Does_Not_Exist_Notices {
return; // No missing plugins, no need for the special notice JS/CSS. return; // No missing plugins, no need for the special notice JS/CSS.
} }
$plugin_url = plugin_dir_url( __FILE__ );
wp_enqueue_style( wp_enqueue_style(
'fpden-admin-styles', 'fpden-admin-styles',
$plugin_url . 'assets/css/admin-styles.css', FPDEN_PLUGIN_URL . 'assets/css/admin-styles.css',
array(), array(),
filemtime( plugin_dir_path( __FILE__ ) . 'assets/css/admin-styles.css' ) // Versioning based on file modification time. FPDEN_VERSION
); );
wp_enqueue_script( wp_enqueue_script(
'fpden-admin-scripts', 'fpden-admin-scripts',
$plugin_url . 'assets/js/admin-scripts.js', FPDEN_PLUGIN_URL . 'assets/js/admin-scripts.js',
array( 'jquery' ), // Add dependencies if needed, e.g., jQuery. array( 'jquery' ), // Add dependencies if needed, e.g., jQuery.
filemtime( plugin_dir_path( __FILE__ ) . 'assets/js/admin-scripts.js' ), // Versioning. FPDEN_VERSION,
true // Load in footer. true // Load in footer.
); );
// Optional: Pass localized data to script if needed. // Add translation strings for JavaScript
// wp_localize_script('fpden-admin-scripts', 'fpdenData', array( wp_localize_script(
// 'ajax_url' => admin_url('admin-ajax.php'), 'fpden-admin-scripts',
// 'nonce' => wp_create_nonce('fpden_ajax_nonce'), 'fpdenData',
// )); array(
'i18n' => array(
'clickToScroll' => esc_html__( 'Click here to scroll to missing plugins', 'fix-plugin-does-not-exist-notices' ),
'pluginMissing' => esc_html__( 'Plugin file missing', 'fix-plugin-does-not-exist-notices' ),
'removeReference' => esc_html__( 'Remove Reference', 'fix-plugin-does-not-exist-notices' ),
),
)
);
} }
/** /**

View File

@ -0,0 +1,114 @@
# Copyright (C) 2024 Marcus Quinn
# This file is distributed under the GPL-2.0+.
msgid ""
msgstr ""
"Project-Id-Version: Fix 'Plugin file does not exist.' Notices 1.6.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/fix-plugin-does-not-exist-notices\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-05-15T12:00:00+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: fix-plugin-does-not-exist-notices\n"
#. Plugin Name of the plugin
msgid "Fix 'Plugin file does not exist.' Notices"
msgstr ""
#. Plugin URI of the plugin
msgid "https://wordpress.org/plugins/fix-plugin-does-not-exist-notices/"
msgstr ""
#. Description of the plugin
msgid "Adds missing plugins to the plugins list with a \"Remove Reference\" link so you can permanently clean up invalid plugin entries and remove error notices."
msgstr ""
#. Author of the plugin
msgid "Marcus Quinn"
msgstr ""
#. Author URI of the plugin
msgid "https://www.wpallstars.com"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:127
msgid "Click here to scroll to missing plugins"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:128
msgid "Plugin file missing"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:129
#: fix-plugin-does-not-exist-notices.php:205
msgid "Remove Reference"
msgstr ""
#. translators: %s: Path to wp-content/plugins
#: fix-plugin-does-not-exist-notices.php:161
msgid "This plugin is still marked as \"Active\" in your database — but its folder and files can't be found in %s. Click \"Remove Reference\" to permanently remove it from your active plugins list and eliminate the error notice."
msgstr ""
#: fix-plugin-does-not-exist-notices.php:164
msgid "N/A"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:168
msgid "Missing"
msgstr ""
#. translators: %s: Plugin file path
#: fix-plugin-does-not-exist-notices.php:204
msgid "Remove reference to missing plugin %s"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:227
msgid "You do not have sufficient permissions to perform this action."
msgstr ""
#: fix-plugin-does-not-exist-notices.php:233
msgid "Invalid plugin specified."
msgstr ""
#: fix-plugin-does-not-exist-notices.php:308
msgid "Plugin reference removed successfully."
msgstr ""
#: fix-plugin-does-not-exist-notices.php:316
msgid "Failed to remove plugin reference. The plugin may already have been removed, or there was a database issue."
msgstr ""
#: fix-plugin-does-not-exist-notices.php:331
msgid "Fix Plugin Does Not Exist Notices"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:333
msgid "Missing plugin files detected:"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:334
msgid "The plugins listed below with a"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:335
msgid "File Missing"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:336
msgid "tag no longer exist but are still referenced in your database."
msgstr ""
#: fix-plugin-does-not-exist-notices.php:339
msgid "How to fix:"
msgstr ""
#: fix-plugin-does-not-exist-notices.php:340
msgid "Click the \"Remove Reference\" link next to each missing plugin to safely remove it from your active plugins list."
msgstr ""
#: fix-plugin-does-not-exist-notices.php:342
msgid "This will clean up your database and remove the error notifications."
msgstr ""

View File

@ -5,7 +5,7 @@ Tags: plugins, missing plugins, cleanup, error fix, admin tools, plugin file doe
Requires at least: 5.0 Requires at least: 5.0
Tested up to: 6.4 Tested up to: 6.4
Requires PHP: 7.0 Requires PHP: 7.0
Stable tag: 1.5.0 Stable tag: 1.6.0
License: GPL-2.0+ License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html License URI: https://www.gnu.org/licenses/gpl-2.0.html
@ -89,6 +89,13 @@ Although this plugin consumes minimal disk space, and doesn't run unless you are
== Changelog == == Changelog ==
= 1.6.0 =
* Added full translation support with POT file
* Added JavaScript localization for better multilingual support
* Added plugin constants for improved code organization
* Updated code to follow WordPress internationalization best practices
* Improved asset loading with version constants
= 1.5.0 = = 1.5.0 =
* Improved compatibility with WordPress 6.4 * Improved compatibility with WordPress 6.4
* Enhanced error detection for plugin references * Enhanced error detection for plugin references
@ -161,6 +168,9 @@ Although this plugin consumes minimal disk space, and doesn't run unless you are
== Upgrade Notice == == Upgrade Notice ==
= 1.6.0 =
Added full translation support! The plugin can now be translated into any language.
= 1.5.0 = = 1.5.0 =
Improved compatibility with WordPress 6.4 and accessibility enhancements for screen readers! Improved compatibility with WordPress 6.4 and accessibility enhancements for screen readers!