Package: ruby-gettext-i18n-rails
Version: 0.9.4-1
Severity: grave
Debian Release: 8.0
Tags: patch
The rake task is incompatible with with ruby-gettext version 3.
This was fixed in v1.0.0.
commit d1b02f734f9e0c96de50d1a58e8170ce6ec457ac
Author: Kouhei Sutou <[email protected]>
Date: Mon Sep 16 18:42:13 2013 +0900
Use GetText::Tools::Task introduced since gettext 3.0.0
and
commit 6c83ce9255122ddb0c28ec5ca96e5a1975a8e0c8
Author: grosser <[email protected]>
Date: Sun Sep 29 17:47:38 2013 -0700
bump gettext requirement
Attached is a squashed and (kind of) minimized patch of both commits.
As a site notice: the package needs to be rebuild for compatibility with
Ruby 2.1, as it just provides GEM specs for Ruby 1.9.1 and 1.8.
Jan-Marek
diff --git a/lib/gettext_i18n_rails/tasks.rb b/lib/gettext_i18n_rails/tasks.rb
index 4d1a0d0..2f7121f 100644
--- a/lib/gettext_i18n_rails/tasks.rb
+++ b/lib/gettext_i18n_rails/tasks.rb
@@ -1,55 +1,48 @@
+require "gettext/tools/task"
+gem "gettext", ">= 3.0.2"
+
namespace :gettext do
- def load_gettext
- require 'gettext'
- require 'gettext/utils'
+ def locale_path
+ path = FastGettext.translation_repositories[text_domain].instance_variable_get(:@options)[:path] rescue nil
+ path || File.join(Rails.root, "locale")
end
- desc "Create mo-files for L10n"
- task :pack => :environment do
- load_gettext
- GetText.create_mofiles(true, locale_path, locale_path)
+ def text_domain
+ # if your textdomain is not 'app': require the environment before calling e.g. gettext:find OR add TEXTDOMAIN=my_domain
+ ENV['TEXTDOMAIN'] || (FastGettext.text_domain rescue nil) || "app"
end
- desc "Update pot/po files."
- task :find => :environment do
- load_gettext
- $LOAD_PATH << File.join(File.dirname(__FILE__),'..','..','lib') # needed when installed as plugin
-
- require "gettext_i18n_rails/haml_parser"
- require "gettext_i18n_rails/slim_parser"
+ # do not rename, gettext_i18n_rails_js overwrites this to inject coffee + js
+ def files_to_translate
+ Dir.glob("{app,lib,config,#{locale_path}}/**/*.{rb,erb,haml,slim}")
+ end
- if GetText.respond_to? :update_pofiles_org
- if defined?(Rails.application)
- msgmerge = Rails.application.config.gettext_i18n_rails.msgmerge
- end
- msgmerge ||= %w[--sort-output --no-location --no-wrap]
+ $LOAD_PATH << File.join(File.dirname(__FILE__),'..','..','lib') # needed when installed as plugin
+
+ require "gettext_i18n_rails/haml_parser"
+ require "gettext_i18n_rails/slim_parser"
+
+ GetText::Tools::Task.define do |task|
+ task.package_name = text_domain
+ task.package_version = "1.0.0"
+ task.domain = text_domain
+ task.po_base_directory = locale_path
+ task.mo_base_directory = locale_path
+ task.files = files_to_translate
+ task.enable_description = false
+ if defined?(Rails.application)
+ msgmerge = Rails.application.config.gettext_i18n_rails.msgmerge
+ end
+ msgmerge ||= %w[--sort-output --no-location --no-wrap]
+ task.msgmerge_options = msgmerge
+ end
- GetText.update_pofiles_org(
- text_domain,
- files_to_translate,
- "version 0.0.1",
- :po_root => locale_path,
- :msgmerge => msgmerge
- )
- else #we are on a version < 2.0
- puts "install new GetText with gettext:install to gain more features..."
- #kill ar parser...
- require 'gettext/parser/active_record'
- module GetText
- module ActiveRecordParser
- module_function
- def init(x);end
- end
- end
+ desc "Create mo-files for L10n"
+ task :pack => [:environment, "gettext:gettext:mo:update"] do
+ end
- #parse files.. (models are simply parsed as ruby files)
- GetText.update_pofiles(
- text_domain,
- files_to_translate,
- "version 0.0.1",
- locale_path
- )
- end
+ desc "Update pot/po files."
+ task :find => [:environment, "gettext:gettext:po:update"] do
end
# This is more of an example, ignoring
@@ -92,35 +84,9 @@ namespace :gettext do
puts "You need to specify the language to add. Either 'LANGUAGE=eo rake gettext:add_languange' or 'rake gettext:add_languange[eo]'"
next
end
- pot = File.join(locale_path, "#{text_domain}.pot")
- if !File.exists? pot
- puts "You don't have a pot file yet, you probably should run 'rake gettext:find' at least once. Tried '#{pot}'."
- next
- end
-
- # Create the directory for the new language.
- dir = File.join(locale_path, language)
- puts "Creating directory #{dir}"
- Dir.mkdir dir
-
- # Create the po file for the new language.
- new_po = File.join(locale_path, language, "#{text_domain}.po")
- puts "Initializing #{new_po} from #{pot}."
- system "msginit --locale=#{language} --input=#{pot} --output=#{new_po}"
- end
- def locale_path
- path = FastGettext.translation_repositories[text_domain].instance_variable_get(:@options)[:path] rescue nil
- path || File.join(Rails.root, "locale")
- end
-
- def text_domain
- # if your textdomain is not 'app': require the environment before calling e.g. gettext:find OR add TEXTDOMAIN=my_domain
- ENV['TEXTDOMAIN'] || (FastGettext.text_domain rescue nil) || "app"
- end
-
- # do not rename, gettext_i18n_rails_js overwrites this to inject coffee + js
- def files_to_translate
- Dir.glob("{app,lib,config,#{locale_path}}/**/*.{rb,erb,haml,slim}")
+ language_path = File.join(locale_path, language)
+ mkdir_p(language_path)
+ ruby($0, "gettext:find")
end
end
diff --git a/Gemfile b/Gemfile
index 5e9255d..904b67b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,7 @@ gemspec
gem 'appraisal'
gem 'bump'
-gem 'gettext'
+gem 'gettext', '>= 3.0.2'
gem 'haml'
gem 'rails'
gem 'rake'
diff --git a/Gemfile.lock b/Gemfile.lock
index 2f253c5..570ec89 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -43,7 +43,7 @@ GEM
diff-lcs (1.1.3)
erubis (2.7.0)
fast_gettext (0.7.0)
- gettext (2.3.7)
+ gettext (3.0.2)
levenshtein
locale
haml (3.1.7)
@@ -119,7 +119,7 @@ PLATFORMS
DEPENDENCIES
appraisal
bump
- gettext
+ gettext (>= 3.0.2)
gettext_i18n_rails!
haml
rails
diff --git a/Readme.md b/Readme.md
index 8e2c5c9..53d56df 100644
--- a/Readme.md
+++ b/Readme.md
@@ -31,7 +31,7 @@ Add `gettext` if you want to find translations or build .mo files<br/>
Add `ruby_parser` if you want to find translations inside haml/slim files
# Gemfile
- gem 'gettext', '>=1.9.3', :require => false, :group => :development
+ gem 'gettext', '>=3.0.2', :require => false, :group => :development
gem 'ruby_parser', :require => false, :group => :development
#### Rails 2
_______________________________________________
Pkg-ruby-extras-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ruby-extras-maintainers