gettext_i18n_rails_js 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -1,6 +1,6 @@
1
1
  require 'gettext_i18n_rails'
2
2
  require 'gettext_i18n_rails_js/engine'
3
- require 'gettext_i18n_rails_js/js_and_coffee_parser'
3
+ require 'gettext_i18n_rails_js/js_and_coffee_parser' if RUBY_PLATFORM != 'java'
4
4
 
5
5
  module GettextI18nRailsJs
6
6
  end
@@ -2,11 +2,11 @@ require 'gettext/tools/xgettext'
2
2
 
3
3
  module GettextI18nRailsJs
4
4
  class JsAndCoffeeParser
5
-
5
+
6
6
  class << self
7
7
  # The gettext function name can be configured at the module level as js_gettext_function
8
8
  # This is to provide a way to avoid conflicts with other javascript libraries.
9
- # You only need to define the base function name to replace '_' and all the
9
+ # You only need to define the base function name to replace '_' and all the
10
10
  # other variants (s_, n_, N_) will be deduced automatically.
11
11
  attr_accessor :js_gettext_function
12
12
  end
@@ -34,31 +34,33 @@ module GettextI18nRailsJs
34
34
  def self.parse(file, msgids = [])
35
35
  _ = self.js_gettext_function
36
36
 
37
- # We first parse full invocations
37
+ # We first parse full invocations
38
38
  invoke_regex = /
39
- (\b[snN]?#{_}) # Matches the function call grouping the method used (__, n__, N__, etc)
39
+ (\b[snN]?#{_}) # Matches the function call grouping the method used (__, n__, N__, etc)
40
40
  \( # and a parenthesis to start the arguments to the function.
41
41
  (('.*?'| # Then a token inside the argument list, like a single quoted string
42
42
  ".*?"| # ...Double quote string
43
- [a-zA-Z0-9_\.()]*| # ...a number, variable name, or called function lik: 33, foo, Foo.bar()
43
+ [a-zA-Z0-9_\.()]*?| # ...a number, variable name, or called function lik: 33, foo, Foo.bar()
44
44
  [ ]| # ...a white space
45
45
  ,) # ...or a comma, which separates all of the above.
46
46
  *) # There may be many arguments to the same function call.
47
47
  \) # function call closing parenthesis
48
48
  /x
49
49
 
50
- File.read(file).scan(invoke_regex).collect do |function, arguments|
51
- separator = function == "n#{_}" ? "\000" : "\004"
52
- key = arguments.scan(/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/).
53
- collect{|match| match.first[1..-2]}.
54
- join(separator)
55
- next if key == ''
56
- key.gsub!("\n", '\n')
57
- key.gsub!("\t", '\t')
58
- key.gsub!("\0", '\0')
59
-
60
- [key, "#{file}:1"]
61
- end.compact
50
+ File.new(file).each_line.each_with_index.collect do |line, idx|
51
+ line.scan(invoke_regex).collect do |function, arguments|
52
+ separator = function == "n#{_}" ? "\000" : "\004"
53
+ key = arguments.scan(/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/).
54
+ collect{|match| match.first[1..-2]}.
55
+ join(separator)
56
+ next if key == ''
57
+ key.gsub!("\n", '\n')
58
+ key.gsub!("\t", '\t')
59
+ key.gsub!("\0", '\0')
60
+
61
+ [key, "#{file}:#{idx+1}"]
62
+ end
63
+ end.inject(:+).compact
62
64
  end
63
65
 
64
66
  end
@@ -1,3 +1,3 @@
1
1
  module GettextI18nRailsJs
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,5 +1,6 @@
1
- require_relative '../gettext_i18n_rails_js/js_and_coffee_parser'
2
- require_relative '../gettext_i18n_rails_js/handlebars_parser'
3
- require 'gettext_i18n_rails/tasks'
4
- require_relative '../gettext_i18n_rails_js/tasks'
5
-
1
+ if RUBY_PLATFORM != 'java'
2
+ require_relative '../gettext_i18n_rails_js/js_and_coffee_parser'
3
+ require_relative '../gettext_i18n_rails_js/handlebars_parser'
4
+ require 'gettext_i18n_rails/tasks'
5
+ require_relative '../gettext_i18n_rails_js/tasks'
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_i18n_rails_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-18 00:00:00.000000000 Z
12
+ date: 2013-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70354807710200 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,21 +21,15 @@ dependencies:
21
21
  version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70354807710200
25
- - !ruby/object:Gem::Dependency
26
- name: gettext
27
- requirement: &70354807708800 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
28
25
  none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - ~>
31
28
  - !ruby/object:Gem::Version
32
- version: 2.3.0
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70354807708800
29
+ version: 3.2.0
36
30
  - !ruby/object:Gem::Dependency
37
31
  name: gettext_i18n_rails
38
- requirement: &70354807705080 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
34
  requirements:
41
35
  - - ! '>='
@@ -43,10 +37,15 @@ dependencies:
43
37
  version: 0.7.1
44
38
  type: :runtime
45
39
  prerelease: false
46
- version_requirements: *70354807705080
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.7.1
47
46
  - !ruby/object:Gem::Dependency
48
47
  name: po_to_json
49
- requirement: &70354807688080 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
50
49
  none: false
51
50
  requirements:
52
51
  - - ! '>='
@@ -54,10 +53,15 @@ dependencies:
54
53
  version: 0.0.6
55
54
  type: :runtime
56
55
  prerelease: false
57
- version_requirements: *70354807688080
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.6
58
62
  - !ruby/object:Gem::Dependency
59
63
  name: sqlite3
60
- requirement: &70354807686020 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
61
65
  none: false
62
66
  requirements:
63
67
  - - ! '>='
@@ -65,10 +69,15 @@ dependencies:
65
69
  version: '0'
66
70
  type: :development
67
71
  prerelease: false
68
- version_requirements: *70354807686020
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rspec
71
- requirement: &70354807683640 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
72
81
  none: false
73
82
  requirements:
74
83
  - - ~>
@@ -76,7 +85,28 @@ dependencies:
76
85
  version: '2'
77
86
  type: :development
78
87
  prerelease: false
79
- version_requirements: *70354807683640
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '2'
94
+ - !ruby/object:Gem::Dependency
95
+ name: gettext
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 2.3.0
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 2.3.0
80
110
  description: gettext_i18n_rails will find translations inside your .js and .coffee
81
111
  files, then it will create JSON versions of your .PO files and will let you serve
82
112
  them with the rest of your assets, thus letting you access all your translations
@@ -97,7 +127,7 @@ files:
97
127
  - lib/tasks/gettext_i18n_rails_js_tasks.rake
98
128
  - MIT-LICENSE
99
129
  - Rakefile
100
- - Readme.md
130
+ - README.md
101
131
  homepage: http://github.com/nubis/gettext_i18n_rails_js
102
132
  licenses: []
103
133
  post_install_message:
@@ -118,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
148
  version: '0'
119
149
  requirements: []
120
150
  rubyforge_project:
121
- rubygems_version: 1.8.15
151
+ rubygems_version: 1.8.23
122
152
  signing_key:
123
153
  specification_version: 3
124
154
  summary: Extends gettext_i18n_rails making your .po files available to client side