Browse CVS Repository
Contents of /ruggregator/ruggregator/pre-setup.rb
Parent Directory
| Revision Log
| Revision Graph
Revision 1.2 -
( show annotations)
( download)
Mon May 16 00:55:08 2005 UTC
(18 years, 10 months ago)
by bluedwarf
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -1 lines
Remove test code
| 1 |
podir = srcdir_root + "/po" |
| 2 |
modir = srcdir_root + "/data/locale/%s/LC_MESSAGES/" |
| 3 |
msgfmt = "/usr/bin/env msgfmt" |
| 4 |
|
| 5 |
bindir = srcdir_root + "/bin" |
| 6 |
|
| 7 |
# create bin file from ruggregator.rb |
| 8 |
# remove library path settings code |
| 9 |
infile = open(srcdir_root + "/ruggregator.rb") |
| 10 |
outfile = open(bindir + "/ruggregator","w") |
| 11 |
i = 0 |
| 12 |
while line = infile.gets |
| 13 |
if /\# REMOVE ([0-9]*) LINES FROM HERE WHEN INSTALLING/ =~ line |
| 14 |
i = $1.to_i |
| 15 |
end |
| 16 |
outfile.puts line if i <= 0 |
| 17 |
i = i-1 |
| 18 |
end |
| 19 |
infile.close |
| 20 |
outfile.close |
| 21 |
|
| 22 |
|
| 23 |
# Creating mo file. |
| 24 |
begin |
| 25 |
require 'gettext' |
| 26 |
|
| 27 |
Dir.glob("po/*/*.po"){ |file| |
| 28 |
lang, basename = /po\/([\w\.]*)\/(.*)\.po/.match(file).to_a[1,2] |
| 29 |
molangdir = (modir % lang).split("/") |
| 30 |
molangdir.each_index{ |i| |
| 31 |
Dir.mkdir(molangdir[0..i].join("/")) unless FileTest.exist?(molangdir[0..i].join("/")) if i>0 |
| 32 |
} |
| 33 |
system("#{msgfmt} po/#{lang}/#{basename}.po -o #{modir % lang}#{basename}.mo") |
| 34 |
} |
| 35 |
rescue LoadError |
| 36 |
puts "L10n is not supported on this environment." |
| 37 |
end |
| 38 |
|
|