This commit is contained in:
Javier Casares 2026-08-17 16:06:40 +00:00
commit a2d1320030
5 changed files with 62 additions and 7 deletions

View file

@ -167,6 +167,17 @@ $compat_warnings = 0;
$website_url = '' !== $page_url ? $page_url : $homepage;
$has_detail = ( '' !== $website_url || '' !== $desc );
// Localised description: the admin user's locale first,
// falling back to the (English) default.
$raw_translations = $entry['description_translations'] ?? '';
$translations = is_array( $raw_translations ) ? $raw_translations : array();
$user_locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
$locale_text = $translations[ $user_locale ] ?? '';
$display_desc = is_string( $locale_text ) && '' !== trim( $locale_text )
? trim( $locale_text )
: $desc;
$has_detail = ( '' !== $website_url || '' !== $desc || '' !== $display_desc );
// Subscription state: premium plugins are only usable
// (install/update) with an active or in-grace subscription.
$is_premium = ( $cost > 0.0 || 'premium' === $kind );
@ -337,8 +348,8 @@ $compat_warnings = 0;
<?php if ( '' !== $website_url ) : ?>
<a href="<?php echo esc_url( $website_url ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Visit website', 'robotstxt-manager' ); ?> <span class="screen-reader-text"><?php echo esc_html( sprintf( /* translators: %s: plugin name. */ __( '(about %s)', 'robotstxt-manager' ), $name ) ); ?></span></a>
<?php endif; ?>
<?php if ( '' !== $desc ) : ?>
<span class="robotstxt-manager-detail-description"><?php echo esc_html( $desc ); ?></span>
<?php if ( '' !== $display_desc ) : ?>
<span class="robotstxt-manager-detail-description"><?php echo esc_html( $display_desc ); ?></span>
<?php endif; ?>
<?php if ( array() !== $req_slugs ) : ?>
<span class="robotstxt-manager-detail-requires">

View file

@ -1,5 +1,22 @@
== Changelog ==
= 1.3.1 =
_Release date: 2026-08-17_
**Added**
* Localized descriptions: catalog rows and the "View details" modal show the description in the logged-in admin's language (`get_user_locale()`, falling back to the site locale), using the new `description_translations` map from Core 1.8.0+; missing translations fall back to the English default.
**Changed**
* Plugin version 1.3.0 → 1.3.1. No database schema changes (no custom tables).
**Compatibility**
* WordPress: 4.4 - 7.1 (scan-verified: wp-compat clean from 4.4)
* PHP: 8.0 - 8.5 (scan-verified: PHPCompatibility + manual feature audit)
= 1.3.0 =
_Release date: 2026-08-17_

View file

@ -210,7 +210,7 @@ class Robotstxt_Manager_Updater {
'requires_php' => $this->str( $row, 'requires_php', '' ),
'tested_up_to' => $this->str( $row, 'tested_up_to', '' ),
'page_url' => $this->str( $row, 'page_url', '' ),
'description' => $this->str( $row, 'description', '' ),
'description' => $this->localized_description( $row ),
'icon_url' => $this->str( $row, 'icon_url', '' ),
'banner_url' => $this->str( $row, 'banner_url', '' ),
);
@ -340,6 +340,27 @@ class Robotstxt_Manager_Updater {
return $slug;
}
/**
* Picks the description for the current admin user's locale, falling
* back to the default (English) description.
*
* @param array<string, mixed> $row Catalog row.
*
* @return string The localized (or default) description.
*/
private function localized_description( array $row ): string {
$raw_translations = $row['description_translations'] ?? '';
$translations = is_array( $raw_translations ) ? $raw_translations : array();
$user_locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
$locale_text = $translations[ $user_locale ] ?? '';
if ( is_string( $locale_text ) && '' !== trim( $locale_text ) ) {
return trim( $locale_text );
}
return $this->str( $row, 'description', '' );
}
/**
* Extracts a string value from a mixed-value row.
*

View file

@ -3,9 +3,9 @@ Contributors: javiercasares, robotstxt
Tags: dashboard, catalog, updates, subscriptions, management
Requires at least: 4.4
Tested up to: 7.1
Stable tag: 1.3.0
Stable tag: 1.3.1
Requires PHP: 8.0
Version: 1.3.0
Version: 1.3.1
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
@ -92,6 +92,12 @@ Encrypted at rest using AES-256-CBC with a key derived from your site's WordPres
== Changelog ==
= 1.3.1 =
_Release date: 2026-08-17_
* Descriptions render in the admin's language (Core 1.8.0+ `description_translations`), English fallback.
= 1.3.0 =
_Release date: 2026-08-17_

View file

@ -3,7 +3,7 @@
* Plugin Name: Manager (by ROBOTSTXT)
* Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-manager
* Description: Client-side dashboard for the ROBOTSTXT plugin ecosystem. Lists the catalog from a remote Plugins Core install, resolves local install/update state, and installs, activates, and updates plugins directly from the store.
* Version: 1.3.0
* Version: 1.3.1
* Requires at least: 4.4
* Requires PHP: 8.0
* Author: ROBOTSTXT
@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
/** Plugin version. */
define( 'ROBOTSTXT_MANAGER_VERSION', '1.3.0' );
define( 'ROBOTSTXT_MANAGER_VERSION', '1.3.1' );
/** Absolute path to the plugin directory, with trailing slash. */
define( 'ROBOTSTXT_MANAGER_DIR', plugin_dir_path( __FILE__ ) );