From 413fb5d07eb062fd32bef2d8a649bc5fdb67fc89 Mon Sep 17 00:00:00 2001 From: Tim Whitlock Date: Sat, 25 Jan 2025 15:23:59 +0000 Subject: [PATCH] Published 2.7.0 --- languages/loco-translate.pot | 6 +++--- loco.php | 6 +++--- readme.txt | 4 ++-- src/Locale.php | 4 ++-- src/admin/bundle/LocaleController.php | 7 +++++++ src/admin/list/LocalesController.php | 7 ++++++- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/languages/loco-translate.pot b/languages/loco-translate.pot index 9b6d87d..0577810 100644 --- a/languages/loco-translate.pot +++ b/languages/loco-translate.pot @@ -1,9 +1,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Loco Translate 2.7.0-dev\n" +"Project-Id-Version: Loco Translate 2.7.0\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/loco-translate/\n" -"POT-Creation-Date: 2025-01-25 14:22+0000\n" +"POT-Creation-Date: 2025-01-25 15:12+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: \n" @@ -13,7 +13,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Loco https://localise.biz/\n" -"X-Loco-Version: 2.7.0-dev; wp-6.7.1\n" +"X-Loco-Version: 2.7.0; wp-6.7.1\n" "X-Domain: loco-translate" #. Author credit: (1) Product name (2) version number, (3) author name. diff --git a/loco.php b/loco.php index 509b43a..211ef34 100644 --- a/loco.php +++ b/loco.php @@ -4,10 +4,10 @@ Plugin URI: https://wordpress.org/plugins/loco-translate/ Description: Translate themes and plugins directly in WordPress Author: Tim Whitlock -Version: 2.7.0-dev +Version: 2.7.0 Requires at least: 6.6 Requires PHP: 7.2.24 -Tested up to: 6.7 +Tested up to: 6.7.1 Author URI: https://localise.biz/wordpress/plugin Text Domain: loco-translate Domain Path: /languages/ @@ -31,7 +31,7 @@ function loco_plugin_file(): string { * Get version of this plugin */ function loco_plugin_version(): string { - return '2.7.0-dev'; + return '2.7.0'; } diff --git a/readme.txt b/readme.txt index e73a94c..b9b34a4 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: translation, language, multilingual, l10n, i18n Requires at least: 6.6 Requires PHP: 7.2.24 Tested up to: 6.7.1 -Stable tag: 2.6.14 +Stable tag: 2.7.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -102,7 +102,7 @@ We don't collect your data or snoop on you. See the [plugin privacy notice](http = 2.7.0 * Raised minimum requirements to WordPress 6.6 -* Minimum PHP version becomes 7.2.24 as per WordPress +* Minimum PHP version becomes 7.2.24 as per WordPress 6.6 * Locale-filtered bundle list now searches for base language * Loading helper forcefully removes prematurely loaded text domains * Machine translation hooks now have access to message context diff --git a/src/Locale.php b/src/Locale.php index 3462e76..fef831c 100644 --- a/src/Locale.php +++ b/src/Locale.php @@ -538,7 +538,7 @@ public function setPluralFormsHeader( $str ){ * @param string $str original plural equation * @return string signature for comparison */ - private static function hashPlural( $str ){ + private static function hashPlural( string $str ):string { return trim( str_replace([' ','<>'],['','!='],$str), '()' ); } @@ -547,7 +547,7 @@ private static function hashPlural( $str ){ * Get formality setting, whether implied or explicit. * @return string either "", "formal" or "informal" */ - public function getFormality(){ + public function getFormality():string { $value = ''; $tag = $this->__toString(); $variant = $this->variant; diff --git a/src/admin/bundle/LocaleController.php b/src/admin/bundle/LocaleController.php index cefdbc6..877b217 100644 --- a/src/admin/bundle/LocaleController.php +++ b/src/admin/bundle/LocaleController.php @@ -162,6 +162,13 @@ public function render(){ 'name' => $locale->getName(), 'attr' => 'class="'.$locale->getIcon().'" lang="'.$locale->lang.'"', ] ) ); + + // Sort each translation set alphabetically by bundle name... + foreach( array_keys($translations) as $type ){ + usort( $translations[$type], function( ArrayAccess $a, ArrayAccess $b ):int { + return strcasecmp($a['title'],$b['title']); + } ); + } return $this->view( 'admin/bundle/locale', compact('breadcrumb','translations','types','npofiles','modified') ); } diff --git a/src/admin/list/LocalesController.php b/src/admin/list/LocalesController.php index 4442c1b..3823d83 100644 --- a/src/admin/list/LocalesController.php +++ b/src/admin/list/LocalesController.php @@ -78,7 +78,6 @@ public function render(){ ] ); } } - $this->set('locales', $locales ); // Count up unique PO files foreach( $finder->findLocaleFiles() as $file ){ @@ -101,6 +100,12 @@ public function render(){ } } + // sort alphabetically by locale label + usort( $locales, function( ArrayAccess $a, ArrayAccess $b ):int { + return strcasecmp( $a['lname'], $b['lname'] ); + } ); + $this->set('locales', $locales ); + return $this->view( 'admin/list/locales' ); }