File: M000050.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 (43 lines) | stat: -rw-r--r-- 4,687 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
<?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>bindtextdomain (GetText::Rails)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.ruby-comment    { color: green; font-style: italic }
.ruby-constant   { color: #4433aa; font-weight: bold; }
.ruby-identifier { color: #222222;  }
.ruby-ivar       { color: #2233dd; }
.ruby-keyword    { color: #3333FF; font-weight: bold }
.ruby-node       { color: #777777; }
.ruby-operator   { color: #111111;  }
.ruby-regexp     { color: #662222; }
.ruby-value      { color: #662222; font-style: italic }
  .kw { color: #3333FF; font-weight: bold }
  .cmt { color: green; font-style: italic }
  .str { color: #662222; font-style: italic }
  .re  { color: #662222; }
</style>
</head>
<body bgcolor="white">
<pre><span class="ruby-comment cmt"># File lib/gettext/rails.rb, line 62</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bindtextdomain</span>(<span class="ruby-identifier">domainname</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">locale</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">charset</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">with_model</span> = <span class="ruby-keyword kw">true</span>)
      <span class="ruby-identifier">opt</span> = {<span class="ruby-identifier">:with_helper</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">:with_model</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>}
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">CGI</span>
        <span class="ruby-comment cmt"># For backward compatibility</span>
        <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">:cgi</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">:locale</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">locale</span>, <span class="ruby-identifier">:charset</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">charset</span>, <span class="ruby-identifier">:with_model</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">with_model</span>)
      <span class="ruby-keyword kw">else</span>
        <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">options</span>)
      <span class="ruby-keyword kw">end</span>
      <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:path</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">RAILS_ROOT</span>, <span class="ruby-value str">&quot;locale&quot;</span>)
      <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">set_current</span>(<span class="ruby-keyword kw">nil</span>)  <span class="ruby-comment cmt"># IMPORTANT! current locale should be nil once(default is used).</span>
      <span class="ruby-identifier">set_cgi</span>(<span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:cgi</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:cgi</span>]
      <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">_bindtextdomain</span>(<span class="ruby-identifier">domainname</span>, <span class="ruby-identifier">opt</span>)
      <span class="ruby-identifier">bindtextdomain_to</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>, <span class="ruby-identifier">domainname</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:with_model</span>]
      <span class="ruby-identifier">bindtextdomain_to</span>(<span class="ruby-constant">ApplicationHelper</span>, <span class="ruby-identifier">domainname</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:with_helper</span>]
      <span class="ruby-identifier">ret</span>
    <span class="ruby-keyword kw">end</span></pre>
</body>
</html>