File: M000079.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 (46 lines) | stat: -rw-r--r-- 3,372 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
<?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>set (Locale)</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/locale.rb, line 153</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">country</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">charset</span> = <span class="ruby-keyword kw">nil</span>)
    <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lang</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Numeric</span>
      <span class="ruby-identifier">warn</span> <span class="ruby-value str">&quot;Locale.set(lctype, locale) is deprecated. Use Locale.set(locale) instead.&quot;</span> 
      <span class="ruby-comment cmt"># Locale.set(Locale::CTYPE, &quot;ja_JP.eucJP&quot;) &quot;country&quot; means locale.</span>
      <span class="ruby-identifier">lang</span> = <span class="ruby-identifier">country</span>
      <span class="ruby-identifier">country</span> = <span class="ruby-keyword kw">nil</span>
      <span class="ruby-identifier">charset</span> = <span class="ruby-keyword kw">nil</span>
    <span class="ruby-keyword kw">end</span>

    <span class="ruby-identifier">set_current</span>(<span class="ruby-keyword kw">nil</span>)
    <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lang</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">String</span>
      <span class="ruby-identifier">set_default</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">lang</span>, <span class="ruby-identifier">country</span>, <span class="ruby-identifier">charset</span>))
    <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">lang</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Object</span>
      <span class="ruby-identifier">set_default</span>(<span class="ruby-identifier">lang</span>)
    <span class="ruby-keyword kw">else</span>
      <span class="ruby-identifier">set_default</span>(<span class="ruby-keyword kw">nil</span>)
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-ivar">@@default</span>
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>