File: Rails.html

package info (click to toggle)
libgettext-ruby 1.7.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,892 kB
  • ctags: 1,198
  • sloc: ruby: 6,738; ansic: 67; makefile: 38; sql: 14; sh: 6
file content (172 lines) | stat: -rw-r--r-- 4,667 bytes parent folder | download
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>Module: GetText::Rails</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

    <script language="JavaScript" type="text/javascript">
    // <![CDATA[

        function toggleSource( id )
        {
          var elem
          var link

          if( document.getElementById )
          {
            elem = document.getElementById( id )
            link = document.getElementById( "l_" + id )
          }
          else if ( document.all )
          {
            elem = eval( "document.all." + id )
            link = eval( "document.all.l_" + id )
          }
          else
            return false;

          if( elem.style.display == "block" )
          {
            elem.style.display = "none"
            link.innerHTML = "show source"
          }
          else
          {
            elem.style.display = "block"
            link.innerHTML = "hide source"
          }
        }

        function openCode( url )
        {
          window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
        }
      // ]]>
    </script>
  </head>

  <body>
  <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
  <td class="file-title"><span class="file-title-prefix">Module</span><br />GetText::Rails</td>
  <td align="right">
    <table cellspacing=0 cellpadding=2>
      <tr valign="top">
        <td>In:</td>
        <td>
<a href="../../files/lib/gettext/rails_rb.html">lib/gettext/rails.rb</a>
        </td>
      </tr>
         </table>
        </td>
        </tr>
      </table>
 <!-- banner header -->

  <div id="bodyContent">
      <div id="content">

  <div class="description"><p>
<a href="Rails.html">GetText::Rails</a> supports Ruby on Rails. You add
only 2 lines in your controller, all of the controller/view/models are
targeted the textdomain.
</p>
<p>
See &lt;Ruby-<a href="../GetText.html">GetText</a>-Package HOWTO for Ruby
on Rails (<a
href="http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html">www.yotabanana.com/hiki/ruby-gettext-howto-rails.html</a>&gt;.
</p>
</div>



  <div class="sectiontitle">Methods</div>
  <ul>
  <li><a href="#M000050">bindtextdomain</a></li>
  </ul>

<div class="sectiontitle">Included Modules</div>
<ul>
  <li><a href="../GetText.html">GetText</a></li>
  <li><a href="../GetText.html">GetText</a></li>
</ul>



  <div class="sectiontitle">Constants</div>
  <table border='0' cellpadding='5'>
  <tr valign='top'>
    <td class="attr-name">Rails</td>
    <td>=</td>
    <td class="attr-value">::Rails  #:nodoc:</td>
  </tr>
  </table>


<div class="sectiontitle">Public Instance methods</div>
<div class="method">
  <div class="title">
    <a name="M000050"></a><b>bindtextdomain(domainname, options = {})<br />
</b>
[ <a href="javascript:openCode('Rails.src/M000050.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Bind a textdomain(#{path}/#{locale}/LC_MESSAGES/#{domainname}.mo) to your
program. Notes the textdomain scope becomes all of the
controllers/views/models in your app. This is different from normal
GetText.bindtextomain.
</p>
<p>
Usually, you don&#8217;t call this directly in your rails application. Call
init_gettext in <a
href="../ActionController/Base.html">ActionController::Base</a> instead.
</p>
<p>
On the other hand, you need to call this in helpers/plugins.
</p>
<ul>
<li>domainname: the textdomain name.

</li>
<li>options: options as a Hash.

<ul>
<li>:locale - the locale value such as &quot;ja-JP&quot;. When the value is
nil, locale is searched the order by this value &gt; &quot;lang&quot; value
of QUERY_STRING &gt; params[&quot;lang&quot;] &gt; &quot;lang&quot; value
of Cookie &gt; HTTP_ACCEPT_LANGUAGE value &gt; Default locale(en).

</li>
<li>:path - the path to the mo-files. Default is &quot;RAIL_ROOT/locale&quot;.

</li>
<li>:charset - the charset. Generally UTF-8 is recommanded. And the charset is
set order by &quot;the argument of bindtextdomain&quot; &gt;
HTTP_ACCEPT_CHARSET &gt; Default charset(UTF-8).

</li>
<li>:with_model - false if you want to ignore ActiveRecord support.

</li>
<li>:with_helper - false if you want to ignore ApplicationHelper support.

</li>
</ul>
</li>
</ul>
<p>
Note: Don&#8216;t use locale, charset, with_model argument(not in options).
They are remained for backward compatibility.
</p>
  </div>
</div>
</div>

  </div>

    </body>
</html>