| 1 |
#!/usr/bin/env ruby1.8 |
| 2 |
|
| 3 |
strings = [] |
| 4 |
Dir.glob("**/*.gthtml") do |filename| |
| 5 |
File.open("./#{ filename }").each_line do |line| |
| 6 |
if line =~ /<%=[ \t]+translate[ \t]+'(([^\\']|\\.)*)'/ |
| 7 |
strings << $1 |
| 8 |
end |
| 9 |
end |
| 10 |
end |
| 11 |
|
| 12 |
puts <<EOF |
| 13 |
/* DO NOT EDIT. This file is generated automatically. */ |
| 14 |
|
| 15 |
/* |
| 16 |
* GThumb |
| 17 |
* |
| 18 |
* Copyright (C) #{ Time::now.year } Free Software Foundation, Inc. |
| 19 |
* |
| 20 |
* This program is free software; you can redistribute it and/or modify |
| 21 |
* it under the terms of the GNU General Public License as published by |
| 22 |
* the Free Software Foundation; either version 2 of the License, or |
| 23 |
* (at your option) any later version. |
| 24 |
* |
| 25 |
* This program is distributed in the hope that it will be useful, |
| 26 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 |
* GNU General Public License for more details. |
| 29 |
* |
| 30 |
* You should have received a copy of the GNU General Public License |
| 31 |
* along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 32 |
*/ |
| 33 |
|
| 34 |
#include <config.h> |
| 35 |
#include <glib/gi18n.h> |
| 36 |
|
| 37 |
static char *text[] = { |
| 38 |
EOF |
| 39 |
|
| 40 |
strings.uniq.sort.each do |string| |
| 41 |
puts "\tN_(\"#{ string.gsub('\\', '\\\\').gsub('"', '\\"') }\")," |
| 42 |
end |
| 43 |
|
| 44 |
puts <<EOF |
| 45 |
\tNULL |
| 46 |
}; |
| 47 |
EOF |