i18n_get_cache_id()
The i18n_get_cache_id()
function is used to get the cache ID from the GM-I18n system.
This function can only be used after the i18n_create()
function is called.
Syntax
Usage
i18n_get_cache_id(key, [data], [locale], [i18n]);
Parameters
Name | Type | Default | Description |
---|---|---|---|
key | String | The message key to get the cache ID from (e.g. hello , bye , long_text , etc.). | |
data | Integer | Any[] | Struct | undefined | The data to pass to the message, whether it's for pluralization (Integer ), indexed interpolation (Any[] ), or named interpolation (Struct ). |
locale | String | "" | The locale code to get the cache ID from (e.g. "en" , "id" , "ja" , etc.). Leave it empty to get the cache ID from the current locale. |
i18n | Boolean | I18n | false | The I18n struct reference, or leave it empty to use the global i18n struct. |
Returns
Integer
(the cache ID)
Examples
Create Event
// assume the system is initialized on global variable
// get the cache ID from "hello" key, from "en" locale
var cache_id = i18n_get_cache_id("hello", , "en");
// get the cache ID from "bye" key, from current locale
var cache_id2 = i18n_get_cache_id("bye");
// get the cache ID from "greet" key, from current locale
// using named data interpolation
var cache_id3 = i18n_get_cache_id("greet", {
name: "John" // {name} = "John"
});
The message caching isn't available for HTML5 export. So, this function will always return
-1
in HTML5.Table of Contents