A Template for Multilingual Tags/Plugins
Posted: Tue Sep 29, 2009 3:51 pm
This is now in the Forge:
http://dev.cmsmadesimple.org/projects/multilingualtag
I've also added a sort of demo of a multilingual tag, called 'Random Guest Book Entry (Multilingual)' to the forge
http://dev.cmsmadesimple.org/projects/randgbtag
At GeekMoot 2009 there were quite a few requesting multilingual tag/plugins and UDT's (User Defined Tags)
Here is my first effort at a multilingual tag template (a multilingual UDT template may follow.)
This is a working tag which is really a template to be used as a base for developing your own multilingual tags!
It does not really do anything! I do have a rather more useful multilingual tag on the way if this one goes well
1. The display language is controlled by setting the 'lang' parameter of the Tag described below.
If you do not set this then the Tag will use the language set in Admin:
'Site Admin / Global Settings / Default language'
If no language is set there, then the Tag uses the default (en_US)
2. The admin language (for Help and About text) is controlled by the setting in Admin (so it is per user):
'My Preferences / User Preferences / Language'
If no language is set there, then the Tag uses the default (en_US)
3. To add to your page or template use:
{sfi_multilingual_tag_template lang='en_US'}
Currently for this test template, these are the languages available. For display on the page, (as output of the tag), for which you set the following 'lang' parameters.
* English (en_US)
* German (de_DE)
* Spanish (es_ES)
* French (fr_FR)
* Dutch (nl_NL)
If you use a language which isn't available in the Tag, you get the default en_US...
These languages are also available as Tag 'Help' and 'About' text and these are set automatically as stated above.
I've not tried this with the MLE version of CMSMS, I will if I get time, but you should be OK if you specify a language.
(I'm not sure if MLE relies on the same database fields.)
Please check out the multilingual help and about text and also check out the code - there are extensive comments in the code.
Let me know if I can improve things!
Also let me know what you think and could you / would you use it?
To use it save the attachment to your plugin directory and rename from:
function.sfi_multilingual_tag_template.txt
to
function.sfi_multilingual_tag_template.php
Also I'd like to apologise in advance about the tag translations, I used Google Translation for it so it could be absolute rubbish! Sorry.
There is now also a sister post: A Template for Multilingual UDT's (User Defined Tags)
http://forum.cmsmadesimple.org/index.php/topic,37816.0.html
http://dev.cmsmadesimple.org/projects/multilingualtag
I've also added a sort of demo of a multilingual tag, called 'Random Guest Book Entry (Multilingual)' to the forge
http://dev.cmsmadesimple.org/projects/randgbtag
At GeekMoot 2009 there were quite a few requesting multilingual tag/plugins and UDT's (User Defined Tags)
Here is my first effort at a multilingual tag template (a multilingual UDT template may follow.)
This is a working tag which is really a template to be used as a base for developing your own multilingual tags!
It does not really do anything! I do have a rather more useful multilingual tag on the way if this one goes well

1. The display language is controlled by setting the 'lang' parameter of the Tag described below.
If you do not set this then the Tag will use the language set in Admin:
'Site Admin / Global Settings / Default language'
If no language is set there, then the Tag uses the default (en_US)
2. The admin language (for Help and About text) is controlled by the setting in Admin (so it is per user):
'My Preferences / User Preferences / Language'
If no language is set there, then the Tag uses the default (en_US)
3. To add to your page or template use:
{sfi_multilingual_tag_template lang='en_US'}
Currently for this test template, these are the languages available. For display on the page, (as output of the tag), for which you set the following 'lang' parameters.
* English (en_US)
* German (de_DE)
* Spanish (es_ES)
* French (fr_FR)
* Dutch (nl_NL)
If you use a language which isn't available in the Tag, you get the default en_US...
These languages are also available as Tag 'Help' and 'About' text and these are set automatically as stated above.
I've not tried this with the MLE version of CMSMS, I will if I get time, but you should be OK if you specify a language.
(I'm not sure if MLE relies on the same database fields.)
Please check out the multilingual help and about text and also check out the code - there are extensive comments in the code.
Let me know if I can improve things!
Also let me know what you think and could you / would you use it?
To use it save the attachment to your plugin directory and rename from:
function.sfi_multilingual_tag_template.txt
to
function.sfi_multilingual_tag_template.php
Also I'd like to apologise in advance about the tag translations, I used Google Translation for it so it could be absolute rubbish! Sorry.
There is now also a sister post: A Template for Multilingual UDT's (User Defined Tags)
http://forum.cmsmadesimple.org/index.php/topic,37816.0.html