Skip to content

Commit

Permalink
added function loaded text domain and added es_MX and pr_BR language …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
geckod22 committed Dec 17, 2024
1 parent f4567a3 commit 4b43d1c
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 14 deletions.
27 changes: 19 additions & 8 deletions includes/Performance.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ public function __construct( Container $container ) {
$cacheManager = new CacheManager( $container );
$cachePurger = new CachePurgingService( $cacheManager->getInstances() );

// Ensure that purgeable cache types are enabled before showing the UI.
if ( $cachePurger->canPurge() ) {
add_action( 'admin_bar_menu', array( $this, 'adminBarMenu' ), 100 );
}
add_action( 'admin_bar_menu', array( $this, 'adminBarMenu' ), 100 );

$container->set( 'cachePurger', $cachePurger );

$container->set( 'hasMustUsePlugin', file_exists( WPMU_PLUGIN_DIR . '/endurance-page-cache.php' ) );

! defined( 'NFD_PERFORMANCE_PLUGIN_LANGUAGES_PATH' ) && define( 'NFD_PERFORMANCE_PLUGIN_LANGUAGES_PATH', dirname( $container->plugin()->basename ) . '/vendor/newfold-labs/wp-module-performance/languages' );
add_action( 'init', array( $this, 'load_text_domain'), 100 );
}

/**
Expand Down Expand Up @@ -137,6 +137,17 @@ function () {
add_filter( 'action_scheduler_cleanup_batch_size', array( $this, 'nfd_as_cleanup_batch_size' ) );
}

/**
* Load module text domain
*/
public function load_text_domain() {
load_plugin_textdomain(
'wp-module-performance',
false,
NFD_PERFORMANCE_PLUGIN_LANGUAGES_PATH
);
}

/**
* Update the default action scheduler retention period to 5 days instead of 30.
* The actions scheduler table tends to grow to gigantic sizes and this should help.
Expand Down Expand Up @@ -251,14 +262,14 @@ public function adminBarMenu( \WP_Admin_Bar $wp_admin_bar ) {
$wp_admin_bar->add_node(
array(
'id' => 'nfd_purge_menu',
'title' => __( 'Caching', 'newfold-module-performance' ),
'title' => __( 'Caching', 'wp-module-performance' ),
)
);

$wp_admin_bar->add_node(
array(
'id' => 'nfd_purge_menu-purge_all',
'title' => __( 'Purge All', 'newfold-module-performance' ),
'title' => __( 'Purge All', 'wp-module-performance' ),
'parent' => 'nfd_purge_menu',
'href' => add_query_arg( array( self::PURGE_ALL => true ) ),
)
Expand All @@ -268,7 +279,7 @@ public function adminBarMenu( \WP_Admin_Bar $wp_admin_bar ) {
$wp_admin_bar->add_node(
array(
'id' => 'nfd_purge_menu-purge_single',
'title' => __( 'Purge This Page', 'newfold-module-performance' ),
'title' => __( 'Purge This Page', 'wp-module-performance' ),
'parent' => 'nfd_purge_menu',
'href' => add_query_arg( array( self::PURGE_URL => true ) ),
)
Expand All @@ -278,7 +289,7 @@ public function adminBarMenu( \WP_Admin_Bar $wp_admin_bar ) {
$wp_admin_bar->add_node(
array(
'id' => 'nfd_purge_menu-cache_settings',
'title' => __( 'Cache Settings', 'newfold-module-performance' ),
'title' => __( 'Cache Settings', 'wp-module-performance' ),
'parent' => 'nfd_purge_menu',
'href' => admin_url( 'options-general.php#' . Performance::SETTINGS_ID ),
)
Expand Down
2 changes: 1 addition & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function getSkip404Option() {
function getSkip404InputField() {
$name = Performance::OPTION_SKIP_404;
$value = getSkip404Option();
$label = __( 'Skip WordPress 404 Handling for Static Files', 'wp-module-performance' );
$label = __( 'Skip WordPress 404 Handling For Static Files', 'wp-module-performance' );
?>
<input
type="checkbox"
Expand Down
Binary file added languages/wp-module-performance-es_MX.mo
Binary file not shown.
40 changes: 40 additions & 0 deletions languages/wp-module-performance-es_MX.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/newfold-labs/wp-module-performance/"
"issues\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2024-12-17 13:50+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_MX\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.2.2\n"
"X-Domain: wp-module-performance\n"

#: includes/CacheTypes/Skip404.php:53 includes/functions.php:64
msgid "Skip WordPress 404 Handling For Static Files"
msgstr "Omitir el manejo de error 404 de WordPress para archivos estáticos"

#: includes/functions.php:37 includes/Performance.php:233
msgid "Cache Level"
msgstr "Nivel de caché"

#: includes/Performance.php:226 includes/Performance.php:265
msgid "Caching"
msgstr "Caché"

#: includes/Performance.php:272
msgid "Purge All"
msgstr "Limpiar todo"

#: includes/Performance.php:282
msgid "Purge This Page"
msgstr "Limpiar esta página"

#: includes/Performance.php:292
msgid "Cache Settings"
msgstr "Configuración de caché"
Binary file added languages/wp-module-performance-pt_BR.mo
Binary file not shown.
40 changes: 40 additions & 0 deletions languages/wp-module-performance-pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/newfold-labs/wp-module-performance/"
"issues\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2024-12-17 13:51+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.2.2\n"
"X-Domain: wp-module-performance\n"

#: includes/CacheTypes/Skip404.php:53 includes/functions.php:64
msgid "Skip WordPress 404 Handling For Static Files"
msgstr "Ignorar o tratamento de erro 404 do WordPress para arquivos estáticos"

#: includes/functions.php:37 includes/Performance.php:233
msgid "Cache Level"
msgstr "Nível de cache"

#: includes/Performance.php:226 includes/Performance.php:265
msgid "Caching"
msgstr "Cache"

#: includes/Performance.php:272
msgid "Purge All"
msgstr "Limpar Tudo"

#: includes/Performance.php:282
msgid "Purge This Page"
msgstr "Limpar esta página"

#: includes/Performance.php:292
msgid "Cache Settings"
msgstr "Configurações de cache"
20 changes: 15 additions & 5 deletions languages/wp-module-performance.pot
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@ msgstr ""
"X-Domain: wp-module-performance\n"

#: includes/CacheTypes/Skip404.php:53
#: includes/functions.php:64
msgid "Skip WordPress 404 Handling For Static Files"
msgstr ""

#: includes/functions.php:37
#: includes/Performance.php:222
#: includes/Performance.php:233
msgid "Cache Level"
msgstr ""

#: includes/functions.php:64
msgid "Skip WordPress 404 Handling for Static Files"
#: includes/Performance.php:226
#: includes/Performance.php:265
msgid "Caching"
msgstr ""

#: includes/Performance.php:215
msgid "Caching"
#: includes/Performance.php:272
msgid "Purge All"
msgstr ""

#: includes/Performance.php:282
msgid "Purge This Page"
msgstr ""

#: includes/Performance.php:292
msgid "Cache Settings"
msgstr ""

0 comments on commit 4b43d1c

Please sign in to comment.