Language Engine

🌍 Free, keyless providers only. This demo calls MyMemory or LibreTranslate server-side — no Google/Microsoft account or API key involved. Free-tier limits apply (see README), and public LibreTranslate instances can be slow or occasionally unavailable since they're community-run.

🌐 Try a Translation

🔌 Web Integration

Call the endpoint directly from any Xcojo property:

fetch('https://dev.xcojo.com/Language/?text=' + encodeURIComponent('Welcome to Xcojo') + '&source=en&target=es')
    .then(r => r.json())
    .then(data => {
        if (data.status === 'success') {
            console.log(data.translated_text);
        } else {
            console.error(data.error);
        }
    });

Use LibreTranslate instead of the default MyMemory provider:

https://dev.xcojo.com/Language/?text=Hello&source=en&target=fr&provider=libre

Response Shape

{
  "status": "success",
  "provider": "mymemory",
  "source_lang": "en",
  "target_lang": "es",
  "source_text": "Welcome to Xcojo",
  "translated_text": "Bienvenido a Xcojo"
}

🔑 Bring-Your-Own-Key Providers

These are not wired up by default because they require an account and API key — but if Xcojo later needs higher volume or better quality than the free providers, here's how each plugs in.

Google Cloud Translation

// Requires a Google Cloud project + API key (billed per character past free credits)
$url = 'https://translation.googleapis.com/language/translate/v2?key=' . $apiKey;
$response = file_get_contents($url . '&q=' . urlencode($text) . '&source=' . $source . '&target=' . $target);

Microsoft Azure Translator

// Requires an Azure account + Translator resource key (2M chars/month free tier, then billed)
$ch = curl_init('https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=' . $source . '&to=' . $target);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Ocp-Apim-Subscription-Key: ' . $apiKey,
    'Ocp-Apim-Subscription-Region: ' . $region,
    'Content-Type: application/json',
]);

Apple

Apple does not offer a server-side translation API. Its Translate framework only runs on-device inside iOS/macOS apps — there's nothing for this PHP engine to call.

README & Developer Guide

Welcome to the Xcojo Language Engine & API. This service provides a single, centralized translation endpoint for xcojo.com properties, backed by free providers that require no API key.

API Parameters

Provider Comparison

ProviderCostSignupNotes
MyMemory Free None ~5,000 words/day per IP; more with an attribution email
LibreTranslate Free None Public instances are community-run — can be slow or briefly down
Google Cloud Translation Paid past free credit Required Needs a Google Cloud project + billing account
Microsoft Azure Translator Free tier, then paid Required 2M characters/month free, needs an Azure account
Apple No server-side API — on-device only, not usable here

Cross-Origin Integration (CORS)

All endpoints include automatic CORS headers (Access-Control-Allow-Origin: *) enabling cross-domain usage across xcojo.com subdomains.

Supported Languages

English (en), Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Dutch (nl), Russian (ru), Chinese (zh), Japanese (ja), Korean (ko), Arabic (ar), Hindi (hi), Swahili (sw), Turkish (tr), Polish (pl), Vietnamese (vi), Thai (th), Indonesian (id), Ukrainian (uk)