~ubuntu-branches/ubuntu/vivid/rabbit/vivid

« back to all changes in this revision

Viewing changes to update-mo.rb

  • Committer: Bazaar Package Importer
  • Author(s): Youhei SASAKI
  • Date: 2009-07-22 22:15:37 UTC
  • Revision ID: james.westby@ubuntu.com-20090722221537-iy7foj73p2kyuumi
Tags: upstream-0.6.1
ImportĀ upstreamĀ versionĀ 0.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
 
 
3
require 'fileutils'
 
4
 
 
5
msgfmts = ["msgfmt", "ruby -S rmsgfmt"]
 
6
 
 
7
podir = "po/"
 
8
modir = "data/locale/%s/LC_MESSAGES/"
 
9
 
 
10
Dir.glob("#{podir}*/*.po") do |file|
 
11
  _, lang, basename = file.sub(/\.po$/, '').split(File::SEPARATOR)
 
12
  outdir = modir % lang
 
13
  FileUtils.mkdir_p(outdir) unless File.directory?(outdir)
 
14
  msgfmts.each do |msgfmt|
 
15
    command = "#{msgfmt} #{file} -o #{outdir}#{basename}.mo"
 
16
    unless system(command)
 
17
      STDERR.puts("Can't run: #{command}")
 
18
    end
 
19
  end
 
20
end