diff --git a/data.php b/data.php index 603420b..8ec8161 100644 --- a/data.php +++ b/data.php @@ -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' ), ); } diff --git a/inc/api-call/validate-api-key.php b/inc/api-call/validate-api-key.php index 3a24be3..7ea93c4 100644 --- a/inc/api-call/validate-api-key.php +++ b/inc/api-call/validate-api-key.php @@ -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 { @@ -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 ); } diff --git a/inc/api-key.php b/inc/api-key.php index 064db17..7f24650 100644 --- a/inc/api-key.php +++ b/inc/api-key.php @@ -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 ); } diff --git a/inc/slug.php b/inc/slug.php index 28fb510..e293a18 100644 --- a/inc/slug.php +++ b/inc/slug.php @@ -485,7 +485,8 @@ function wplng_get_slugs_from_query() { } else { set_transient( 'wplng_cached_slugs', - $slugs + $slugs, + MONTH_IN_SECONDS ); } diff --git a/inc/switcher-nav-menu.php b/inc/switcher-nav-menu.php index 8f2eda9..0ca20a4 100644 --- a/inc/switcher-nav-menu.php +++ b/inc/switcher-nav-menu.php @@ -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( @@ -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; @@ -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']; @@ -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']; diff --git a/inc/translation.php b/inc/translation.php index b4382c9..6dd950e 100644 --- a/inc/translation.php +++ b/inc/translation.php @@ -189,7 +189,8 @@ function wplng_get_translations_from_query() { set_transient( 'wplng_cached_translations', - $translations + $translations, + MONTH_IN_SECONDS ); return $translations; diff --git a/readme.txt b/readme.txt index b769fff..29f4cdd 100644 --- a/readme.txt +++ b/readme.txt @@ -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 @@ -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 diff --git a/wplingua.php b/wplingua.php index 34b3f5f..87dd984 100644 --- a/wplingua.php +++ b/wplingua.php @@ -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 @@ -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 );