Plugin: Localized Text (localized text string variable loader)
Posted: 19 June 2006 04:27 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  77
Joined  02-22-2004

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.

File Attachments
pi.localized_text.php.zip  (File Size: 2KB - Downloads: 320)
Profile
 
 
Posted: 19 June 2006 04:29 PM   [ Ignore ]   [ # 1 ]  
Grad Student
Avatar
Rank
Total Posts:  77
Joined  02-22-2004

If all you are looking to do is create custom language files, I’m in the process of creating a simpler version with much less overhead.

However, if you want to be able to show text in multiple languages, use the plugin above.

Profile
 
 
Posted: 19 June 2006 07:41 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  77
Joined  02-22-2004

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.

Profile
 
 
Posted: 22 August 2006 11:09 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
RankRankRank
Total Posts:  301
Joined  06-28-2006

Couldn’t it rather be like this ? :

{exp:localized_text file="search" language="english"}
{lang
:search_module_name}
{
/exp:localized_text}

with the whole template wrapped inside the plugin’s tag pair.

 Signature 
Profile
 
 
Posted: 25 August 2006 06:04 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
RankRankRank
Total Posts:  301
Joined  06-28-2006

I would like to use this plugin for a whole multilingual interface with over 100 variables.
The above method would be definitely more handy.

 Signature 
Profile
 
 
Posted: 25 July 2007 07:49 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  684
Joined  08-19-2006

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

 Signature 

Patrick TT
Aussie Freelancer

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64529 Total Logged-in Users: 28
Total Topics: 81096 Total Anonymous Users: 23
Total Replies: 436396 Total Guests: 240
Total Posts: 517492    
Members ( View Memberlist )