The Localized Text plugin returns a localized version of the text specified by the {exp:localized_text} tag.
Example Usage This EE Code:
{exp:localized_text string="search_module_name" file="search" language="english"}
Returns this text:
Search
Parameters string - The string parameter is required. If the string parameter is omitted, no text will be returned.
The string parameter should contain the localized text key for which you want the value returned.
file - The file parameter is required. If the file parameter is omitted or invalid, the original text code contained within the string parameter will be returned.
The file parameter should contain the name of the module, plugin, or extension from which you want to pull the localized text. It should be provided exactly as it appears in the languages folder (without the prefix “lang.” or suffix “.php”).
language - The language parameter is optional. If the language parameter is omitted or invalid, the user’s default language will be used (or if the user is anonymous, the system’s default language will be used).
If the text contained within the string parameter does not exist in the specified file or language, the original text code will be returned.
Custom Language Files This plugin can be used to create custom language files.
Simply create files named “lang.my_localized_text.php” in your languages folders. (my_localized_text can be any string, though be careful to avoid conflicting with other files.) Examine an already existing language file for examples of how to setup the array keys and values.
Finished the Custom Text plugin, which is similar but doesn’t allow specifying language parameters. This decreases the plugin’s overhead, as each language file only needs to be loaded once per template.
I agree with Sim here, it would be great if there was a plugin that you could wrap the whole template in, that enables you to use whatever language variables you want through simply using the {lang:variable} syntax.
Does anyone know if this exists yet, as it was 11 months ago? Or maybe it is even possible in 1.6.0.. if so, could someone point me in the right direction?
Many thanks!
Patrick
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.