Translation
Rocket Scraper offers robust translation capabilities powered by state-of-the-art language models. Seamlessly translate content from any webpage across multiple languages while maintaining context and meaning, whether it's product descriptions, articles, or user-generated content.
Key Benefits
- High Accuracy: Get precise translations that preserve context and nuance
- Broad Language Support: Translate between multiple languages automatically
- Context-Aware: Maintains formatting and specialized terminology
How It Works
- Select Content: Choose the text elements you want to translate
- Set Languages: Specify source languages
- Process Content: Our models handle the translation
- Receive Results: Get translated content with original formatting
Example: Product Descriptions
Here's how to translate product descriptions to multiple languages:
- Python
- Node.js
- Curl
from rocketscraper import RocketClient
try:
client = RocketClient('YOUR_API_KEY')
schema = {
"originalText": "string",
"translation": {
"text": "string",
"sourceLanguage": "string",
"targetLanguage": "string"
}
}
# Specify translation parameters
task_description = """
Translate product descriptions to Spanish and French while preserving:
- Technical specifications
- Brand names
- Product measurements
"""
result = client.scrape(
'https://example.com/products/electronics',
schema,
task_description=task_description
)
print(result)
except Exception as e:
print(f"Error: {e}")
import { createRocketClient } from 'rocketscraper';
try {
const client = createRocketClient({
apiKey: 'YOUR_API_KEY'
});
const schema = {
originalText: "string",
translation: {
text: "string",
sourceLanguage: "string",
targetLanguage: "string"
}
};
// Specify translation parameters
const taskDescription = `
Translate product descriptions to Spanish and French while preserving:
- Technical specifications
- Brand names
- Product measurements
`;
const result = await client.scrape({
url: 'https://example.com/products/electronics',
schema,
taskDescription
});
console.log(result);
} catch (error) {
console.error('Error:', error.message);
}
curl -X POST \
https://api.rocketscraper.com/scrape \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/products/electronics",
"schema": {
"originalText": "string",
"translation": {
"text": "string",
"sourceLanguage": "string",
"targetLanguage": "string"
}
},
"taskDescription": "Translate product descriptions to Spanish and French while preserving technical specifications, brand names, and product measurements",
"targetLanguages": ["es", "fr"]
}'
Example Output
{
"originalText": "The XPS 13 Plus laptop features a 13.4-inch UHD+ (3840 x 2400) touch display, 12th Gen Intel® Core™ i7 processor, and up to 32GB of RAM.",
"translations": [
{
"text": "El portátil XPS 13 Plus cuenta con una pantalla táctil UHD+ de 13,4 pulgadas (3840 x 2400), procesador Intel® Core™ i7 de 12.ª generación y hasta 32 GB de RAM.",
"sourceLanguage": "en",
"targetLanguage": "es"
},
{
"text": "L'ordinateur portable XPS 13 Plus est doté d'un écran tactile UHD+ de 13,4 pouces (3840 x 2400), d'un processeur Intel® Core™ i7 de 12e génération et jusqu'à 32 Go de RAM.",
"sourceLanguage": "en",
"targetLanguage": "fr"
}
]
}
Best Practices
-
Preserve Formatting: Maintain HTML tags and special formatting in translations
-
Handle Special Terms: Create glossaries for brand names and technical terms
Common Use Cases
- E-commerce: Translate product descriptions and reviews
- Content Localization: Convert website content for international audiences
- Customer Support: Translate user inquiries and responses
- Documentation: Create multilingual technical documentation
- Social Media: Translate posts and user engagement
By utilizing our advanced translation capabilities, you can expand your global reach and provide seamless multilingual experiences for your users across different markets and languages.
Try It Now
Test Rocket Scraper's translation features in our interactive playground.