Skip to content

language_identification

Francisco Dias edited this page Jun 23, 2026 · 1 revision

Language Identification

With ML Kit's on-device language identification API, you can determine the language of a string of text.

Functions

The following function is provided to work with the language identification API:

Constants

The following enumeration is used by the language identification API:



Back To Top

mlkit_language_identification_identify

Identifies the most likely language of the given text. The result is delivered to the callback.

Note

This function is only supported on Android and iOS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

mlkit_language_identification_identify(text, callback)
Argument Type Description
text String The text whose language should be identified.
callback Function The function called with the result (see below).

Returns:

N/A


Triggers:

Callback

Triggered when the identification request completes.

Key Type Description
status MLKitLanguageIdentificationStatus The outcome of the identification.
language_code String The identified BCP-47 language tag, or "und" if undetermined or on error.
error String or Undefined The error message, or undefined unless status is MLKitLanguageIdentificationStatus.Error.

Example:

mlkit_language_identification_identify("to be or not to be", function(_status, _language_code, _error) {
    if (_status == MLKitLanguageIdentificationStatus.Identified) {
        show_debug_message("Identified language: " + _language_code);
    }
});


Back To Top

MLKitLanguageIdentificationStatus

This enumeration contains the possible outcomes of a language identification request.

These constants are referenced by the following functions:


Member Description
Error An internal ML Kit error occurred (see the error callback argument).
Undetermined The language could not be determined.
Identified The language was successfully identified.


Clone this wiki locally