Internationalization

LipSurf was designed from the ground-up with multi-language support in mind.

LipSurf uses the built-in HTML5 speech-recognizer, hence it supports all of the languages that the Google speech recognizer does, in theory.

TIP

For a list of supported languages see here: https://cloud.google.com/speech-to-text/docs/languages

The base language is English, but any plugin can have its metadata and match phrases/functions adjusted to be compatible with other languages.

The languages that a given plugin supports are shown in the options.

Screenshot of plugin's supported languages

Once a user has at least one plugin installed that supports a given language, they can switch to that language in the general options.

Screenshot of language selection in the options

Example

Let's localize the hello world plugin from the quick start guide earlier.

  1. Create a new file HelloWorld.ja.ts in the HelloWorld folder where in this case ja is the ISO 639-1 language code for Japanese, what we're localizing for in this example.

  2. Import the English (base) plugin so we can reference it and extend it's language property.

/// lipsurf-plugins/src/HelloWorld/HelloWorld.ja.ts
/// <reference path="../@types/plugin-interface.d.ts"/>
import { HelloWorldPlugin } from './HelloWorld';
  1. Set Plugin.languages.ja to the localizeable things.

You can localize all the things that make sense to: nice names (the pretty ones🌼), descriptions, match patterns etc.

The commands property should be an object with keys of command names that map to the English command names they localize and of type ILocalizedCommand).

// lipsurf-plugins/src/HelloWorld/HelloWorld.ja.ts
/// <reference path="../@types/plugin-interface.d.ts"/>
import { HelloWorldPlugin } from "./HellowWorld";

HelloWorldPlugin.Plugin.languages.ja = {
    niceName: "世界のご案内",
    description: "非常に単純のプラグイン",
    commands: {
        "Hello World": {
            name: "ハロー・ワールド",
            match: "はろーわーるど"
        }
    }
};
Last updated: 12/5/2018, 4:37:16 AM