Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-jacob committed Dec 16, 2024
2 parents 2bf57c2 + 80d4369 commit 11a2a58
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 13 deletions.
1 change: 1 addition & 0 deletions data.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ function wplng_data_switcher_nav_menu_valid_name_format() {
'o' => __( 'Original name', 'wplingua' ),
't' => __( 'Translated name', 'wplingua' ),
'i' => __( 'Language ID', 'wplingua' ),
'n' => __( 'No display', 'wplingua' ),
);
}

Expand Down
4 changes: 2 additions & 2 deletions inc/api-call/validate-api-key.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function wplng_api_call_validate_api_key( $api_key = '' ) {
set_transient(
'wplng_api_key_error',
$error_message,
60 * 5
MINUTE_IN_SECONDS * 5
);

} else {
Expand All @@ -205,7 +205,7 @@ function wplng_api_call_validate_api_key( $api_key = '' ) {
set_transient(
'wplng_api_key_error',
__( 'API returned an unexpected response.', 'wplingua' ),
60 * 5
MINUTE_IN_SECONDS * 5
);

}
Expand Down
2 changes: 1 addition & 1 deletion inc/api-key.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function wplng_get_api_data() {
set_transient(
'wplng_api_key_data',
wp_json_encode( $data_checked ),
60 * 60 * 12
HOUR_IN_SECONDS * 12
);
}

Expand Down
3 changes: 2 additions & 1 deletion inc/slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ function wplng_get_slugs_from_query() {
} else {
set_transient(
'wplng_cached_slugs',
$slugs
$slugs,
MONTH_IN_SECONDS
);
}

Expand Down
23 changes: 20 additions & 3 deletions inc/switcher-nav-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ function wplng_switcher_nav_menu_args_from_href( $href ) {
return false;
}

// Check if names or fags are displayed
if ( 'n' === $match[1] && 'n' === $match[2] ) {
$match[1] = 'o';
}

// Return the $args array checked

return array(
Expand Down Expand Up @@ -166,9 +171,13 @@ function wplng_switcher_nav_menu_replace_items( $items ) {
);
break;

default: // case 'i'
case 'i':
$title = strtoupper( $language_current_id );
break;

default: // case 'n'
$title = '';
break;
}

$new_item->ID = 'wplng-language-' . $language_current_id;
Expand Down Expand Up @@ -217,9 +226,13 @@ function wplng_switcher_nav_menu_replace_items( $items ) {
);
break;

default: // case 'i'
case 'i':
$title = strtoupper( $language_website['id'] );
break;

default: // case 'n'
$title = '';
break;
}

$new_item->ID = 'wplng-language-' . $language_website['id'];
Expand Down Expand Up @@ -286,9 +299,13 @@ function wplng_switcher_nav_menu_replace_items( $items ) {
);
break;

default: // case 'i'
case 'i': // case 'i'
$title = strtoupper( $language_target['id'] );
break;

default: // case 'n'
$title = '';
break;
}

$new_item->ID = 'wplng-language-' . $language_target['id'];
Expand Down
3 changes: 2 additions & 1 deletion inc/translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ function wplng_get_translations_from_query() {

set_transient(
'wplng_cached_translations',
$translations
$translations,
MONTH_IN_SECONDS
);

return $translations;
Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== wpLingua - Automatic translation - Translate and make website multilingual ===
Contributors: wpr0ck, lyly13
Contributors: wpr0ck, lyly13, wplingua
Donate link: https://wplingua.com/
Tags: translate, translation, multilingual, localization, language
Requires at least: 6.0
Tested up to: 6.7
Stable tag: 2.1.4
Stable tag: 2.1.5
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -174,6 +174,11 @@ No, not at the moment but in the meantime, you can easily display the language s

== Changelog ==

= 2.1.5 =

* New option for switcher in menu: Use only flag
* Optimizing cache for translations and slugs

= 2.1.4 =

* Better management of translated slugs
Expand Down
6 changes: 3 additions & 3 deletions wplingua.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* Plugin Name: wpLingua
* Plugin URI: https://wplingua.com/
* Description: An all-in-one solution that makes your websites multilingual and translates them automatically, without word or page limits. The highlights: a free first language, an on-page visual editor for editing translations, a customizable language switcher, search engine optimization (SEO), self-hosted data and more!
* Author: wpLingua Team
* Author: wpLingua Translation Service
* Author URI: https://wplingua.com/
* Text Domain: wplingua
* Domain Path: /languages/
* Version: 2.1.4
* Version: 2.1.5
* Requires PHP: 7.4
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand All @@ -24,7 +24,7 @@
define( 'WPLNG_API_URL', 'https://api.wplingua.com' );
define( 'WPLNG_API_VERSION', '2.0' );
define( 'WPLNG_API_SSLVERIFY', true );
define( 'WPLNG_PLUGIN_VERSION', '2.1.4' );
define( 'WPLNG_PLUGIN_VERSION', '2.1.5' );
define( 'WPLNG_PLUGIN_FILE', plugin_basename( __FILE__ ) );
define( 'WPLNG_PLUGIN_PATH', dirname( __FILE__ ) );
define( 'WPLNG_MAX_TRANSLATIONS', 256 );
Expand Down

0 comments on commit 11a2a58

Please sign in to comment.