| @@ -23,14 +23,14 @@ | ||
| 23 | 23 | } |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | 26 | let mainwp_restapi_remove_key_confirm = function (pCheckedBox) { |
| 27 | - let confirmMsg = __("You are about to delete the selected REST API Key?"); | |
| 27 | + let confirmMsg = MainWP.I18n.t("You are about to delete the selected REST API Key?"); | |
| 28 | 28 | mainwp_confirm(confirmMsg, function () { mainwp_restapi_bulk_remove_specific(pCheckedBox); }); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | let mainwp_restapi_bulk_remove_keys_confirm = function () { |
| 32 | - let confirmMsg = __("You are about to delete the selected REST API Key(s)?"); | |
| 32 | + let confirmMsg = MainWP.I18n.t("You are about to delete the selected REST API Key(s)?"); | |
| 33 | 33 | mainwp_confirm(confirmMsg, function () { mainwp_restapi_bulk_init(); mainwp_restapi_remove_keys_next(); }); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | let mainwp_restapi_bulk_init = function () { |
| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | while ((checkedBox = jQuery('.mainwp-rest-api-body-table-manage .check-column INPUT:checkbox:checked[status="queue"]:first')) && (checkedBox.length > 0) && (bulk_RestAPICurrentThreads < bulk_RestAPIMaxThreads)) { // NOSONAR - variables modified in other functions. |
| 50 | 50 | mainwp_restapi_bulk_remove_specific(checkedBox); |
| 51 | 51 | } |
| 52 | 52 | if ((bulk_RestAPITotal > 0) && (bulk_RestAPIFinished == bulk_RestAPITotal)) { // NOSONAR - modified outside the function. |
| 53 | - setHtml('#mainwp-message-zone-apikeys', __("Process completed. Reloading page...")); | |
| 53 | + setHtml('#mainwp-message-zone-apikeys', MainWP.I18n.t("Process completed. Reloading page...")); | |
| 54 | 54 | setTimeout(function () { |
| 55 | 55 | mainwp_forceReload(); |
| 56 | 56 | }, 3000); |
| 57 | 57 | } |
| @@ -78,9 +78,9 @@ | ||
| 78 | 78 | let error = ''; |
| 79 | 79 | if (response.error != undefined) { |
| 80 | 80 | error = response.error; |
| 81 | 81 | } else if (response.success == 'SUCCESS') { |
| 82 | - result = __('The REST API Key has been deleted.'); | |
| 82 | + result = MainWP.I18n.t('The REST API Key has been deleted.'); | |
| 83 | 83 | } |
| 84 | 84 | if (error != '') { |
| 85 | 85 | rowObj.html('<td colspan="999"><i class="red times icon"></i>' + error + '</td>'); |
| 86 | 86 | } else { |
| @@ -224,10 +224,10 @@ | ||
| 224 | 224 | <td data-order="${item.created}">${created_str}</td> |
| 225 | 225 | <td data-order="0">—</td> |
| 226 | 226 | <td>—</td> |
| 227 | 227 | <td class="right aligned"> |
| 228 | - ${can_edit_table ? `<button type="button" class="ui mini basic button mainwp-edit-application-password" data-uuid="${item.uuid}" data-user-id="${item.user_id || ''}" data-name="${escape_html(item.name)}">${__("Edit")}</button>` : ''} | |
| 229 | - ${can_manage_table ? `<button type="button" class="ui mini grey basic button mainwp-revoke-application-password" data-uuid="${item.uuid}">${__("Revoke")}</button>` : ''} | |
| 228 | + ${can_edit_table ? `<button type="button" class="ui mini basic button mainwp-edit-application-password" data-uuid="${item.uuid}" data-user-id="${item.user_id || ''}" data-name="${escape_html(item.name)}">${MainWP.I18n.t("Edit")}</button>` : ''} | |
| 229 | + ${can_manage_table ? `<button type="button" class="ui mini grey basic button mainwp-revoke-application-password" data-uuid="${item.uuid}">${MainWP.I18n.t("Revoke")}</button>` : ''} | |
| 230 | 230 | </td> |
| 231 | 231 | </tr>`; |
| 232 | 232 | |
| 233 | 233 | // Add row using DataTables API with DOM node |
| @@ -263,9 +263,9 @@ | ||
| 263 | 263 | const user_id = edit_user_id_input.val(); |
| 264 | 264 | const name = (edit_name_input.val() || '').trim(); |
| 265 | 265 | if (!name) { |
| 266 | 266 | edit_name_input.trigger('focus'); |
| 267 | - show_message(__('Please enter an application name.'), 'error'); | |
| 267 | + show_message(MainWP.I18n.t('Please enter an application name.'), 'error'); | |
| 268 | 268 | return false; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | const data = mainwp_secure_data({ |
| @@ -287,25 +287,25 @@ | ||
| 287 | 287 | // Update buttons aria/data |
| 288 | 288 | const edit_btn = tr.find('.mainwp-edit-application-password'); |
| 289 | 289 | if (edit_btn.length) { |
| 290 | 290 | edit_btn.attr('data-name', name); |
| 291 | - edit_btn.attr('aria-label', __('Rename "%s"').replace('%s', name)); | |
| 291 | + edit_btn.attr('aria-label', MainWP.I18n.t('Rename "%s"').replace('%s', name)); | |
| 292 | 292 | } |
| 293 | 293 | const revoke_btn = tr.find('.mainwp-revoke-application-password'); |
| 294 | 294 | if (revoke_btn.length) { |
| 295 | - revoke_btn.attr('aria-label', __('Revoke "%s"').replace('%s', name)); | |
| 295 | + revoke_btn.attr('aria-label', MainWP.I18n.t('Revoke "%s"').replace('%s', name)); | |
| 296 | 296 | } |
| 297 | 297 | if (table) { |
| 298 | 298 | table.row(tr).invalidate().draw(false); |
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | - show_message(__('Application password updated successfully.'), 'success'); | |
| 301 | + show_message(MainWP.I18n.t('Application password updated successfully.'), 'success'); | |
| 302 | 302 | edit_modal.modal('hide'); |
| 303 | 303 | } catch { |
| 304 | 304 | mainwp_forceReload(); |
| 305 | 305 | } |
| 306 | 306 | } else { |
| 307 | - const msg = (resp?.data?.message) ?? __('Failed to update Application Password.'); | |
| 307 | + const msg = (resp?.data?.message) ?? MainWP.I18n.t('Failed to update Application Password.'); | |
| 308 | 308 | show_message(msg, 'error'); |
| 309 | 309 | } |
| 310 | 310 | }, 'json'); |
| 311 | 311 | }); |
| @@ -339,14 +339,14 @@ | ||
| 339 | 339 | table.draw(false); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | show_message( |
| 343 | - __("Selected application passwords have been revoked."), | |
| 343 | + MainWP.I18n.t("Selected application passwords have been revoked."), | |
| 344 | 344 | "success" |
| 345 | 345 | ); |
| 346 | 346 | } else { |
| 347 | 347 | show_message( |
| 348 | - response.data.message || __("An error occurred."), | |
| 348 | + response.data.message || MainWP.I18n.t("An error occurred."), | |
| 349 | 349 | "error" |
| 350 | 350 | ); |
| 351 | 351 | } |
| 352 | 352 | }, |
| @@ -352,9 +352,9 @@ | ||
| 352 | 352 | }, |
| 353 | 353 | "json" |
| 354 | 354 | ).fail(() => { |
| 355 | 355 | show_message( |
| 356 | - __( | |
| 356 | + MainWP.I18n.t( | |
| 357 | 357 | "An error occurred while revoking the application passwords." |
| 358 | 358 | ), |
| 359 | 359 | "error" |
| 360 | 360 | ); |
| @@ -384,9 +384,9 @@ | ||
| 384 | 384 | |
| 385 | 385 | if (name.length === 0) { |
| 386 | 386 | app_pass_name_input.trigger("focus"); |
| 387 | 387 | show_message( |
| 388 | - __("Please enter an application name."), | |
| 388 | + MainWP.I18n.t("Please enter an application name."), | |
| 389 | 389 | "error" |
| 390 | 390 | ); |
| 391 | 391 | return false; |
| 392 | 392 | } |
| @@ -435,15 +435,15 @@ | ||
| 435 | 435 | }) |
| 436 | 436 | .modal("show"); |
| 437 | 437 | |
| 438 | 438 | show_message( |
| 439 | - __("Application password created successfully!"), | |
| 439 | + MainWP.I18n.t("Application password created successfully!"), | |
| 440 | 440 | "success" |
| 441 | 441 | ); |
| 442 | 442 | } else { |
| 443 | 443 | create_modal.modal("hide"); |
| 444 | 444 | show_message( |
| 445 | - response.data.message || __("An error occurred."), | |
| 445 | + response.data.message || MainWP.I18n.t("An error occurred."), | |
| 446 | 446 | "error" |
| 447 | 447 | ); |
| 448 | 448 | } |
| 449 | 449 | }, |
| @@ -451,9 +451,9 @@ | ||
| 451 | 451 | ).fail(() => { |
| 452 | 452 | submit_button.removeClass("loading disabled"); |
| 453 | 453 | create_modal.modal("hide"); |
| 454 | 454 | show_message( |
| 455 | - __( | |
| 455 | + MainWP.I18n.t( | |
| 456 | 456 | "An error occurred while creating the application password." |
| 457 | 457 | ), |
| 458 | 458 | "error" |
| 459 | 459 | ); |
| @@ -472,9 +472,9 @@ | ||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | const button = $(this); |
| 475 | 475 | const original_text = button.html(); |
| 476 | - button.html('<i class="check icon"></i> ' + __("Copied!")); | |
| 476 | + button.html('<i class="check icon"></i> ' + MainWP.I18n.t("Copied!")); | |
| 477 | 477 | |
| 478 | 478 | setTimeout(() => { |
| 479 | 479 | button.html(original_text); |
| 480 | 480 | }, 2000); |
| @@ -487,9 +487,9 @@ | ||
| 487 | 487 | e.preventDefault(); |
| 488 | 488 | |
| 489 | 489 | if ( |
| 490 | 490 | !confirm( |
| 491 | - __( | |
| 491 | + MainWP.I18n.t( | |
| 492 | 492 | "Are you sure you want to revoke this password? This action cannot be undone." |
| 493 | 493 | ) |
| 494 | 494 | ) |
| 495 | 495 | ) { |
| @@ -529,14 +529,14 @@ | ||
| 529 | 529 | }); |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | show_message( |
| 533 | - __("Application password revoked successfully."), | |
| 533 | + MainWP.I18n.t("Application password revoked successfully."), | |
| 534 | 534 | "success" |
| 535 | 535 | ); |
| 536 | 536 | } else { |
| 537 | 537 | show_message( |
| 538 | - response.data.message || __("An error occurred."), | |
| 538 | + response.data.message || MainWP.I18n.t("An error occurred."), | |
| 539 | 539 | "error" |
| 540 | 540 | ); |
| 541 | 541 | } |
| 542 | 542 | }, |
| @@ -543,9 +543,9 @@ | ||
| 543 | 543 | "json" |
| 544 | 544 | ).fail(() => { |
| 545 | 545 | button.prop("disabled", false).removeClass("disabled loading"); |
| 546 | 546 | show_message( |
| 547 | - __( | |
| 547 | + MainWP.I18n.t( | |
| 548 | 548 | "An error occurred while revoking the application password." |
| 549 | 549 | ), |
| 550 | 550 | "error" |
| 551 | 551 | ); |
| @@ -580,9 +580,9 @@ | ||
| 580 | 580 | }); |
| 581 | 581 | |
| 582 | 582 | if (selected.length === 0) { |
| 583 | 583 | show_message( |
| 584 | - __("Please select at least one application password."), | |
| 584 | + MainWP.I18n.t("Please select at least one application password."), | |
| 585 | 585 | "error" |
| 586 | 586 | ); |
| 587 | 587 | return false; |
| 588 | 588 | } |
| @@ -588,9 +588,9 @@ | ||
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | if ( |
| 591 | 591 | !confirm( |
| 592 | - __( | |
| 592 | + MainWP.I18n.t( | |
| 593 | 593 | "Are you sure you want to revoke the selected passwords? This action cannot be undone." |
| 594 | 594 | ) |
| 595 | 595 | ) |
| 596 | 596 | ) { |