Перейти к содержимому
Создать
ВойтиПрисоединиться бесплатно

Making experiences in other languages

Interartive.lang, Interartive.t() and Interartive.speak(): one experience, many languages.

Interartive is used in English and Spanish. The page around your experience changes language by itself; the words inside your experience change when you let Interartive know what they are.

1. List your words in interartive.json

{
  "language": "en",
  "strings": {
    "start": "Start",
    "score": "Score: {n}",
    "tap_many": "Tap {n} stars"
  }
}

Keep the {placeholders}: they are filled in by your code.

2. Show them with Interartive.t()

title.textContent = Interartive.t('start');
label.textContent = Interartive.t('score', { n: points });

Interartive.lang is the person's language ('en' or 'es'). Pass a fallback as the third argument if you like: Interartive.t('start', null, 'Start').

3. Check the translation

Interartive translates your words into Spanish after you publish. Open your experience in Dashboard › Experiences, then Spanish, to read and correct the translation of your words, title and description. Your corrections replace the automatic ones.

You can also write your own translations in interartive.json:

"strings": { "en": { "start": "Start" }, "es": { "start": "Empezar" } }

4. Read words aloud

Interartive.speak(text) reads text aloud in the person's language with the voices built into their device, with no network calls. It is especially useful for children who are learning to read.

No words at all

An experience that works with touch, sound and pictures alone works in every language. Add "wordless": true to interartive.json and it appears when people search for experiences that work in their language.