-
Notifications
You must be signed in to change notification settings - Fork 2
language_identification
With ML Kit's on-device language identification API, you can determine the language of a string of text.
The following function is provided to work with the language identification API:
The following enumeration is used by the language identification API:
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:
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);
}
});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. |
GameMaker 2026