Developer Documentation

Getting Started

Welcome to the developer documentation for integrating Written Translator into your website. This guide will help you get started with adding the necessary script and calling the function to begin translations.

Overview

  1. Sign Up
  2. Add the Script to Your Website
  3. Call the WTStartTranslation Function
  4. Example
  5. Troubleshooting

1. Sign Up

To use Written Translator, an api key is required. This api key will be associated to your account at signup.

Visit the Account Page to find your api key.

2. Adding the Script to Your Website

To use the WTStartTranslation function, you need to include the script in your HTML file. Follow these steps:

  1. Add the following script tag to your html headers
<script src="future/written-translator-package.js" accountKey="[API_KEY]"></script>

Replace [API_KEY] with your account's API Key from step 1.

3. Calling the WTStartTranslation Function

Once the script is included in your HTML file, you can call the WTStartTranslation function to start the translation process. The function takes two parameters: sourceLanguage and targetLanguage.

For single-page applications and dynamic content, call WTStartTranslation(s, t) AFTER content has rendered.

Function Signature

window.WTStartTranslation(sourceLanguage, targetLanguage);

sourceLanguage: The language code of the source language (e.g., 'en' for English).

targetLanguage: The language code of the target language (e.g., 'es' for Spanish).

4. Example Usage

Here is an example of how to call the WTStartTranslation function:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Translation Example</title>
    <script src="path/to/your/script.js"></script>
    <script>
        function startTranslation() {
            const sourceLanguage = 'en';
            const targetLanguage = 'es';
            window.WTStartTranslation(sourceLanguage, targetLanguage);
        }
    </script>
</head>
<body>
    <h1>Welcome to Our Website</h1>
    <p>This is an example paragraph that will be translated.</p>
</body>
</html>

In this example:

5. Troubleshooting

If you encounter any issues, consider the following troubleshooting steps:

For further assistance, please refer to the detailed documentation or contact support.

This concludes the getting started guide for integrating the WTStartTranslation function into your website. Happy translating!