-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
80 lines (57 loc) · 1.73 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
sfFormI18nNumberPlugin
==============
The `sfFormI18nNumberPlugin` is a symfony plugin that provides an widget and validator for
internationalized numbers.
Installation
------------
* Install the plugin
$ symfony plugin:install sfFormI18nNumberPlugin
* Clear you cache
$ symfony cc
Use of the Validator and Widget
-----------------------
After you create in your schema a number-field with type double, float or decimal,
change your form as follows:
before
[php]
public function configure()
{
// widgets
$this->setWidgets(array(
'number' => new sfWidgetFormInput(),
));
// validators
$this->setValidators(array(
'number' => new sfValidatorNumber(),
));
}
after
[php]
public function configure()
{
// widgets
$this->setWidgets(array(
'number' => new sfWidgetFormI18nNumber(),
));
// validators
$this->setValidators(array(
'number' => new sfValidatorI18nNumber(),
));
}
Configuration
-----------------------
The widget and the validator takes the culture to recognize, convert and display numbers
from the user-session. If this is not possible or you want to use a different culture than
the culture of the user session, you can set a option.
[php]
// widgets
$this->setWidgets(array(
'number' => new sfWidgetFormI18nNumber(array('culture' => 'fr')),
));
// validators
$this->setValidators(array(
'number' => new sfValidatorI18nNumber(array('culture' => 'fr')),
));
TODO
----
* tbd