Updated toastr messages in openai.js to use translation function for better internationalization support.

9e71b70f75f8cbebde7d713ad17acf59b1db52fc

InterestingDarkness <computeridiot999@gmail.com>

1 files changed, +13 -13Ignore whitespace
public/scripts/openai.js+13 -13
@@ -5567,7 +5567,7 @@ async function onVertexAIValidateServiceAccount() {
5567 const jsonContent = String($('#vertexai_service_account_json').val()).trim();5567 const jsonContent = String($('#vertexai_service_account_json').val()).trim();
55685568
5569 if (!jsonContent) {5569 if (!jsonContent) {
5570 toastr.error('Please enter Service Account JSON content');5570 toastr.error(t`Please enter Service Account JSON content`);
5571 return;5571 return;
5572 }5572 }
55735573
@@ -5577,14 +5577,14 @@ async function onVertexAIValidateServiceAccount() {
5577 const missingFields = requiredFields.filter(field => !serviceAccount[field]);5577 const missingFields = requiredFields.filter(field => !serviceAccount[field]);
55785578
5579 if (missingFields.length > 0) {5579 if (missingFields.length > 0) {
5580 toastr.error(`Missing required fields: ${missingFields.join(', ')}`);5580 toastr.error(t`Missing required fields: ${missingFields.join(', ')}`);
5581 updateVertexAIServiceAccountStatus(false, `Missing fields: ${missingFields.join(', ')}`);5581 updateVertexAIServiceAccountStatus(false, t`Missing fields: ${missingFields.join(', ')}`);
5582 return;5582 return;
5583 }5583 }
55845584
5585 if (serviceAccount.type !== 'service_account') {5585 if (serviceAccount.type !== 'service_account') {
5586 toastr.error('Invalid service account type. Expected "service_account"');5586 toastr.error(t`Invalid service account type. Expected "service_account"`);
5587 updateVertexAIServiceAccountStatus(false, 'Invalid service account type');5587 updateVertexAIServiceAccountStatus(false, t`Invalid service account type`);
5588 return;5588 return;
5589 }5589 }
55905590
@@ -5598,12 +5598,12 @@ async function onVertexAIValidateServiceAccount() {
5598 // Show success status5598 // Show success status
5599 updateVertexAIServiceAccountStatus(true, `Project: ${serviceAccount.project_id}, Email: ${serviceAccount.client_email}`);5599 updateVertexAIServiceAccountStatus(true, `Project: ${serviceAccount.project_id}, Email: ${serviceAccount.client_email}`);
56005600
5601 toastr.success('Service Account JSON is valid and saved securely');5601 toastr.success(t`Service Account JSON is valid and saved securely`);
5602 saveSettingsDebounced();5602 saveSettingsDebounced();
5603 } catch (error) {5603 } catch (error) {
5604 console.error('JSON validation error:', error);5604 console.error('JSON validation error:', error);
5605 toastr.error('Invalid JSON format');5605 toastr.error(t`Invalid JSON format`);
5606 updateVertexAIServiceAccountStatus(false, 'Invalid JSON format');5606 updateVertexAIServiceAccountStatus(false, t`Invalid JSON format`);
5607 }5607 }
5608}5608}
56095609
@@ -5618,7 +5618,7 @@ async function onVertexAIClearServiceAccount() {
5618 await writeSecret(SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT, '');5618 await writeSecret(SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT, '');
56195619
5620 updateVertexAIServiceAccountStatus(false);5620 updateVertexAIServiceAccountStatus(false);
5621 toastr.info('Service Account JSON cleared');5621 toastr.info(t`Service Account JSON cleared`);
5622 saveSettingsDebounced();5622 saveSettingsDebounced();
5623}5623}
56245624
@@ -5638,12 +5638,12 @@ function onVertexAIServiceAccountJsonChange() {
5638 const hasAllFields = requiredFields.every(field => serviceAccount[field]);5638 const hasAllFields = requiredFields.every(field => serviceAccount[field]);
56395639
5640 if (hasAllFields && serviceAccount.type === 'service_account') {5640 if (hasAllFields && serviceAccount.type === 'service_account') {
5641 updateVertexAIServiceAccountStatus(false, 'JSON appears valid - click "Validate JSON" to save');5641 updateVertexAIServiceAccountStatus(false, t`JSON appears valid - click "Validate JSON" to save`);
5642 } else {5642 } else {
5643 updateVertexAIServiceAccountStatus(false, 'Incomplete or invalid JSON');5643 updateVertexAIServiceAccountStatus(false, t`Incomplete or invalid JSON`);
5644 }5644 }
5645 } catch (error) {5645 } catch (error) {
5646 updateVertexAIServiceAccountStatus(false, 'Invalid JSON format');5646 updateVertexAIServiceAccountStatus(false, t`Invalid JSON format`);
5647 }5647 }
5648 } else {5648 } else {
5649 updateVertexAIServiceAccountStatus(false);5649 updateVertexAIServiceAccountStatus(false);
@@ -5665,7 +5665,7 @@ function updateVertexAIServiceAccountStatus(isValid = false, message = '') {
5665 // If no explicit message provided, check if we have a saved service account5665 // If no explicit message provided, check if we have a saved service account
5666 if (!message && secret_state[SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT]) {5666 if (!message && secret_state[SECRET_KEYS.VERTEXAI_SERVICE_ACCOUNT]) {
5667 isValid = true;5667 isValid = true;
5668 message = 'Service Account JSON is saved and ready to use';5668 message = t`Service Account JSON is saved and ready to use`;
5669 }5669 }
56705670
5671 if (isValid && message) {5671 if (isValid && message) {