File: M000026.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 (49 lines) | stat: -rw-r--r-- 4,934 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
<?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)</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.rb, line 56</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">opt</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">String</span>
      <span class="ruby-comment cmt"># For backward compatibility</span>
      <span class="ruby-identifier">opt</span> = {<span class="ruby-identifier">:path</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-keyword kw">elsif</span> <span class="ruby-identifier">options</span>
      <span class="ruby-identifier">opt</span> = <span class="ruby-identifier">options</span>
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>] = <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>] <span class="ruby-operator">?</span> <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>]) <span class="ruby-operator">:</span> <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">get</span>
    <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:charset</span>] = <span class="ruby-identifier">output_charset</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">output_charset</span>
    <span class="ruby-identifier">locale</span>.<span class="ruby-identifier">charset</span> = <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:charset</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:charset</span>]
    <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">set_current</span>(<span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>])
    <span class="ruby-identifier">manager</span> = <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">bound_target</span>]
    <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">manager</span>
      <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">set_locale</span>(<span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>]) 
    <span class="ruby-keyword kw">else</span>
      <span class="ruby-identifier">manager</span> = <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bound_target</span>, <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>])
      <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">bound_target</span>] = <span class="ruby-identifier">manager</span>
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">add_textdomain</span>(<span class="ruby-identifier">domainname</span>, <span class="ruby-identifier">opt</span>)
    <span class="ruby-identifier">manager</span>
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>