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>msgmerge (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/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">"MSGMERGE_PATH"</span>]
<span class="ruby-identifier">cmd</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">"msgmerge"</span>
<span class="ruby-identifier">cont</span> = <span class="ruby-value str">""</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">"\\1 #{app_version}\\n\""</span>)
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">defpo</span>, <span class="ruby-value str">"w"</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>
|