File: M000043.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 (34 lines) | stat: -rw-r--r-- 2,954 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
<?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>msgmerge (GetText)</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" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/gettext/utils.rb, line 37</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">msgmerge</span>(<span class="ruby-identifier">defpo</span>, <span class="ruby-identifier">refpo</span>, <span class="ruby-identifier">app_version</span>) 
    <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">defpo</span>
    <span class="ruby-identifier">cmd</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;MSGMERGE_PATH&quot;</span>]
    <span class="ruby-identifier">cmd</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;msgmerge&quot;</span>

    <span class="ruby-identifier">cont</span> = <span class="ruby-value str">&quot;&quot;</span>
    <span class="ruby-keyword kw">if</span> <span class="ruby-constant">FileTest</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">defpo</span>
      <span class="ruby-identifier">cont</span> = <span class="ruby-node">`#{cmd} #{defpo} #{refpo}`</span>
    <span class="ruby-keyword kw">else</span>
      <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">refpo</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span> 
        <span class="ruby-identifier">cont</span> = <span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-identifier">cont</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/(Project-Id-Version\:).*$/</span>, <span class="ruby-node">&quot;\\1 #{app_version}\\n\&quot;&quot;</span>)
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">defpo</span>, <span class="ruby-value str">&quot;w&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">out</span><span class="ruby-operator">|</span> 
      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">cont</span>)
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">self</span>
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>