gettext_i18n_rails 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/gettext_i18n_rails/base_parser.rb +2 -10
- data/lib/gettext_i18n_rails/gettext_hooks.rb +3 -11
- data/lib/gettext_i18n_rails/haml_parser.rb +2 -0
- data/lib/gettext_i18n_rails/hamlet_parser.rb +2 -0
- data/lib/gettext_i18n_rails/slim_parser.rb +2 -0
- data/lib/gettext_i18n_rails/tasks.rb +3 -2
- data/lib/gettext_i18n_rails/version.rb +1 -1
- metadata +3 -4
- data/spec/gettext_i18n_rails/gettext_hooks_spec.rb +0 -28
data/Gemfile.lock
CHANGED
@@ -1,15 +1,7 @@
|
|
1
|
+
require 'gettext_i18n_rails/gettext_hooks'
|
2
|
+
|
1
3
|
module GettextI18nRails
|
2
4
|
class BaseParser
|
3
|
-
# copy AS 3 feature so we can play nicely with AS2 and if rails env is not there
|
4
|
-
class << self
|
5
|
-
attr_accessor :parser_descendants
|
6
|
-
end
|
7
|
-
self.parser_descendants = []
|
8
|
-
|
9
|
-
def self.inherited(subclass)
|
10
|
-
parser_descendants << subclass
|
11
|
-
end
|
12
|
-
|
13
5
|
def self.target?(file)
|
14
6
|
File.extname(file) == ".#{extension}"
|
15
7
|
end
|
@@ -1,16 +1,8 @@
|
|
1
1
|
module GettextI18nRails
|
2
2
|
module GettextHooks
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require "gettext_i18n_rails/haml_parser"
|
8
|
-
require "gettext_i18n_rails/hamlet_parser"
|
9
|
-
require "gettext_i18n_rails/slim_parser"
|
10
|
-
|
11
|
-
GettextI18nRails::BaseParser.parser_descendants.each do |parser|
|
12
|
-
xgettext.add_parser(parser)
|
13
|
-
end
|
3
|
+
# shoarter call / maybe the interface changes again ...
|
4
|
+
def self.add_parser(parser)
|
5
|
+
xgettext.add_parser(parser)
|
14
6
|
end
|
15
7
|
|
16
8
|
def self.xgettext
|
@@ -2,7 +2,6 @@ namespace :gettext do
|
|
2
2
|
def load_gettext
|
3
3
|
require 'gettext'
|
4
4
|
require 'gettext/utils'
|
5
|
-
require 'gettext_i18n_rails/gettext_hooks'
|
6
5
|
end
|
7
6
|
|
8
7
|
desc "Create mo-files for L10n"
|
@@ -16,7 +15,9 @@ namespace :gettext do
|
|
16
15
|
load_gettext
|
17
16
|
$LOAD_PATH << File.join(File.dirname(__FILE__),'..','..','lib') # needed when installed as plugin
|
18
17
|
|
19
|
-
|
18
|
+
require "gettext_i18n_rails/haml_parser"
|
19
|
+
require "gettext_i18n_rails/hamlet_parser"
|
20
|
+
require "gettext_i18n_rails/slim_parser"
|
20
21
|
|
21
22
|
if GetText.respond_to? :update_pofiles_org
|
22
23
|
if defined?(Rails.application)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettext_i18n_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- spec/gettext_i18n_rails/active_model_spec.rb
|
64
64
|
- spec/gettext_i18n_rails/active_record_spec.rb
|
65
65
|
- spec/gettext_i18n_rails/backend_spec.rb
|
66
|
-
- spec/gettext_i18n_rails/gettext_hooks_spec.rb
|
67
66
|
- spec/gettext_i18n_rails/haml_parser_spec.rb
|
68
67
|
- spec/gettext_i18n_rails/hamlet_parser_spec.rb
|
69
68
|
- spec/gettext_i18n_rails/model_attributes_finder_spec.rb
|
@@ -86,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
85
|
version: '0'
|
87
86
|
segments:
|
88
87
|
- 0
|
89
|
-
hash:
|
88
|
+
hash: 4474784702351779304
|
90
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
90
|
none: false
|
92
91
|
requirements:
|
@@ -95,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
94
|
version: '0'
|
96
95
|
segments:
|
97
96
|
- 0
|
98
|
-
hash:
|
97
|
+
hash: 4474784702351779304
|
99
98
|
requirements: []
|
100
99
|
rubyforge_project:
|
101
100
|
rubygems_version: 1.8.24
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe GettextI18nRails::GettextHooks do
|
4
|
-
describe ".add_parsers_to_gettext" do
|
5
|
-
def parsers
|
6
|
-
GettextI18nRails::GettextHooks.xgettext # load XGetText
|
7
|
-
GettextI18nRails::GettextHooks.instance_variable_set(:@add_parsers_to_gettext, nil) # can add_parsers_to_gettext multiple times
|
8
|
-
GetText::Tools::XGetText.class_variable_get(:@@default_parsers)
|
9
|
-
end
|
10
|
-
|
11
|
-
before do
|
12
|
-
parsers.clear
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should add all parsers to gettext" do
|
16
|
-
expect{
|
17
|
-
GettextI18nRails::GettextHooks.add_parsers_to_gettext
|
18
|
-
}.to change{ parsers.size }.by(+3)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should not add them twice" do
|
22
|
-
expect{
|
23
|
-
GettextI18nRails::GettextHooks.add_parsers_to_gettext
|
24
|
-
GettextI18nRails::GettextHooks.add_parsers_to_gettext
|
25
|
-
}.to change{ parsers.size }.by(+3)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|