|
Revision 394, 2.3 kB
(checked in by gerd, 1 year ago)
|
Switched to patI18n
- removed all setLocale / getLocale functions from patForms, elements etc.
- use patI18n::dgettext with textdomain "patForms"
- added patI18n example
- added helper script to setup patI18n
- mended examples accordingly
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
include_once 'patExampleGen/prepend.php'; |
|---|
| 19 |
$exampleGen->displayHead( 'Example' ); |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
require_once $neededFiles['patForms']; |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
require_once $neededFiles['patErrorManager']; |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
require_once $neededFiles['patI18n']; |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
$moduleConf = array(); |
|---|
| 41 |
patI18n::addModule( 'Internal', $moduleConf ); |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
$moduleConf = array( |
|---|
| 45 |
'domain' => 'this_domain_is_not_used', |
|---|
| 46 |
'dir' => '/tmp', |
|---|
| 47 |
'domains' => array( |
|---|
| 48 |
|
|---|
| 49 |
'domain' => 'patForms', |
|---|
| 50 |
'dir' => dirname( __FILE__ ) . '/locales', |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
patI18n::addModule( 'Gettext', $moduleConf ); |
|---|
| 55 |
patI18n::setLocale( $_GET['lang'] ); |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
$elementsDefinition = array( |
|---|
| 62 |
'username' => array( |
|---|
| 63 |
'type' => 'String', |
|---|
| 64 |
'attributes' => array( |
|---|
| 65 |
'required' => 'yes', |
|---|
| 66 |
'display' => 'yes', |
|---|
| 67 |
'edit' => 'yes', |
|---|
| 68 |
'label' => 'Nickname', |
|---|
| 69 |
'description' => 'Enter your nickname here.', |
|---|
| 70 |
'maxlength' => '5', |
|---|
| 71 |
'minlength' => '4', |
|---|
| 72 |
'default' => 'The Argh', |
|---|
| 73 |
'title' => 'Username', |
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
$form =& patForms::createForm( $elementsDefinition ); |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
$form->setSubmitted( true ); |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
$form->validateForm(); |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
displayErrors( $form ); |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
$exampleGen->displayFooter(); |
|---|
| 96 |
?> |
|---|
| 97 |
|
|---|