app.t
Description
Returns the translated string of the specified language key.
Parameters
Name | Required | Type | Default | Description |
---|---|---|---|---|
key | Yes | string | The language key used to fetch a string. If no string is found for the key, then the key is returned as the string. | |
vars | No | array | An array of variables to use for substitution in your string. For example, if your string is "This %s belongs to %s" and you pass ['Pizza', 'Bob'] for vars, the string returned will be "This Pizza belongs to Bob". | |
count | No | integer | 1 | The integer to use for pluralization. This is used if you provide different forms of your string based on the pluralization. For example, your lang key might define the following ['I have one index', 'I have many indices']. If you pass a value of 1 for vars then the first string will be returned by the translate function, if you pass a value of more than 1, then the second form will be returned. |
Examples
Various examples of app.t