A real-time translation chat application built with SvelteKit, featuring streaming responses and support for 23 languages. Powered by Cohere's translation API with a clean, responsive interface.
Check out the demo
command-a-translate-08-2025
model# Clone the repository
git clone <your-repo-url>
cd hdys
# Install dependencies
pnpm install
# or
npm install
Create a .env
file in the project root:
COHERE_API_KEY=your_cohere_api_key_here
# Start development server
pnpm dev
# or
npm run dev
# Start dev server and open in browser
pnpm run dev -- --open
# Type checking
pnpm run check
pnpm run check:watch # watch mode
# Linting and formatting
pnpm lint # check formatting and linting
pnpm run format # format code
# Build for production
pnpm build
pnpm preview # preview production build
This app is configured with the Cloudflare Pages adapter and can be deployed in two ways:
Deploy as its own Cloudflare Pages site (e.g., translate.yourdomain.com
or your-app.pages.dev
).
Create a wrangler.toml
file in your project root:
name = "translation-chat-app"
compatibility_date = "2024-08-30"
pages_build_output_dir = ".svelte-kit/cloudflare"
[env.production.vars]
# Environment variables will be set in Cloudflare dashboard
Connect Repository:
Configure Build Settings:
npm run build
or pnpm build
.svelte-kit/cloudflare
Set Environment Variables:
COHERE_API_KEY
with your API keyDeploy:
your-project-name.pages.dev
translate.yourdomain.com
)For more advanced integration, you can build this as part of your existing SvelteKit site:
Copy Source Files:
src/routes/api/translate
to your existing siteInstall Dependencies:
# Add to your existing package.json
npm install @tailwindcss/forms @tailwindcss/typography
Update Configuration:
Variable | Required | Description |
---|---|---|
COHERE_API_KEY |
Yes | Your Cohere API key for translation services |
Apache 2.0 License