# 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.

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(opens new window) 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 types="lipsurf-types/extension"/>
import HelloWorld from './HelloWorld';
  1. Set Plugin.languages!.ja to the localizeable things.

WARNING

Plugin.languages needs a non-null assertion operator.

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 types="lipsurf-types/extension"/>
import HelloWorld from "./HelloWorld";

HelloWorld.languages!.ja = {
    niceName: "世界のご案内",
    description: "非常に単純のプラグイン",
    commands: {
        "Hello World": {
            name: "ハロー・ワールド",
            match: "はろーわーるど"
        }
    }
};