File: pre-setup.rb

package info (click to toggle)
fantasdic 1.0beta7-5
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,220 kB
  • ctags: 1,103
  • sloc: ruby: 11,828; xml: 1,480; makefile: 58; ansic: 52; sh: 23
file content (27 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (2)
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
# Copyright (C) 2004-2005 Dafydd Harries
#
# Loosely based on pre-setup.rb from rbbr by Masao Mutoh.
#
# Modified by Mathieu Blondel for fantasdic

basename = "fantasdic"
config = Config::CONFIG
podir = srcdir_root + "/po/"

# Create MO files.

Dir.glob("po/*.po") do |file|
    lang = /po\/(.*)\.po/.match(file).to_a[1]
    mo_path_bits = ['data', 'locale', lang, 'LC_MESSAGES']
    mo_path = File.join(mo_path_bits)

    (0 ... mo_path_bits.length).each do |i|
        path = File.join(mo_path_bits[0 .. i])
        puts path
        Dir.mkdir(path) unless FileTest.exists?(path)
    end
    
    system("msgfmt po/#{lang}.po -o #{mo_path}/#{basename}.mo")

    $stderr.puts "msgfmt failed on po/#{lang}.po" if $? != 0
end