Action

dictate multilingual

Posted by @FlohGro, Last update 5 months ago

dictate multilingual Action Description

  • this action allows to start the dictation for different languages it is especially useful if you want to dictate in different languages (e.g. your native language and english)
  • the languages are presented in a customizable prompt to your need
  • if you run the action you’ll see a prompt with all the languages you didn’t disable - after you selected a language, the dictation interface will be shown for the selected language

Configuration of languages

  • to configure the languages you want to see, you need to edit the script step of this action
  • just open it and look for the array “locales” starting at line 4
  • if you want to diable a language to don’t show it in the prompt, just comment out that line by adding two forward slashes (“//”) at the beginning of the line
  • to e.g. dicatein either english or german, the array should look like this: const locales = [ ["German", "de"], // ["German (Germany)", "de_DE"], ["English (US)", "en_US"], // ["Spanish", "es"], // ["Spanish (Mexico)", "es_MX"], // ["Frensh", "fr"], // ["Italian", "it"], // ["Croatian", "hr"], // ["Serbian", "sr"], // ["Hungarian", "hu"], // ["Swedish", "sv"], // ["Greek (Greece)", "el_GR"], // ["Dutch", "nl"], // ["Swiss German", "gsw"], // ["Portugese", "pt"], // ["Czech", "cs"], // ["Icelandic", "is"], // ["Turkish", "tr"], // ["Danish", "da"], // ["Chinese", "zh"], // ["Japanese", "ja"], // ["Ukrainian", "uk"], // ["Polish", "pl"], // ["Russian", "ru"], ]
  • if you can’t find your language (or your variation) in the array, you can e.g. look into this file on gist. If you want to add a new language, just replace an existing one, or add a new element into the array

if you find this useful you can Buy Me A Coffee

Steps

  • script

    // dictate multilingual
    // created by @FlohGro
    
    const locales = [
    ["German", "de"],
    ["German (Germany)", "de_DE"],
    ["English (US)", "en_US"],
    ["Spanish", "es"],
    ["Spanish (Mexico)", "es_MX"],
    ["Frensh", "fr"],
    ["Italian", "it"],
    ["Croatian", "hr"],
    ["Serbian", "sr"],
    ["Hungarian", "hu"],
    ["Swedish", "sv"],
    ["Greek (Greece)", "el_GR"],
    ["Dutch", "nl"],
    ["Swiss German", "gsw"],
    ["Portugese", "pt"],
    ["Czech", "cs"],
    ["Icelandic", "is"],
    ["Turkish", "tr"],
    ["Danish", "da"],
    ["Chinese", "zh"],
    ["Japanese", "ja"],
    ["Ukrainian", "uk"],
    ["Polish", "pl"],
    ["Russian", "ru"],
    ]
    
    const baseURL = "drafts5://x-callback-url/dictate?"
    
    var p = Prompt.create();
    p.title = "select language";
    for (var language of locales) {
        p.addButton(language[0], language[1])
    }
    var con = p.show();
    
    if (con) {
        let selectedLanguage = p.buttonPressed
    
        var cb = CallbackURL.create()
        cb.baseURL = baseURL
        cb.addParameter("locale", selectedLanguage)
        cb.waitForResponse = false
        cb.open()
    } else {
        context.cancel();
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.