Skip to main content

Translation Overview

Neuredge's translation capability provides high-quality language translation powered by advanced neural machine translation models. Our service supports a wide range of languages and maintains context and nuance in translations.

Features

Core Capabilities

  • Multiple Language Pairs: Support for 100+ languages
  • Context Preservation: Maintains meaning across translations
  • Formatting Retention: Preserves document structure
  • Batch Translation: Process multiple texts efficiently

Quota Details

  • Free Tier: 100K tokens/month
  • $29 Plan: 1M tokens/month
  • $49 Plan: 1.5M tokens/month
  • Enterprise: Custom quotas available

Getting Started

Basic Usage

import { NeuredgeClient } from '@neuredge/sdk';

const client = new NeuredgeClient({
apiKey: 'your-api-key'
});

// Simple translation
const translation = await client.text.translate(
'Hello, how are you?',
{ targetLanguage: 'es' }
);

// With more options
const detailedTranslation = await client.text.translate(
'Hello, how are you?',
{
targetLanguage: 'es',
sourceLanguage: 'en',
preserveFormatting: true,
formalityLevel: 'formal'
}
);

Python Example

from neuredge_sdk import NeuredgeClient

client = NeuredgeClient("YOUR_API_KEY")

# Basic translation
translation = client.text.translate(
"Hello, how are you?",
target_language="es"
)

# Advanced options
detailed_translation = client.text.translate(
"Hello, how are you?",
target_language="es",
source_language="en",
preserve_formatting=True,
formality_level="formal"
)

Advanced Features

Batch Translation

const texts = [
'First sentence to translate',
'Second sentence to translate',
'Third sentence to translate'
];

const translations = await client.text.translateBatch(
texts,
{
targetLanguage: 'fr',
sourceLanguage: 'en'
}
);

Document Translation

const documentTranslation = await client.text.translateDocument(
documentText,
{
targetLanguage: 'de',
preserveFormatting: true,
maintainLayout: true
}
);

Auto Language Detection

const autoTranslation = await client.text.translate(
'こんにちは、お元気ですか?',
{
targetLanguage: 'en',
// sourceLanguage is optional - will be auto-detected
}
);

Best Practices

Optimizing Results

  1. Input Preparation

    • Clean input text
    • Provide context when necessary
    • Use appropriate formatting
  2. Language Selection

    • Specify source language when known
    • Use appropriate formality levels
    • Consider regional variants
  3. Error Handling

try {
const translation = await client.text.translate(
'Hello world',
{ targetLanguage: 'es' }
);
} catch (error) {
if (error.code === 'token_quota_exceeded') {
console.log('Token quota exceeded for this tier');
} else if (error.code === 'unsupported_language') {
console.log('Language pair not supported');
}
}

Use Cases

Content Localization

// Translate website content
const websiteTranslation = await client.text.translate(
websiteContent,
{
targetLanguage: 'es',
preserveHtml: true,
localizeUrls: true
}
);

Customer Support

// Auto-respond in customer's language
const response = await client.text.translate(
supportResponse,
{
targetLanguage: customerLanguage,
formalityLevel: 'formal',
tone: 'supportive'
}
);

Multi-language Documentation

// Translate technical documentation
const docTranslation = await client.text.translate(
technicalDoc,
{
targetLanguage: 'ja',
preserveFormatting: true,
preserveTechnicalTerms: true
}
);

Integration Examples

Translation Pipeline

async function processMultilingualContent(content: string) {
const languages = ['es', 'fr', 'de', 'ja'];
const translations = {};

// Translate to multiple languages
for (const lang of languages) {
const translation = await client.text.translate(
content,
{ targetLanguage: lang }
);

// Generate embeddings for search
const embedding = await client.embeddings.create({
text: translation,
model: 'embedding-v1'
});

translations[lang] = {
text: translation,
embedding: embedding.vector
};
}

return translations;
}

Real-time Chat Translation

async function translateChat(message: string, userLanguage: string) {
// Translate user message
const translatedMessage = await client.text.translate(
message,
{ targetLanguage: 'en' }
);

// Get AI response
const response = await client.text.generate({
model: 'base-v1',
prompt: translatedMessage,
maxTokens: 100
});

// Translate response back
const translatedResponse = await client.text.translate(
response.text,
{ targetLanguage: userLanguage }
);

return translatedResponse;
}

Supported Languages

Our service supports translations between 100+ languages. Here are some commonly used ones:

  • English (en)
  • Spanish (es)
  • French (fr)
  • German (de)
  • Japanese (ja)
  • Chinese (Simplified) (zh)
  • Russian (ru)
  • Arabic (ar)
  • Portuguese (pt)
  • Italian (it)