[GENERIC] Zend_Translate:
[zend.git] / documentation / manual / en / module_specs / Zend_Currency-Position.xml
blob6726aba9a8458ec4f35609b465d525a1b1bdf9a9
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Reviewed: no -->
3 <sect1 id="zend.currency.position">
4     <title>Where is the currency?</title>
6     <para>
7         The position where the currency sign or name will be displayed depends on the locale.
8         Still, when you want to define this setting yourself you have to use the
9         <property>display</property> option and provide one of the following constants:
10     </para>
12     <table id="zend.currency.position.table-1">
13         <title>Available positions for the currency</title>
15         <tgroup cols="2" align="left">
16             <thead>
17                 <row>
18                     <entry>Constant</entry>
19                     <entry>Description</entry>
20                 </row>
21             </thead>
23             <tbody>
24                 <row>
25                     <entry><constant>STANDARD</constant></entry>
26                     <entry>Sets the standard position as defined within the locale</entry>
27                 </row>
29                 <row>
30                     <entry><constant>RIGHT</constant></entry>
32                     <entry>
33                         Displays the currency representation at the right side of the value
34                     </entry>
35                 </row>
37                 <row>
38                     <entry><constant>LEFT</constant></entry>
40                     <entry>
41                         Displays the currency representation at the left side of the value
42                     </entry>
43                 </row>
44             </tbody>
45         </tgroup>
46     </table>
48     <example id="zend.currency.position.example-1">
49         <title>Setting the currency position</title>
51         <para>
52             Let's assume that your client has again set "en_US" as locale. Using no option the
53             returned value could look like this:
54         </para>
56         <programlisting language="php"><![CDATA[
57 $currency = new Zend_Currency(
58     array(
59         'value' => 100,
60     )
63 print $currency; // Could return '$ 100'
64 ]]></programlisting>
66         <para>
67             So by using the default setting the currency (in our case $) could either be
68             rendered left or right from the value. Now let's define a fixed position:
69         </para>
71         <programlisting language="php"><![CDATA[
72 $currency = new Zend_Currency(
73     array(
74         'value'    => 100,
75         'position' => Zend_Currency::RIGHT,
76     )
79 print $currency; // Could return '100 $';
80 ]]></programlisting>
82         <para>
83             Note that in the second snippet the position of <acronym>USD</acronym> is fixed
84             regardless of the used locale or currency.
85         </para>
86     </example>
87 </sect1>