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