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.
data/{Readme.md → README.md}
RENAMED
File without changes
|
@@ -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]?#{_})
|
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_\.()]
|
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.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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,5 +1,6 @@
|
|
1
|
-
|
2
|
-
require_relative '../gettext_i18n_rails_js/
|
3
|
-
|
4
|
-
|
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.
|
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-
|
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:
|
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:
|
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.
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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
|
-
-
|
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.
|
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
|