Skip to content

Commit e458d21

Browse files
committed
fix: translation Loading Notice in WP 6.7+
1 parent fae9f1e commit e458d21

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

includes/Core/Database/Model.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,12 @@ public function count($condition = null)
150150
return new WP_Error('db_error', $this->app_db->last_error);
151151
}
152152

153-
return new WP_Error('db_error', __('Result is empty', 'bit-integrations'));
153+
return new WP_Error(
154+
'db_error',
155+
(\function_exists('is_textdomain_loaded') && is_textdomain_loaded('bit-integrations'))
156+
? __('Result is empty', 'bit-integrations')
157+
: 'Result is empty'
158+
);
154159
}
155160

156161
return $this->app_db->last_result;
@@ -467,24 +472,33 @@ protected function execute($sql, $values = null)
467472
protected function getResult($db_response = null)
468473
{
469474
$db_response = !empty($this->db_response) ? $this->db_response : $db_response;
475+
470476
if (!empty($this->app_db->last_error)) {
471477
return new WP_Error('db_error', $this->app_db->last_error);
472478
}
479+
473480
if (!$db_response) {
474481
if ($this->app_db->num_rows > 0) {
475482
$response = $this->app_db->num_rows;
476483
}
477484
if (is_wp_error($db_response)) {
478485
$response = $db_response;
479486
}
480-
$response = new WP_Error('result_empty', __('Result is empty', 'bit-integrations'));
487+
488+
$response = new WP_Error(
489+
'result_empty',
490+
(\function_exists('is_textdomain_loaded') && is_textdomain_loaded('bit-integrations'))
491+
? __('Result is empty', 'bit-integrations')
492+
: 'Result is empty'
493+
);
481494
} elseif (\is_array($this->app_db->last_result) && !empty($this->app_db->last_result)) {
482495
$response = $this->app_db->last_result;
483496
} elseif ($this->app_db->insert_id) {
484497
$response = $this->app_db->insert_id;
485498
} else {
486499
$response = $db_response;
487500
}
501+
488502
$this->app_db->flush();
489503

490504
return $response;

includes/Plugin.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function every_week_time_cron($schedules)
6565
{
6666
$schedules['every_week'] = [
6767
'interval' => 604800, // 604800 seconds in 1 week
68-
'display' => esc_html__('Every Week', 'bit-integrations')
68+
'display' => (\function_exists('is_textdomain_loaded') && is_textdomain_loaded('bit-integrations')) ? esc_html__('Every Week', 'bit-integrations') : 'Every Week'
6969
];
7070

7171
return $schedules;
@@ -125,7 +125,9 @@ public function localization_setup()
125125
*/
126126
public function plugin_action_links($links)
127127
{
128-
$links[] = '<a href="https://docs.bit-integrations.bitapps.pro" target="_blank">' . __('Docs', 'bit-integrations') . '</a>';
128+
$docs = (\function_exists('is_textdomain_loaded') && is_textdomain_loaded('bit-integrations')) ? __('Docs', 'bit-integrations') : 'Docs';
129+
130+
$links[] = '<a href="https://docs.bit-integrations.bitapps.pro" target="_blank">' . $docs . '</a>';
129131

130132
return $links;
131133
}

0 commit comments

Comments
 (0)