iink SDK Web

How to default to English (United Kingdom)

How do I set the language recognition to default to English (United Kingdom) please?

Kind regards,

Glyn



Dear Glyn,


thank you for your question.


You can refer to our "Change the language" sample:

-The sample: https://myscript.github.io/iinkJS/examples/non-version-specific/change_language.html

-And the source: https://github.com/MyScript/iinkJS/blob/master/examples/non-version-specific/change_language.html


Best regards,


Olivier

I have followed the example and changed my code to:


 

editorElement.addEventListener('loaded', async (evt) => { //invalid arrow arrow function parameters
		    /**
		     * Retrieve the list of available recognition languages
		     * @param {Object} The editor recognition parameters
		     */
//			const currentLanguage = evt.target.editor.configuration.recognitionParams.iink.lang; //Semi-colon expected
			const currentLanguage = 'en_UK';
			const res = await iink.getAvailableLanguageList(evt.target.editor.configuration);

			if (languageElement.options.length === 0) {
				Object.keys(res.result).forEach((key) => {
					const selected = currentLanguage === key;
					languageElement.options[languageElement.options.length] = new Option(res.result[key], key, selected, selected);
				});
			}
		});

 However, the dropdown has a blank first row. When I click the dropdown the options are displayed.

I do not really need the dropdown as I just want to default to English (United Kingdom). So can I remove all the dropdown code and just have:


const configuration = editorElement.editor.configuration;
configuration.recognitionParams.iink.lang = 'en_UK';

How do I test if this is working (i.e., that 'en_UK' is being used and not 'en_US')?

 

 

Dear Glyn,


instead, you shall set "en_GB".


Best regards,


Olivier

Hi Olivier,

"en_GB" did not work either.

Kind regards,

Glyn


Dear Glyn,


if you do not want to offer the possibility to change language, the easier is that you set the "en_GB" language at the register:

  iink.register(editorElement, {
    recognitionParams: {
      type: 'TEXT',
      protocol: 'WEBSOCKET',
      server: {
        scheme: 'https',
        host: 'cloud.myscript.com',
        applicationKey: 'ac76a9e1-28b5-4fde-8664-aa4ff4782bce',
        hmacKey: '1e42dfd9-9eb0-4153-89de-e93c09a2aeec'
      },
      iink: {
      lang: 'en_GB',
        export: {
          jiix: {
            strokes: true
          }
        }
      }
    }
  });



Best regards,


Olivier


Login or Signup to post a comment