Line 15: |
Line 15: |
| ... | | ... |
| </form> | | </form> |
− | | + | |
| <lexicon lang="fr"> | | <lexicon lang="fr"> |
| <entry> | | <entry> |
Line 26: |
Line 26: |
| There are three ways to do this: | | There are three ways to do this: |
| | | |
− | # Substitute another lexicon entry by it’s base name. This substitution will happen automagically:
| + | 1. Substitute another lexicon entry by it’s base name. This substitution will happen automagically: |
| | | |
| <lexicon lang="fr"> | | <lexicon lang="fr"> |
Line 39: |
Line 39: |
| </lexicon> | | </lexicon> |
| | | |
− | # Use a custom method in your FormMagick subclass that returns a hash of variables for substitution. This substitution will happen automagically if you use the ’params’ attribute of the lexicon XML element, and define the named method in your FormMagick subclass:
| + | 2. Use a custom method in your FormMagick subclass that returns a hash of variables for substitution. This substitution will happen automagically if you use the ’params’ attribute of the lexicon XML element, and define the named method in your FormMagick subclass: |
| | | |
| <lexicon lang="fr" params="getLexiconParams()"> | | <lexicon lang="fr" params="getLexiconParams()"> |
Line 47: |
Line 47: |
| </entry> | | </entry> |
| </lexicon> | | </lexicon> |
− | | + | |
| package MyFormMagick; | | package MyFormMagick; |
| our @ISA = (’CGI::FormMagick’); | | our @ISA = (’CGI::FormMagick’); |
Line 56: |
Line 56: |
| 1; | | 1; |
| | | |
− | # Pass a hashref to the localise() method. This substitution will happen automagically if you pass the hashref as an additional parameter to the localise() method:
| + | 3. Pass a hashref to the localise() method. This substitution will happen automagically if you pass the hashref as an additional parameter to the localise() method: |
| | | |
| <lexicon lang="fr"> | | <lexicon lang="fr"> |
Line 64: |
Line 64: |
| </entry> | | </entry> |
| </lexicon> | | </lexicon> |
− | | + | |
| ... | | ... |
| my $text = ’This text includes a {$var}.’; | | my $text = ’This text includes a {$var}.’; |
Line 88: |
Line 88: |
| | | |
| Translates a string into the end-user’s preferred language by checking their HTTP_ACCEPT_LANG variable and looking up a lexicon hash for that language (if it exists). If no translation can be found, returns the original string untranslated. | | Translates a string into the end-user’s preferred language by checking their HTTP_ACCEPT_LANG variable and looking up a lexicon hash for that language (if it exists). If no translation can be found, returns the original string untranslated. |
− | Takes the text to translate as the first argument, and optionally, a hashref of variables for substitution as the second argument. | + | Takes the text to translate as the first argument, and optionally, a hashref of variables for substitution as the second argument.<br /> |
| + | |
| WARNING WARNING WARNING: The internals of this routine will change significantly in version 0.60, when we remove Locale::Maketext from the equation. However, its output should still be the same. Just FYI. | | WARNING WARNING WARNING: The internals of this routine will change significantly in version 0.60, when we remove Locale::Maketext from the equation. However, its output should still be the same. Just FYI. |
| | | |
Line 119: |
Line 120: |
| More information about FormMagick may be found at http://sourceforge.net/projects/formmagick/ | | More information about FormMagick may be found at http://sourceforge.net/projects/formmagick/ |
| [http://wiki.contribs.org/CGI::FormMagick CGI::FormMagick] | | [http://wiki.contribs.org/CGI::FormMagick CGI::FormMagick] |
− | [[Category:Howto]]
| + | |
| [[Category:SME Server Development Framework]] | | [[Category:SME Server Development Framework]] |
| [[Category:Development Tools]] | | [[Category:Development Tools]] |
− | [[Category:SME9-Development]]
| |