mack-localization 0.6.1.1 → 0.6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Mack/Localization/Configuration.html +118 -0
- data/doc/classes/Mack/Localization/ContentCache.html +111 -0
- data/doc/classes/Mack/Localization/DateFormatEngine/BP.html +217 -0
- data/doc/classes/Mack/Localization/DateFormatEngine/Base.html +237 -0
- data/doc/classes/Mack/Localization/DateFormatEngine/DE.html +217 -0
- data/doc/classes/Mack/Localization/DateFormatEngine/EN.html +218 -0
- data/doc/classes/Mack/Localization/DateFormatEngine/ES.html +217 -0
- data/doc/classes/Mack/Localization/DateFormatEngine/FR.html +217 -0
- data/doc/classes/Mack/Localization/DateFormatEngine/IT.html +217 -0
- data/doc/classes/Mack/Localization/Errors/FormatEngineNotFound.html +153 -0
- data/doc/classes/Mack/Localization/Errors/InvalidArgument.html +146 -0
- data/doc/classes/Mack/Localization/Errors/InvalidConfiguration.html +117 -0
- data/doc/classes/Mack/Localization/Errors/InvalidMethodName.html +153 -0
- data/doc/classes/Mack/Localization/Errors/LanguageFileNotFound.html +152 -0
- data/doc/classes/Mack/Localization/Errors/UnknownStringKey.html +153 -0
- data/doc/classes/Mack/Localization/Errors/UnsupportedEncoding.html +153 -0
- data/doc/classes/Mack/Localization/Errors/UnsupportedFeature.html +152 -0
- data/doc/classes/Mack/Localization/Errors/UnsupportedLanguage.html +153 -0
- data/doc/classes/Mack/Localization/FormatEngineRegistry.html +245 -0
- data/doc/classes/Mack/Localization/Formatter.html +392 -0
- data/doc/classes/Mack/Localization/NumberAndCurrencyFormatEngine/BP.html +196 -0
- data/doc/classes/Mack/Localization/NumberAndCurrencyFormatEngine/Base.html +250 -0
- data/doc/classes/Mack/Localization/NumberAndCurrencyFormatEngine/DE.html +196 -0
- data/doc/classes/Mack/Localization/NumberAndCurrencyFormatEngine/EN.html +196 -0
- data/doc/classes/Mack/Localization/NumberAndCurrencyFormatEngine/ES.html +196 -0
- data/doc/classes/Mack/Localization/NumberAndCurrencyFormatEngine/FR.html +196 -0
- data/doc/classes/Mack/Localization/NumberAndCurrencyFormatEngine/IT.html +196 -0
- data/doc/classes/Mack/Localization/Translator.html +275 -0
- data/doc/classes/Mack/ViewHelpers/L10NHelpers/Context.html +278 -0
- data/doc/classes/Mack/ViewHelpers/L10NHelpers.html +402 -0
- data/doc/classes/Mack.html +194 -0
- data/doc/classes/Object.html +236 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +107 -0
- data/doc/files/lib/mack-localization/configuration_rb.html +110 -0
- data/doc/files/lib/mack-localization/content_cache_rb.html +101 -0
- data/doc/files/lib/mack-localization/errors_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/df_engines/base_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/df_engines/bp_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/df_engines/de_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/df_engines/en_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/df_engines/es_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/df_engines/fr_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/df_engines/it_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/engine_registry_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/nc_engines/base_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/nc_engines/bp_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/nc_engines/de_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/nc_engines/en_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/nc_engines/es_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/nc_engines/fr_rb.html +101 -0
- data/doc/files/lib/mack-localization/format_engine/nc_engines/it_rb.html +101 -0
- data/doc/files/lib/mack-localization/formatter_rb.html +101 -0
- data/doc/files/lib/mack-localization/helpers/view_helpers/l10n_helpers_rb.html +101 -0
- data/doc/files/lib/mack-localization/translator_rb.html +101 -0
- data/doc/files/lib/mack-localization_rb.html +109 -0
- data/doc/fr_class_index.html +58 -0
- data/doc/fr_file_index.html +49 -0
- data/doc/fr_method_index.html +108 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- metadata +63 -2
@@ -0,0 +1,392 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Mack::Localization::Formatter</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::Localization::Formatter</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-localization/formatter_rb.html">
|
59
|
+
lib/mack-localization/formatter.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="../../Object.html">
|
69
|
+
Object
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="method-list">
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
89
|
+
|
90
|
+
<div class="name-list">
|
91
|
+
<a href="#M000080">currency_format</a>
|
92
|
+
<a href="#M000082">currency_format_registry_key</a>
|
93
|
+
<a href="#M000078">date_format</a>
|
94
|
+
<a href="#M000081">date_format_registry_key</a>
|
95
|
+
<a href="#M000077">new</a>
|
96
|
+
<a href="#M000079">number_format</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if includes -->
|
104
|
+
<div id="includes">
|
105
|
+
<h3 class="section-bar">Included Modules</h3>
|
106
|
+
|
107
|
+
<div id="includes-list">
|
108
|
+
<span class="include-name">Singleton</span>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<div id="section">
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<!-- if method_list -->
|
122
|
+
<div id="methods">
|
123
|
+
<h3 class="section-bar">Public Class methods</h3>
|
124
|
+
|
125
|
+
<div id="method-M000077" class="method-detail">
|
126
|
+
<a name="M000077"></a>
|
127
|
+
|
128
|
+
<div class="method-heading">
|
129
|
+
<a href="#M000077" class="method-signature">
|
130
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
131
|
+
</a>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div class="method-description">
|
135
|
+
<p>
|
136
|
+
Initialize the formatter object. Out of the box it will register 5 language
|
137
|
+
supports for both the date and currency format
|
138
|
+
</p>
|
139
|
+
<p><a class="source-toggle" href="#"
|
140
|
+
onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
|
141
|
+
<div class="method-source-code" id="M000077-source">
|
142
|
+
<pre>
|
143
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/formatter.rb, line 12</span>
|
144
|
+
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
145
|
+
13: <span class="ruby-ivar">@reg</span> = <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Localization</span><span class="ruby-operator">::</span><span class="ruby-constant">FormatEngineRegistry</span>.<span class="ruby-identifier">instance</span>
|
146
|
+
14:
|
147
|
+
15: [<span class="ruby-identifier">:en</span>, <span class="ruby-identifier">:bp</span>, <span class="ruby-identifier">:fr</span>, <span class="ruby-identifier">:it</span>, <span class="ruby-identifier">:de</span>, <span class="ruby-identifier">:es</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lang</span><span class="ruby-operator">|</span>
|
148
|
+
16: <span class="ruby-identifier">klass</span> = <span class="ruby-node">"Mack::Localization::DateFormatEngine::#{lang.to_s.upcase}"</span>
|
149
|
+
17: <span class="ruby-ivar">@reg</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">date_format_registry_key</span>, <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>)
|
150
|
+
18: <span class="ruby-keyword kw">end</span>
|
151
|
+
19:
|
152
|
+
20: [<span class="ruby-identifier">:en</span>, <span class="ruby-identifier">:bp</span>, <span class="ruby-identifier">:fr</span>, <span class="ruby-identifier">:it</span>, <span class="ruby-identifier">:de</span>, <span class="ruby-identifier">:es</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lang</span><span class="ruby-operator">|</span>
|
153
|
+
21: <span class="ruby-identifier">klass</span> = <span class="ruby-node">"Mack::Localization::NumberAndCurrencyFormatEngine::#{lang.to_s.upcase}"</span>
|
154
|
+
22: <span class="ruby-ivar">@reg</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">currency_format_registry_key</span>, <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>)
|
155
|
+
23: <span class="ruby-keyword kw">end</span>
|
156
|
+
24: <span class="ruby-keyword kw">end</span>
|
157
|
+
</pre>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
163
|
+
|
164
|
+
<div id="method-M000080" class="method-detail">
|
165
|
+
<a name="M000080"></a>
|
166
|
+
|
167
|
+
<div class="method-heading">
|
168
|
+
<a href="#M000080" class="method-signature">
|
169
|
+
<span class="method-name">currency_format</span><span class="method-args">(num, lang)</span>
|
170
|
+
</a>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<div class="method-description">
|
174
|
+
<p>
|
175
|
+
Given a currency, format it according to the specified language
|
176
|
+
</p>
|
177
|
+
<p>
|
178
|
+
params:
|
179
|
+
</p>
|
180
|
+
<pre>
|
181
|
+
num - the amount of money to be formatted
|
182
|
+
lang - the language
|
183
|
+
</pre>
|
184
|
+
<p>
|
185
|
+
returns:
|
186
|
+
</p>
|
187
|
+
<pre>
|
188
|
+
the multibyte version of the formatted string
|
189
|
+
</pre>
|
190
|
+
<p>
|
191
|
+
see also:
|
192
|
+
</p>
|
193
|
+
<pre>
|
194
|
+
l10n_currency in view_helpers
|
195
|
+
</pre>
|
196
|
+
<p>
|
197
|
+
examples:
|
198
|
+
</p>
|
199
|
+
<pre>
|
200
|
+
currency_format(10000.00, :en) will produce "$10,000.00"
|
201
|
+
</pre>
|
202
|
+
<p><a class="source-toggle" href="#"
|
203
|
+
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
|
204
|
+
<div class="method-source-code" id="M000080-source">
|
205
|
+
<pre>
|
206
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/formatter.rb, line 91</span>
|
207
|
+
91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">currency_format</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">lang</span>)
|
208
|
+
92: <span class="ruby-identifier">engine</span> = <span class="ruby-ivar">@reg</span>.<span class="ruby-identifier">get_engine</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">currency_format_registry_key</span>)
|
209
|
+
93: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Localization</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">FormatEngineNotFound</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lang</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">engine</span>.<span class="ruby-identifier">nil?</span>
|
210
|
+
94: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">u</span>(<span class="ruby-identifier">engine</span>.<span class="ruby-identifier">format_currency</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">lang</span>))
|
211
|
+
95: <span class="ruby-keyword kw">end</span>
|
212
|
+
</pre>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div id="method-M000082" class="method-detail">
|
218
|
+
<a name="M000082"></a>
|
219
|
+
|
220
|
+
<div class="method-heading">
|
221
|
+
<a href="#M000082" class="method-signature">
|
222
|
+
<span class="method-name">currency_format_registry_key</span><span class="method-args">()</span>
|
223
|
+
</a>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div class="method-description">
|
227
|
+
<p>
|
228
|
+
Return the registry key for currency formatter
|
229
|
+
</p>
|
230
|
+
<p><a class="source-toggle" href="#"
|
231
|
+
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
|
232
|
+
<div class="method-source-code" id="M000082-source">
|
233
|
+
<pre>
|
234
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/formatter.rb, line 107</span>
|
235
|
+
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">currency_format_registry_key</span>
|
236
|
+
108: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:currency_format</span>
|
237
|
+
109: <span class="ruby-keyword kw">end</span>
|
238
|
+
</pre>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div id="method-M000078" class="method-detail">
|
244
|
+
<a name="M000078"></a>
|
245
|
+
|
246
|
+
<div class="method-heading">
|
247
|
+
<a href="#M000078" class="method-signature">
|
248
|
+
<span class="method-name">date_format</span><span class="method-args">(time, type, lang)</span>
|
249
|
+
</a>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<div class="method-description">
|
253
|
+
<p>
|
254
|
+
Given a time, format according to the specified type (:short, :medium,
|
255
|
+
:long) and language.
|
256
|
+
</p>
|
257
|
+
<p>
|
258
|
+
params:
|
259
|
+
</p>
|
260
|
+
<pre>
|
261
|
+
time - the instance of time to be formatted
|
262
|
+
type - what's the format? short, medium, or long
|
263
|
+
lang - the language
|
264
|
+
</pre>
|
265
|
+
<p>
|
266
|
+
returns:
|
267
|
+
</p>
|
268
|
+
<pre>
|
269
|
+
the multibyte version of the formatted string
|
270
|
+
</pre>
|
271
|
+
<p>
|
272
|
+
see also:
|
273
|
+
</p>
|
274
|
+
<pre>
|
275
|
+
l10n_date in view_helpers
|
276
|
+
</pre>
|
277
|
+
<p>
|
278
|
+
examples:
|
279
|
+
</p>
|
280
|
+
<pre>
|
281
|
+
time = Time.local(2008, "dec", 1)
|
282
|
+
date_format(time, :short, :en) will produce "12/01/2008"
|
283
|
+
date_format(time, :medium, :en) will produce "Tue, Dec 01, 2008"
|
284
|
+
date_format(time, :long, :en) will produce "Tuesday, December 01, 2008"
|
285
|
+
</pre>
|
286
|
+
<p><a class="source-toggle" href="#"
|
287
|
+
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
288
|
+
<div class="method-source-code" id="M000078-source">
|
289
|
+
<pre>
|
290
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/formatter.rb, line 47</span>
|
291
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_format</span>(<span class="ruby-identifier">time</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">lang</span>)
|
292
|
+
48: <span class="ruby-identifier">engine</span> = <span class="ruby-ivar">@reg</span>.<span class="ruby-identifier">get_engine</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">date_format_registry_key</span>)
|
293
|
+
49: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Localization</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">FormatEngineNotFound</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lang</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">engine</span>.<span class="ruby-identifier">nil?</span>
|
294
|
+
50: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">u</span>(<span class="ruby-identifier">engine</span>.<span class="ruby-identifier">format</span>(<span class="ruby-identifier">time</span>, <span class="ruby-identifier">type</span>))
|
295
|
+
51: <span class="ruby-keyword kw">end</span>
|
296
|
+
</pre>
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div id="method-M000081" class="method-detail">
|
302
|
+
<a name="M000081"></a>
|
303
|
+
|
304
|
+
<div class="method-heading">
|
305
|
+
<a href="#M000081" class="method-signature">
|
306
|
+
<span class="method-name">date_format_registry_key</span><span class="method-args">()</span>
|
307
|
+
</a>
|
308
|
+
</div>
|
309
|
+
|
310
|
+
<div class="method-description">
|
311
|
+
<p>
|
312
|
+
Return the registry key for date formatter
|
313
|
+
</p>
|
314
|
+
<p><a class="source-toggle" href="#"
|
315
|
+
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
|
316
|
+
<div class="method-source-code" id="M000081-source">
|
317
|
+
<pre>
|
318
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/formatter.rb, line 100</span>
|
319
|
+
100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_format_registry_key</span>
|
320
|
+
101: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:date_format</span>
|
321
|
+
102: <span class="ruby-keyword kw">end</span>
|
322
|
+
</pre>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
<div id="method-M000079" class="method-detail">
|
328
|
+
<a name="M000079"></a>
|
329
|
+
|
330
|
+
<div class="method-heading">
|
331
|
+
<a href="#M000079" class="method-signature">
|
332
|
+
<span class="method-name">number_format</span><span class="method-args">(num, lang)</span>
|
333
|
+
</a>
|
334
|
+
</div>
|
335
|
+
|
336
|
+
<div class="method-description">
|
337
|
+
<p>
|
338
|
+
Given a number, format it according to the specified language
|
339
|
+
</p>
|
340
|
+
<p>
|
341
|
+
params:
|
342
|
+
</p>
|
343
|
+
<pre>
|
344
|
+
num - the number to be formatted
|
345
|
+
lang - the language
|
346
|
+
</pre>
|
347
|
+
<p>
|
348
|
+
returns:
|
349
|
+
</p>
|
350
|
+
<pre>
|
351
|
+
the multibyte version of the formatted string
|
352
|
+
</pre>
|
353
|
+
<p>
|
354
|
+
see also:
|
355
|
+
</p>
|
356
|
+
<pre>
|
357
|
+
l10n_number in view_helpers
|
358
|
+
</pre>
|
359
|
+
<p>
|
360
|
+
examples:
|
361
|
+
</p>
|
362
|
+
<pre>
|
363
|
+
number_format(10000.00, :en) will produce "10,000.00"
|
364
|
+
</pre>
|
365
|
+
<p><a class="source-toggle" href="#"
|
366
|
+
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
367
|
+
<div class="method-source-code" id="M000079-source">
|
368
|
+
<pre>
|
369
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/formatter.rb, line 69</span>
|
370
|
+
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">number_format</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">lang</span>)
|
371
|
+
70: <span class="ruby-identifier">engine</span> = <span class="ruby-ivar">@reg</span>.<span class="ruby-identifier">get_engine</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">currency_format_registry_key</span>)
|
372
|
+
71: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Localization</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">FormatEngineNotFound</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lang</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">engine</span>.<span class="ruby-identifier">nil?</span>
|
373
|
+
72: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">u</span>(<span class="ruby-identifier">engine</span>.<span class="ruby-identifier">format_number</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">lang</span>))
|
374
|
+
73: <span class="ruby-keyword kw">end</span>
|
375
|
+
</pre>
|
376
|
+
</div>
|
377
|
+
</div>
|
378
|
+
</div>
|
379
|
+
|
380
|
+
|
381
|
+
</div>
|
382
|
+
|
383
|
+
|
384
|
+
</div>
|
385
|
+
|
386
|
+
|
387
|
+
<div id="validator-badges">
|
388
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
</body>
|
392
|
+
</html>
|
@@ -0,0 +1,196 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Mack::Localization::NumberAndCurrencyFormatEngine::BP</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::Localization::NumberAndCurrencyFormatEngine::BP</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/mack-localization/format_engine/nc_engines/bp_rb.html">
|
59
|
+
lib/mack-localization/format_engine/nc_engines/bp.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="Base.html">
|
69
|
+
Base
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="method-list">
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
89
|
+
|
90
|
+
<div class="name-list">
|
91
|
+
<a href="#M000059">delimiter</a>
|
92
|
+
<a href="#M000061">separator</a>
|
93
|
+
<a href="#M000060">unit</a>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
<!-- if includes -->
|
101
|
+
|
102
|
+
<div id="section">
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if method_list -->
|
112
|
+
<div id="methods">
|
113
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
114
|
+
|
115
|
+
<div id="method-M000059" class="method-detail">
|
116
|
+
<a name="M000059"></a>
|
117
|
+
|
118
|
+
<div class="method-heading">
|
119
|
+
<a href="#M000059" class="method-signature">
|
120
|
+
<span class="method-name">delimiter</span><span class="method-args">()</span>
|
121
|
+
</a>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div class="method-description">
|
125
|
+
<p><a class="source-toggle" href="#"
|
126
|
+
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
127
|
+
<div class="method-source-code" id="M000059-source">
|
128
|
+
<pre>
|
129
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/format_engine/nc_engines/bp.rb, line 5</span>
|
130
|
+
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delimiter</span>
|
131
|
+
6: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">","</span>
|
132
|
+
7: <span class="ruby-keyword kw">end</span>
|
133
|
+
</pre>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<div id="method-M000061" class="method-detail">
|
139
|
+
<a name="M000061"></a>
|
140
|
+
|
141
|
+
<div class="method-heading">
|
142
|
+
<a href="#M000061" class="method-signature">
|
143
|
+
<span class="method-name">separator</span><span class="method-args">()</span>
|
144
|
+
</a>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div class="method-description">
|
148
|
+
<p><a class="source-toggle" href="#"
|
149
|
+
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
150
|
+
<div class="method-source-code" id="M000061-source">
|
151
|
+
<pre>
|
152
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/format_engine/nc_engines/bp.rb, line 13</span>
|
153
|
+
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">separator</span>
|
154
|
+
14: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"."</span>
|
155
|
+
15: <span class="ruby-keyword kw">end</span>
|
156
|
+
</pre>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div id="method-M000060" class="method-detail">
|
162
|
+
<a name="M000060"></a>
|
163
|
+
|
164
|
+
<div class="method-heading">
|
165
|
+
<a href="#M000060" class="method-signature">
|
166
|
+
<span class="method-name">unit</span><span class="method-args">()</span>
|
167
|
+
</a>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="method-description">
|
171
|
+
<p><a class="source-toggle" href="#"
|
172
|
+
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000060-source">
|
174
|
+
<pre>
|
175
|
+
<span class="ruby-comment cmt"># File lib/mack-localization/format_engine/nc_engines/bp.rb, line 9</span>
|
176
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unit</span>
|
177
|
+
10: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"R$"</span>
|
178
|
+
11: <span class="ruby-keyword kw">end</span>
|
179
|
+
</pre>
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
|
188
|
+
</div>
|
189
|
+
|
190
|
+
|
191
|
+
<div id="validator-badges">
|
192
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
</body>
|
196
|
+
</html>
|