lesli_babel 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/lesli_babel/application.js +106 -50
- data/app/assets/javascripts/lesli_babel/application.js.LICENSE.txt +282 -0
- data/app/assets/stylesheets/lesli_babel/dashboards.scss +2 -1
- data/app/controllers/lesli_babel/buckets_controller.rb +31 -1
- data/app/controllers/lesli_babel/modules_controller.rb +1 -1
- data/app/controllers/lesli_babel/strings_controller.rb +1 -1
- data/app/controllers/lesli_babel/translations_controller.rb +23 -12
- data/app/models/lesli_babel/module.rb +10 -1
- data/app/models/lesli_babel/string.rb +3 -4
- data/app/services/lesli_babel/deploy_rails_service.rb +93 -0
- data/app/services/lesli_babel/module_service.rb +1 -1
- data/app/services/lesli_babel/string_service.rb +2 -2
- data/app/views/lesli_babel/partials/_engine-sidebar.html.erb +2 -2
- data/config/locales/translations.en.yml +5 -0
- data/config/locales/translations.es.yml +5 -0
- data/config/routes.rb +1 -2
- data/db/migrate/v1.0/0901100110_create_lesli_babel_modules.rb +2 -2
- data/db/migrate/v1.0/0901110110_create_lesli_babel_buckets.rb +1 -1
- data/lib/lesli_babel/version.rb +2 -2
- data/lib/tasks/lesli_babel_tasks.rake +38 -56
- data/lib/vue/application.js +23 -9
- data/lib/vue/apps/modules/show.vue +24 -10
- data/lib/vue/components/form-string-new.vue +1 -1
- data/lib/vue/stores/module.js +25 -11
- data/lib/vue/stores/translations.js +1 -1
- data/lib/vue/stores/translations.json +38 -0
- data/readme.md +61 -9
- metadata +11 -5
@@ -0,0 +1,282 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
|
+
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
|
+
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
23
|
+
Building a better future, one line of code at a time.
|
24
|
+
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
*/
|
32
|
+
|
33
|
+
/*
|
34
|
+
|
35
|
+
Lesli
|
36
|
+
|
37
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
38
|
+
|
39
|
+
This program is free software: you can redistribute it and/or modify
|
40
|
+
it under the terms of the GNU General Public License as published by
|
41
|
+
the Free Software Foundation, either version 3 of the License, or
|
42
|
+
(at your option) any later version.
|
43
|
+
|
44
|
+
This program is distributed in the hope that it will be useful,
|
45
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
46
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
47
|
+
GNU General Public License for more details.
|
48
|
+
|
49
|
+
You should have received a copy of the GNU General Public License
|
50
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
51
|
+
|
52
|
+
Lesli · Your Smart Business Assistant.
|
53
|
+
|
54
|
+
Made with ♥ by https://www.lesli.tech
|
55
|
+
Building a better future, one line of code at a time.
|
56
|
+
|
57
|
+
@contact hello@lesli.tech
|
58
|
+
@website https://lesli.tech
|
59
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
60
|
+
|
61
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
62
|
+
// ·
|
63
|
+
|
64
|
+
*/
|
65
|
+
|
66
|
+
/*
|
67
|
+
|
68
|
+
Lesli
|
69
|
+
|
70
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
71
|
+
|
72
|
+
This program is free software: you can redistribute it and/or modify
|
73
|
+
it under the terms of the GNU General Public License as published by
|
74
|
+
the Free Software Foundation, either version 3 of the License, or
|
75
|
+
(at your option) any later version.
|
76
|
+
|
77
|
+
This program is distributed in the hope that it will be useful,
|
78
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
79
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
80
|
+
GNU General Public License for more details.
|
81
|
+
|
82
|
+
You should have received a copy of the GNU General Public License
|
83
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
84
|
+
|
85
|
+
Lesli · Your Smart Business Assistant.
|
86
|
+
|
87
|
+
Made with ♥ by https://www.lesli.tech
|
88
|
+
Building a better future, one line of code at a time.
|
89
|
+
|
90
|
+
@contact hello@lesli.tech
|
91
|
+
@website https://lesli.tech
|
92
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
93
|
+
|
94
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
95
|
+
// ·
|
96
|
+
*/
|
97
|
+
|
98
|
+
/*
|
99
|
+
Lesli
|
100
|
+
|
101
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
102
|
+
|
103
|
+
This program is free software: you can redistribute it and/or modify
|
104
|
+
it under the terms of the GNU General Public License as published by
|
105
|
+
the Free Software Foundation, either version 3 of the License, or
|
106
|
+
(at your option) any later version.
|
107
|
+
|
108
|
+
This program is distributed in the hope that it will be useful,
|
109
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
110
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
111
|
+
GNU General Public License for more details.
|
112
|
+
|
113
|
+
You should have received a copy of the GNU General Public License
|
114
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
115
|
+
|
116
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
117
|
+
|
118
|
+
Made with ♥ by https://www.lesli.tech
|
119
|
+
Building a better future, one line of code at a time.
|
120
|
+
|
121
|
+
@contact hello@lesli.tech
|
122
|
+
@website https://www.lesli.dev
|
123
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
124
|
+
|
125
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
126
|
+
// ·
|
127
|
+
*/
|
128
|
+
|
129
|
+
/*
|
130
|
+
Lesli
|
131
|
+
|
132
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
133
|
+
|
134
|
+
This program is free software: you can redistribute it and/or modify
|
135
|
+
it under the terms of the GNU General Public License as published by
|
136
|
+
the Free Software Foundation, either version 3 of the License, or
|
137
|
+
(at your option) any later version.
|
138
|
+
|
139
|
+
This program is distributed in the hope that it will be useful,
|
140
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
141
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
142
|
+
GNU General Public License for more details.
|
143
|
+
|
144
|
+
You should have received a copy of the GNU General Public License
|
145
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
146
|
+
|
147
|
+
Lesli · Ruby on Rails SaaS development platform.
|
148
|
+
|
149
|
+
Made with ♥ by https://www.lesli.tech
|
150
|
+
Building a better future, one line of code at a time.
|
151
|
+
|
152
|
+
@contact hello@lesli.tech
|
153
|
+
@website https://www.lesli.tech
|
154
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
155
|
+
|
156
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
157
|
+
// ·
|
158
|
+
*/
|
159
|
+
|
160
|
+
/*
|
161
|
+
Lesli
|
162
|
+
|
163
|
+
Copyright (c) 2020, Lesli Technologies, S. A.
|
164
|
+
|
165
|
+
This program is free software: you can redistribute it and/or modify
|
166
|
+
it under the terms of the GNU General Public License as published by
|
167
|
+
the Free Software Foundation, either version 3 of the License, or
|
168
|
+
(at your option) any later version.
|
169
|
+
|
170
|
+
This program is distributed in the hope that it will be useful,
|
171
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
172
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
173
|
+
GNU General Public License for more details.
|
174
|
+
|
175
|
+
You should have received a copy of the GNU General Public License
|
176
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
177
|
+
|
178
|
+
Lesli JS - JavaScript utilities for JavaScript applications
|
179
|
+
|
180
|
+
Powered by LesliTech
|
181
|
+
Building a better future, one line of code at a time.
|
182
|
+
|
183
|
+
@contact <hello@lesli.tech>
|
184
|
+
@website <https://lesli.tech>
|
185
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
186
|
+
|
187
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
188
|
+
// ·
|
189
|
+
*/
|
190
|
+
|
191
|
+
/*
|
192
|
+
Lesli
|
193
|
+
|
194
|
+
Copyright (c) 2021, Lesli Technologies, S. A.
|
195
|
+
|
196
|
+
This program is free software: you can redistribute it and/or modify
|
197
|
+
it under the terms of the GNU General Public License as published by
|
198
|
+
the Free Software Foundation, either version 3 of the License, or
|
199
|
+
(at your option) any later version.
|
200
|
+
|
201
|
+
This program is distributed in the hope that it will be useful,
|
202
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
203
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
204
|
+
GNU General Public License for more details.
|
205
|
+
|
206
|
+
You should have received a copy of the GNU General Public License
|
207
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
208
|
+
|
209
|
+
Lesli JS - JavaScript utilities for JavaScript applications
|
210
|
+
|
211
|
+
Powered by LesliTech
|
212
|
+
Building a better future, one line of code at a time.
|
213
|
+
|
214
|
+
@contact <hello@lesli.tech>
|
215
|
+
@website <https://lesli.tech>
|
216
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
217
|
+
|
218
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
219
|
+
// ·
|
220
|
+
*/
|
221
|
+
|
222
|
+
/*
|
223
|
+
Lesli
|
224
|
+
|
225
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
226
|
+
|
227
|
+
This program is free software: you can redistribute it and/or modify
|
228
|
+
it under the terms of the GNU General Public License as published by
|
229
|
+
the Free Software Foundation, either version 3 of the License, or
|
230
|
+
(at your option) any later version.
|
231
|
+
|
232
|
+
This program is distributed in the hope that it will be useful,
|
233
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
234
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
235
|
+
GNU General Public License for more details.
|
236
|
+
|
237
|
+
You should have received a copy of the GNU General Public License
|
238
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
239
|
+
|
240
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
241
|
+
|
242
|
+
Made with ♥ by https://www.lesli.tech
|
243
|
+
Building a better future, one line of code at a time.
|
244
|
+
|
245
|
+
@contact hello@lesli.tech
|
246
|
+
@website https://www.lesli.dev
|
247
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
248
|
+
|
249
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
250
|
+
// ·
|
251
|
+
*/
|
252
|
+
|
253
|
+
/*
|
254
|
+
Lesli
|
255
|
+
|
256
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
257
|
+
|
258
|
+
This program is free software: you can redistribute it and/or modify
|
259
|
+
it under the terms of the GNU General Public License as published by
|
260
|
+
the Free Software Foundation, either version 3 of the License, or
|
261
|
+
(at your option) any later version.
|
262
|
+
|
263
|
+
This program is distributed in the hope that it will be useful,
|
264
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
265
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
266
|
+
GNU General Public License for more details.
|
267
|
+
|
268
|
+
You should have received a copy of the GNU General Public License
|
269
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
270
|
+
|
271
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
272
|
+
|
273
|
+
Made with ♥ by https://www.lesli.tech
|
274
|
+
Building a better future, one line of code at a time.
|
275
|
+
|
276
|
+
@contact hello@lesli.tech
|
277
|
+
@website https://www.lesli.tech
|
278
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
279
|
+
|
280
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
281
|
+
// ·
|
282
|
+
*/
|
@@ -1,4 +1,34 @@
|
|
1
|
+
=begin
|
1
2
|
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
|
+
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
|
+
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
23
|
+
Building a better future, one line of code at a time.
|
24
|
+
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
=end
|
2
32
|
|
3
33
|
module LesliBabel
|
4
34
|
class BucketsController < ApplicationController
|
@@ -10,7 +40,7 @@ module LesliBabel
|
|
10
40
|
format.html { }
|
11
41
|
format.json {
|
12
42
|
respond_with_successful(
|
13
|
-
Module.find(params[:module_id]).buckets.order(
|
43
|
+
Module.find(params[:module_id]).buckets.order(:code)
|
14
44
|
)
|
15
45
|
}
|
16
46
|
end
|
@@ -2,21 +2,32 @@
|
|
2
2
|
|
3
3
|
Lesli
|
4
4
|
|
5
|
-
Copyright (c)
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
14
16
|
|
15
|
-
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
|
+
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
23
|
+
Building a better future, one line of code at a time.
|
19
24
|
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
20
31
|
=end
|
21
32
|
|
22
33
|
module LesliBabel
|
@@ -79,8 +90,8 @@ module LesliBabel
|
|
79
90
|
|
80
91
|
def deploy
|
81
92
|
#TranslationsService.clean
|
82
|
-
|
83
|
-
TranslationsService.restart_server
|
93
|
+
DeployRailsService.new(current_user, query).build
|
94
|
+
#TranslationsService.restart_server
|
84
95
|
respond_with_successful
|
85
96
|
end
|
86
97
|
|
@@ -18,12 +18,21 @@ module LesliBabel
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def show
|
22
|
+
{
|
23
|
+
:id => self.id,
|
24
|
+
:code => self.code.titleize,
|
25
|
+
:platform => self.platform,
|
26
|
+
:created_at => self.created_at
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
21
30
|
def format_module_name
|
22
31
|
|
23
32
|
return if self.platform == "lesli_core"
|
24
33
|
return if self.platform == "lesli_engine"
|
25
34
|
|
26
|
-
self.
|
35
|
+
self.code = self.code
|
27
36
|
.gsub(/[^0-9A-Za-z\s\-\_]/, '') # remove special characters from string
|
28
37
|
.gsub(/-/, '') # replace dashes with underscore
|
29
38
|
.gsub(/_/, '') # replace underscore with underscore
|
@@ -217,11 +217,10 @@ module LesliBabel
|
|
217
217
|
end
|
218
218
|
|
219
219
|
def path
|
220
|
-
self[:
|
220
|
+
self[:engine_code]
|
221
221
|
.downcase
|
222
|
-
.sub("cloud", "")
|
223
222
|
.concat(".")
|
224
|
-
.concat(self[:
|
223
|
+
.concat(self[:bucket_code])
|
225
224
|
.concat(".")
|
226
225
|
.concat(self[:label])
|
227
226
|
end
|
@@ -237,7 +236,7 @@ module LesliBabel
|
|
237
236
|
.gsub(/\s+/, '_') # replace spaces or spaces with single dash
|
238
237
|
|
239
238
|
self.status = "normal" if self.status.blank?
|
240
|
-
self.reference_bucket = "#{self.bucket.reference_module}-#{self.bucket.
|
239
|
+
self.reference_bucket = "#{self.bucket.reference_module}-#{self.bucket.code}"
|
241
240
|
end
|
242
241
|
end
|
243
242
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module LesliBabel
|
2
|
+
class DeployRailsService < Lesli::ApplicationLesliService
|
3
|
+
|
4
|
+
def build
|
5
|
+
|
6
|
+
Lesli::System.engines.each do |engine, engine_info|
|
7
|
+
|
8
|
+
L2.br(30)
|
9
|
+
L2.info
|
10
|
+
|
11
|
+
# get all rails engines to buil
|
12
|
+
engine_id = Module
|
13
|
+
.where("platform in ('lesli_core', 'lesli_engine')")
|
14
|
+
.where(:code => engine_info[:code])
|
15
|
+
.pluck(:id)
|
16
|
+
|
17
|
+
# get strings filtered by module (only rails translations)
|
18
|
+
strings = StringService.new(current_user, query).list #(engine_id)
|
19
|
+
|
20
|
+
strings = strings.select(
|
21
|
+
:id,
|
22
|
+
:label,
|
23
|
+
:status,
|
24
|
+
:context,
|
25
|
+
Lesli.config.locales.keys,
|
26
|
+
"lesli_babel_modules.id as engine_id",
|
27
|
+
"lesli_babel_buckets.id as bucket_id",
|
28
|
+
"lesli_babel_buckets.code as bucket_code",
|
29
|
+
"lesli_babel_modules.code as engine_code",
|
30
|
+
"lesli_babel_modules.platform as platform",
|
31
|
+
"'' as path"
|
32
|
+
)
|
33
|
+
|
34
|
+
translations = {}
|
35
|
+
|
36
|
+
available_locales = Lesli.config.locales.keys
|
37
|
+
|
38
|
+
# add key for every available language (required by i18n Rails gem)
|
39
|
+
available_locales.each do |lang|
|
40
|
+
translations[lang] = {
|
41
|
+
:file => "",
|
42
|
+
:labels => {}
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
engine_code = engine_info[:code]
|
47
|
+
|
48
|
+
available_locales.each do |lang|
|
49
|
+
|
50
|
+
# translations path for lesli core
|
51
|
+
translations[lang][:file] = "#{engine}::Engine".constantize.root.join(
|
52
|
+
"config", "locales", "translations.#{lang}.yml"
|
53
|
+
).to_s
|
54
|
+
|
55
|
+
strings.each do |string|
|
56
|
+
|
57
|
+
bucket_code = string[:bucket_code]
|
58
|
+
|
59
|
+
unless translations[lang][:labels].has_key? engine_code
|
60
|
+
translations[lang][:labels][engine_code] = { }
|
61
|
+
end
|
62
|
+
|
63
|
+
unless translations[lang][:labels][engine_code].has_key? bucket_code
|
64
|
+
translations[lang][:labels][engine_code][bucket_code] = { }
|
65
|
+
end
|
66
|
+
|
67
|
+
# # send debug message for missing translations
|
68
|
+
string[lang] = ":" + string.path + ":" if string[lang].blank?
|
69
|
+
|
70
|
+
translations[lang][:labels][engine_code][bucket_code][string.label] = string[lang]
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
translations.each do |lang, translations|
|
77
|
+
|
78
|
+
# creates folder and subfolders
|
79
|
+
FileUtils.makedirs(File.dirname(translations[:file]))
|
80
|
+
|
81
|
+
# creates translation file for every available language
|
82
|
+
translation_file = File.new(translations[:file], "w+")
|
83
|
+
|
84
|
+
translation_file.write({ "#{lang}": translations[:labels] }.to_yaml)
|
85
|
+
|
86
|
+
translation_file.close
|
87
|
+
|
88
|
+
L2.msg "file added: #{ translations[:file] }"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -8,7 +8,7 @@ module LesliBabel
|
|
8
8
|
|
9
9
|
# get list of ids of installed engines and available third-party apps
|
10
10
|
Module
|
11
|
-
.where(:
|
11
|
+
.where(:code => babel_modules_names) # -> only installed engines
|
12
12
|
#.or(Module.where.not(:platform => ["rails_core", "rails_builder", "rails_engine"]))
|
13
13
|
.map { |engine| engine.id }
|
14
14
|
|
@@ -32,8 +32,8 @@ module LesliBabel
|
|
32
32
|
Lesli.config.locales.keys,
|
33
33
|
"lesli_babel_modules.id as engine_id",
|
34
34
|
"lesli_babel_buckets.id as bucket_id",
|
35
|
-
"lesli_babel_buckets.
|
36
|
-
"lesli_babel_modules.
|
35
|
+
"lesli_babel_buckets.code as bucket_code",
|
36
|
+
"lesli_babel_modules.code as engine_code",
|
37
37
|
"lesli_babel_modules.platform as platform",
|
38
38
|
"'' as path"
|
39
39
|
)
|
@@ -34,10 +34,10 @@ Building a better future, one line of code at a time.
|
|
34
34
|
|
35
35
|
|
36
36
|
<p class="menu-label">Modules</p>
|
37
|
-
<% LesliBabel::Module.all.order(:platform, :
|
37
|
+
<% LesliBabel::Module.all.order(:platform, :code).each do |engine| %>
|
38
38
|
<%= navigation_item(
|
39
39
|
lesli_babel.modules_path + "/" + engine.id.to_s,
|
40
|
-
engine.
|
40
|
+
engine.code.titleize,
|
41
41
|
"ri-folder-settings-line"
|
42
42
|
); %>
|
43
43
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -33,8 +33,8 @@ Building a better future, one line of code at a time.
|
|
33
33
|
class CreateLesliBabelModules < ActiveRecord::Migration[7.0]
|
34
34
|
def change
|
35
35
|
create_table :lesli_babel_modules do |t|
|
36
|
-
t.string :
|
37
|
-
t.string :platform # rails, reactnative
|
36
|
+
t.string :code # engine code
|
37
|
+
t.string :platform # rails, reactnative, etc
|
38
38
|
t.datetime :deleted_at
|
39
39
|
t.timestamps
|
40
40
|
end
|
@@ -33,7 +33,7 @@ Building a better future, one line of code at a time.
|
|
33
33
|
class CreateLesliBabelBuckets < ActiveRecord::Migration[7.0]
|
34
34
|
def change
|
35
35
|
create_table :lesli_babel_buckets do |t|
|
36
|
-
t.string :
|
36
|
+
t.string :code
|
37
37
|
t.string :reference_module
|
38
38
|
t.datetime :deleted_at
|
39
39
|
t.timestamps
|
data/lib/lesli_babel/version.rb
CHANGED