gettext_i18n_rails_js 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,17 +34,21 @@ module GettextI18nRailsJs
|
|
34
34
|
def self.parse(file, msgids = [])
|
35
35
|
_ = self.js_gettext_function
|
36
36
|
|
37
|
+
arg_regex = /
|
38
|
+
\s* # Some whitespace
|
39
|
+
('(?:[^'\\]|\\.)*?'| # A token inside the argument list, like a single quoted string
|
40
|
+
"(?:[^"\\]|\\.)*?"| # ...Double quote string, both support escapes
|
41
|
+
[a-zA-Z0-9_\.()]*?) # ...a number, variable name, or called function lik: 33, foo, Foo.bar()
|
42
|
+
\s* # More whitespace
|
43
|
+
/x
|
44
|
+
|
37
45
|
# We first parse full invocations
|
38
46
|
invoke_regex = /
|
39
|
-
(\b[snN]?#{_})
|
40
|
-
\(
|
41
|
-
((
|
42
|
-
|
43
|
-
|
44
|
-
[ ]| # ...a white space
|
45
|
-
,) # ...or a comma, which separates all of the above.
|
46
|
-
*) # There may be many arguments to the same function call.
|
47
|
-
\) # function call closing parenthesis
|
47
|
+
(\b[snN]?#{_}) # Matches the function call grouping the method used (__, n__, N__, etc)
|
48
|
+
\( # and a parenthesis to start the arguments to the function.
|
49
|
+
((#{arg_regex},)* # There may be many arguments to the same function call
|
50
|
+
#{arg_regex})? # then the last, or only argument to the function call.
|
51
|
+
\) # function call closing parenthesis
|
48
52
|
/x
|
49
53
|
|
50
54
|
File.new(file).each_line.each_with_index.collect do |line, idx|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
if RUBY_PLATFORM != 'java'
|
2
|
-
|
3
|
-
|
2
|
+
dir = File.dirname(__FILE__)
|
3
|
+
require File.join(dir, '../gettext_i18n_rails_js/js_and_coffee_parser')
|
4
|
+
require File.join(dir, '../gettext_i18n_rails_js/handlebars_parser')
|
4
5
|
require 'gettext_i18n_rails/tasks'
|
5
|
-
|
6
|
+
require File.join(dir, '../gettext_i18n_rails_js/tasks')
|
6
7
|
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.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|