Fixed display of default source and target language, updated README for installation instructions
This commit is contained in:
1 parent
f90ec06a4f
commit
2753b07b09
6 files changed
+132
-12
No files matched your search
@@ -5,6 +5,7 @@
|
|||||||
.nitro
|
.nitro
|
||||||
.cache
|
.cache
|
||||||
dist
|
dist
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
# Node dependencies
|
# Node dependencies
|
||||||
node_modules
|
node_modules
|
||||||
@@ -22,3 +23,6 @@ logs
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
|
||||||
|
#IDE
|
||||||
|
.vscode
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
# Quick Ling Setup
|
||||||
|
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Make sure to install dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ollama Setup (Optional)
|
||||||
|
|
||||||
|
To use the translation service, you need to have Ollama installed and the translategemma model loaded.
|
||||||
|
|
||||||
|
### Installing Ollama
|
||||||
|
|
||||||
|
#### Linux and macOS
|
||||||
|
```bash
|
||||||
|
# Add Ollama repository
|
||||||
|
curl -fsSL https://ollama.com/install.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Windows (PowerShell)
|
||||||
|
```powershell
|
||||||
|
# Download and install
|
||||||
|
irm https://ollama.com/install.ps1 | iex
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pulling the TranslateGemma Model
|
||||||
|
|
||||||
|
After installing Ollama, pull the translategemma model:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Pull the translation model
|
||||||
|
ollama pull translategemma:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
For specific model versions:
|
||||||
|
```bash
|
||||||
|
# Pull a specific version
|
||||||
|
ollama pull translategemma:12b
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running Ollama Server
|
||||||
|
|
||||||
|
Start the Ollama server (runs on `localhost:11434` by default):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ollama serve
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development Server
|
||||||
|
|
||||||
|
Start the development server on `http://localhost:3000`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm run dev
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm dev
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn dev
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Production
|
||||||
|
|
||||||
|
Build the application for production:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm build
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun run build
|
||||||
|
```
|
||||||
|
|
||||||
|
Locally preview production build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm
|
||||||
|
npm run preview
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm preview
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn preview
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun run preview
|
||||||
|
```
|
||||||
|
|
||||||
|
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
||||||
@@ -3,13 +3,13 @@ import { useLanguages } from "~/composables/useLanguages";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label?: string;
|
label?: string;
|
||||||
modelValue: string;
|
modelValue?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: "update:modelValue", value: string): void;
|
|
||||||
}>();
|
const model = defineModel<string>({ default: 'en' });
|
||||||
|
|
||||||
const { languages } = useLanguages();
|
const { languages } = useLanguages();
|
||||||
</script>
|
</script>
|
||||||
@@ -21,10 +21,7 @@ const { languages } = useLanguages();
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
class="language-selector-input select"
|
class="language-selector-input select"
|
||||||
:value="props.modelValue"
|
v-model="model"
|
||||||
@change="
|
|
||||||
emit('update:modelValue', ($event.target as HTMLSelectElement).value)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<option v-for="lang in languages" :key="lang.code" :value="lang.code">
|
<option v-for="lang in languages" :key="lang.code" :value="lang.code">
|
||||||
{{ lang.name }}
|
{{ lang.name }}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import { useToast } from "~/composables/useToast";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label?: string;
|
label?: string;
|
||||||
text: string;
|
text: string | null;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
error?: string;
|
error?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|||||||
@@ -29,8 +29,12 @@ function detectBrowserLanguage(): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const detectedLang = detectBrowserLanguage();
|
const detectedLang = detectBrowserLanguage();
|
||||||
|
|
||||||
const defaultSource = detectedLang;
|
const defaultSource = detectedLang;
|
||||||
const defaultTarget = detectedLang === "en" ? "es" : "en";
|
var defaultTarget = "en"
|
||||||
|
if(detectedLang == "en") {
|
||||||
|
defaultTarget = "es";
|
||||||
|
}
|
||||||
|
|
||||||
export function useTranslation(options: UseTranslationOptions = {}) {
|
export function useTranslation(options: UseTranslationOptions = {}) {
|
||||||
const sourceText = ref("");
|
const sourceText = ref("");
|
||||||
@@ -96,6 +100,7 @@ export function useTranslation(options: UseTranslationOptions = {}) {
|
|||||||
options: {
|
options: {
|
||||||
onChunk?: (chunk: string) => void;
|
onChunk?: (chunk: string) => void;
|
||||||
onComplete?: (fullText: string) => void;
|
onComplete?: (fullText: string) => void;
|
||||||
|
model?: Ref<string>;
|
||||||
} = {},
|
} = {},
|
||||||
) {
|
) {
|
||||||
if (!isReadyToTranslate.value) {
|
if (!isReadyToTranslate.value) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ const {
|
|||||||
swapLanguages,
|
swapLanguages,
|
||||||
clearInput,
|
clearInput,
|
||||||
} = useTranslation({ model });
|
} = useTranslation({ model });
|
||||||
|
|
||||||
const { status, isReady, errorMessage, checkStatus } = useOllamaStatus();
|
const { status, isReady, errorMessage, checkStatus } = useOllamaStatus();
|
||||||
|
|
||||||
function handleTranslate() {
|
function handleTranslate() {
|
||||||
|
|||||||
Reference in new issue
Block a user