fix: add missed translations

This commit is contained in:
Ased Mammad 2024-03-03 13:31:34 +03:30
parent da0202851f
commit 6d2f462090
14 changed files with 126 additions and 76 deletions

View file

@ -241,7 +241,7 @@
location.href = '/';
}}
>
Check Again
{$i18n.t('Check Again')}
</button>
<button

View file

@ -156,7 +156,7 @@
);
if (selectedModels.includes('')) {
toast.error('Model not selected');
toast.error($i18n.t('Model not selected'));
} else if (messages.length != 0 && messages.at(-1).done != true) {
// Response not done
console.log('wait');
@ -166,7 +166,7 @@
) {
// Upload not done
toast.error(
`Oops! Hold tight! Your files are still in the processing oven. We're cooking them up to perfection. Please be patient and we'll let you know once they're ready.`
$i18n.t(`Oops! Hold tight! Your files are still in the processing oven. We're cooking them up to perfection. Please be patient and we'll let you know once they're ready.`)
);
} else {
// Reset chat message textarea height
@ -317,7 +317,7 @@
await sendPromptOllama(model, prompt, responseMessageId, _chatId);
}
} else {
toast.error(`Model ${modelId} not found`);
toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
}
})
);
@ -511,12 +511,12 @@
responseMessage.content = error.error;
}
} else {
toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
toast.error($i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: 'Ollama'}));
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: 'Ollama'});
}
responseMessage.error = true;
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: 'Ollama'});
responseMessage.done = true;
messages = messages;
}
@ -678,12 +678,12 @@
}
}
} else {
toast.error(`Uh-oh! There was an issue connecting to ${model}.`);
responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
toast.error($i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: model}));
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: model}});
}
responseMessage.error = true;
responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: model});
responseMessage.done = true;
messages = messages;
}
@ -747,7 +747,7 @@
);
}
} else {
toast.error(`Model ${modelId} not found`);
toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
}
};

View file

@ -2,7 +2,7 @@
import { v4 as uuidv4 } from 'uuid';
import { toast } from 'svelte-sonner';
import { onMount, tick } from 'svelte';
import { onMount, tick, getContext } from 'svelte';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
@ -40,6 +40,8 @@
import { RAGTemplate } from '$lib/utils/rag';
import { LITELLM_API_BASE_URL, OPENAI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
const i18n = getContext('i18n');
let loaded = false;
let stopResponseFlag = false;
@ -172,7 +174,7 @@
console.log('submitPrompt', $chatId);
if (selectedModels.includes('')) {
toast.error('Model not selected');
toast.error($i18n.t('Model not selected'));
} else if (messages.length != 0 && messages.at(-1).done != true) {
// Response not done
console.log('wait');
@ -330,7 +332,7 @@
await sendPromptOllama(model, prompt, responseMessageId, _chatId);
}
} else {
toast.error(`Model ${modelId} not found`);
toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
}
})
);
@ -524,12 +526,18 @@
responseMessage.content = error.error;
}
} else {
toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
toast.error(
$i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, { provider: 'Ollama' })
);
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
provider: 'Ollama'
});
}
responseMessage.error = true;
responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
provider: 'Ollama'
});
responseMessage.done = true;
messages = messages;
}
@ -691,12 +699,18 @@
}
}
} else {
toast.error(`Uh-oh! There was an issue connecting to ${model}.`);
responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
toast.error(
$i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, { provider: model })
);
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
provider: model
});
}
responseMessage.error = true;
responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
provider: model
});
responseMessage.done = true;
messages = messages;
}
@ -746,7 +760,7 @@
);
}
} else {
toast.error(`Model ${modelId} not found`);
toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
}
};

View file

@ -123,7 +123,7 @@
}
}
} else {
toast.error(`File not found.`);
toast.error($i18n.t(`File not found.`));
}
}

View file

@ -38,7 +38,9 @@
await goto('/prompts');
}
} else {
toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
toast.error(
$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
);
}
loading = false;

View file

@ -36,7 +36,9 @@
await goto('/prompts');
}
} else {
toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
toast.error(
$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
);
}
loading = false;