aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gettext.rake25
-rw-r--r--lib/tasks/themes.rake2
2 files changed, 22 insertions, 5 deletions
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake
index 3f357213f..9bdb6169b 100644
--- a/lib/tasks/gettext.rake
+++ b/lib/tasks/gettext.rake
@@ -11,11 +11,7 @@ namespace :gettext do
desc "Update pot/po files for a theme."
task :find_theme => :environment do
- theme = ENV['THEME']
- unless theme
- puts "Usage: Specify an Alaveteli-theme with THEME=[theme directory name]"
- exit(0)
- end
+ theme = find_theme(ENV['THEME'])
load_gettext
msgmerge = Rails.application.config.gettext_i18n_rails.msgmerge
msgmerge ||= %w[--sort-output --no-location --no-wrap]
@@ -28,6 +24,25 @@ namespace :gettext do
)
end
+ desc 'Rewrite theme .po files into a consistent msgmerge format'
+ task :clean_theme do
+ theme = find_theme(ENV['THEME'])
+ load_gettext
+
+ Dir.glob("#{ theme_locale_path(theme) }/*/app.po") do |po_file|
+ GetText::msgmerge(po_file, po_file, 'alaveteli',
+ :msgmerge => [:sort_output, :no_location, :no_wrap])
+ end
+ end
+
+ def find_theme(theme)
+ unless theme
+ puts "Usage: Specify an Alaveteli-theme with THEME=[theme directory name]"
+ exit(0)
+ end
+ theme
+ end
+
def theme_files_to_translate(theme)
Dir.glob("{lib/themes/#{theme}/lib}/**/*.{rb,erb}")
end
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index 4a864d141..cbd12fd86 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -65,6 +65,8 @@ namespace :themes do
result.push usage_tag(ALAVETELI_VERSION)
hotfix_match = /^(\d+\.\d+\.\d+)(\.\d+)+/.match(ALAVETELI_VERSION)
result.push usage_tag(hotfix_match[1]) if hotfix_match
+ minor_match = /^(\d+\.\d+)(\.\d+)+/.match(ALAVETELI_VERSION)
+ result.push usage_tag(minor_match[1]) if minor_match
result
end