LangSelect Smarty Plugin ======================== Name: LangSelect Type: class, compiler, postfilter Version: 1.1 Date: 14 May 2003 Author: Brodie Thiesfield Author: Alejandro Sarco Licence: BSD (see licence.txt) Description ----------- This plugin adds internationalization to any Smarty-based PHP application. You keep all of your localized strings in different files separate to the actual templates. It can internationalize straight text or generate localized text for a form select element. Features -------- * generate localized text * generate option lists with the specific language text inserted * option lists are completely selfcontained within the compiled template, no extra files are included. * the selected item may be dynamic or static * option tags are output in XHTML 1.1 valid format * different languages may be used for each option with the 'lang' and 'xml:lang' properties being added as appropriate to those tags. Files ----- readme.txt compiler.lang.php Compiler function compiler.lang_options.php Compiler function postfilter.langselect.php Post filter function langselect.php Class file Installation ------------ 1. copy the following files into the smarty/libs/plugins directory: compiler.lang.php compiler.lang_options.php postfilter.langselect.php 2. copy the langselect.php file into any directory that you can include it from. 3. where you create your $smarty object, load the postfilter using: $smarty->load_filter( 'post', 'langselect' ); Usage ----- The option lists are generated in xhtml compatible format, and may include items which are in multiple languages via the 'lang' tag, although to have multiple languages in the same (x)html you will probably need to use unicode or utf-8 encoding for the page. 1. Create the language dependent files with the option lists as an associative array. The items will be listed in the page in the same order that they are supplied in the array. The key of the array is the 'value' attribute, the value is either an array of (display text, language code) or just 'display text'. You have two ways of supplying this array: (1) Same language as the default language on the page. No lang or xml:lang attributes are added to the