lesli_babel 0.7.0 → 1.1.0
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.
- checksums.yaml +4 -4
- data/app/assets/images/lesli_babel/babel-logo.svg +1 -157
- data/app/assets/javascripts/lesli_babel/application.js +1 -4602
- data/app/assets/stylesheets/lesli_babel/application.css +0 -1051
- data/app/controllers/lesli_babel/buckets_controller.rb +8 -16
- data/app/controllers/lesli_babel/dashboards_controller.rb +1 -0
- data/app/controllers/lesli_babel/labels_controller.rb +122 -0
- data/app/controllers/lesli_babel/modules_controller.rb +6 -44
- data/app/controllers/lesli_babel/translations_controller.rb +7 -61
- data/app/helpers/lesli_babel/labels_helper.rb +4 -0
- data/app/models/lesli_babel/label.rb +57 -0
- data/app/models/lesli_babel/module.rb +1 -9
- data/app/services/lesli_babel/label_service.rb +54 -0
- data/app/services/lesli_babel/module_service.rb +4 -1
- data/app/services/lesli_babel/translation_service.rb +164 -0
- data/app/views/lesli_babel/dashboards/show.html.erb +28 -1
- data/app/views/lesli_babel/labels/_form.html.erb +35 -0
- data/app/views/lesli_babel/labels/index.html.erb +59 -0
- data/app/views/lesli_babel/labels/new.html.erb +11 -0
- data/app/views/lesli_babel/labels/show.html.erb +10 -0
- data/app/views/lesli_babel/partials/{_engine-navigation.html.erb → _navigation.html.erb} +1 -1
- data/config/locales/translations.en.yml +1 -20
- data/config/locales/translations.es.yml +1 -20
- data/config/locales/translations.fr.yml +1 -20
- data/config/locales/translations.it.yml +1 -20
- data/config/locales/translations.pt.yml +1 -20
- data/config/routes.rb +11 -21
- data/db/migrate/v1.0/{0901120110_create_lesli_babel_strings.rb → 0901120110_create_lesli_babel_labels.rb} +9 -8
- data/lib/lesli_babel/version.rb +2 -2
- data/lib/tasks/lesli_babel_tasks.rake +14 -22
- data/readme.md +71 -28
- metadata +24 -96
- data/app/controllers/lesli_babel/clones_controller.rb +0 -80
- data/app/controllers/lesli_babel/relevants_controller.rb +0 -38
- data/app/controllers/lesli_babel/strings_controller.rb +0 -142
- data/app/models/lesli_babel/clone.rb +0 -24
- data/app/models/lesli_babel/relevant.rb +0 -21
- data/app/models/lesli_babel/string.rb +0 -242
- data/app/models/lesli_babel/translation.rb +0 -5
- data/app/services/lesli_babel/deploy_rails_service.rb +0 -142
- data/app/services/lesli_babel/string_service.rb +0 -78
- data/app/views/lesli_babel/buckets/_form.html.erb +0 -17
- data/app/views/lesli_babel/buckets/edit.html.erb +0 -6
- data/app/views/lesli_babel/buckets/index.html.erb +0 -25
- data/app/views/lesli_babel/buckets/new.html.erb +0 -5
- data/app/views/lesli_babel/buckets/show.html.erb +0 -4
- data/app/views/lesli_babel/clones/_form.html.erb +0 -19
- data/app/views/lesli_babel/clones/edit.html.erb +0 -20
- data/app/views/lesli_babel/clones/index.html.erb +0 -20
- data/app/views/lesli_babel/clones/new.html.erb +0 -20
- data/app/views/lesli_babel/clones/show.html.erb +0 -20
- data/app/views/lesli_babel/dashboards/stats..html.erb +0 -1
- data/app/views/lesli_babel/modules/_form.html.erb +0 -17
- data/app/views/lesli_babel/modules/edit.html.erb +0 -1
- data/app/views/lesli_babel/modules/index.html.erb +0 -1
- data/app/views/lesli_babel/modules/new.html.erb +0 -1
- data/app/views/lesli_babel/modules/show.html.erb +0 -1
- data/app/views/lesli_babel/relevants/edit.html.erb +0 -20
- data/app/views/lesli_babel/relevants/index.html.erb +0 -21
- data/app/views/lesli_babel/relevants/new.html.erb +0 -20
- data/app/views/lesli_babel/relevants/show.html.erb +0 -20
- data/app/views/lesli_babel/string/activities/_form.html.erb +0 -17
- data/app/views/lesli_babel/string/activities/edit.html.erb +0 -6
- data/app/views/lesli_babel/string/activities/index.html.erb +0 -25
- data/app/views/lesli_babel/string/activities/new.html.erb +0 -5
- data/app/views/lesli_babel/string/activities/show.html.erb +0 -4
- data/app/views/lesli_babel/string/discussions/_form.html.erb +0 -17
- data/app/views/lesli_babel/string/discussions/edit.html.erb +0 -6
- data/app/views/lesli_babel/string/discussions/index.html.erb +0 -25
- data/app/views/lesli_babel/string/discussions/new.html.erb +0 -5
- data/app/views/lesli_babel/string/discussions/show.html.erb +0 -4
- data/app/views/lesli_babel/strings/_form.html.erb +0 -17
- data/app/views/lesli_babel/strings/edit.html.erb +0 -6
- data/app/views/lesli_babel/strings/index.html.erb +0 -25
- data/app/views/lesli_babel/strings/new.html.erb +0 -5
- data/app/views/lesli_babel/strings/show.html.erb +0 -4
- data/app/views/lesli_babel/translations/_form.html.erb +0 -17
- data/app/views/lesli_babel/translations/edit.html.erb +0 -6
- data/app/views/lesli_babel/translations/index.html.erb +0 -1
- data/app/views/lesli_babel/translations/new.html.erb +0 -5
- data/app/views/lesli_babel/translations/show.html.erb +0 -1
- data/lib/scss/application.scss +0 -47
- data/lib/scss/dashboards.scss +0 -56
- data/lib/scss/modules.scss +0 -34
- data/lib/scss/translations.scss +0 -59
- data/lib/vue/application.js +0 -69
- data/lib/vue/apps/dashboards/show.vue +0 -83
- data/lib/vue/apps/modules/show.vue +0 -106
- data/lib/vue/apps/relevants/index.vue +0 -47
- data/lib/vue/apps/translations/index.vue +0 -64
- data/lib/vue/components/actions.vue +0 -29
- data/lib/vue/components/form-label-editor.vue +0 -439
- data/lib/vue/components/form-string-new.vue +0 -130
- data/lib/vue/stores/module.js +0 -63
- data/lib/vue/stores/statistics.js +0 -42
- data/lib/vue/stores/string.js +0 -84
- data/lib/vue/stores/strings.js +0 -141
- data/lib/vue/stores/translations.js +0 -73
- data/lib/vue/stores/translations.json +0 -152
- /data/app/views/lesli_babel/partials/{_engine-sidebar.html.erb → _sidebar.html.erb} +0 -0
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
module LesliBabel
|
|
2
|
-
class String < ApplicationRecord
|
|
3
|
-
belongs_to :bucket
|
|
4
|
-
|
|
5
|
-
before_create :clean_label_string
|
|
6
|
-
=begin
|
|
7
|
-
enum prefix: {
|
|
8
|
-
# database
|
|
9
|
-
# controllers
|
|
10
|
-
# models
|
|
11
|
-
# views
|
|
12
|
-
# components
|
|
13
|
-
# elements
|
|
14
|
-
|
|
15
|
-
column
|
|
16
|
-
enum
|
|
17
|
-
|
|
18
|
-
message
|
|
19
|
-
|
|
20
|
-
navigation
|
|
21
|
-
toolbar
|
|
22
|
-
|
|
23
|
-
button
|
|
24
|
-
chart
|
|
25
|
-
title
|
|
26
|
-
form
|
|
27
|
-
}
|
|
28
|
-
=end
|
|
29
|
-
|
|
30
|
-
def self.index(current_user, query, params)
|
|
31
|
-
|
|
32
|
-
strings = TranslationsService.strings(params[:module], params[:bucket])
|
|
33
|
-
|
|
34
|
-
# if search string was sent
|
|
35
|
-
if params[:search]
|
|
36
|
-
|
|
37
|
-
search = params[:search].downcase.gsub(" ","%")
|
|
38
|
-
|
|
39
|
-
sql_where_condition = []
|
|
40
|
-
|
|
41
|
-
# add filter to select only available languages
|
|
42
|
-
Rails.application.config.lesli_settings["configuration"]["locales"].each do |locale|
|
|
43
|
-
sql_where_condition.push("LOWER(#{locale}) like :search")
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
sql_where_condition.push("LOWER(label) like :search")
|
|
47
|
-
sql_where_condition.push("LOWER(context) like :search")
|
|
48
|
-
|
|
49
|
-
# get strings with bucket and module information
|
|
50
|
-
strings = strings.where(sql_where_condition.join(" OR "), { search: "%#{ search }%" })
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# filters by specif ids sent as query params
|
|
55
|
-
if params["ids"]
|
|
56
|
-
ids = params["ids"].split(',').map{ |id| id.to_i }
|
|
57
|
-
strings = strings.where("cloud_babel_strings.id in (?)", ids)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
strings = strings.select(
|
|
61
|
-
:id,
|
|
62
|
-
:label,
|
|
63
|
-
:status,
|
|
64
|
-
:context,
|
|
65
|
-
:priority,
|
|
66
|
-
:need_help,
|
|
67
|
-
:need_translation,
|
|
68
|
-
Rails.application.config.lesli_settings["configuration"]["locales"],
|
|
69
|
-
"cloud_babel_modules.id as engine_id",
|
|
70
|
-
"cloud_babel_buckets.id as bucket_id",
|
|
71
|
-
"cloud_babel_buckets.name as bucket_name",
|
|
72
|
-
"cloud_babel_modules.name as engine_name",
|
|
73
|
-
"cloud_babel_modules.platform as platform",
|
|
74
|
-
"'' as path"
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
strings = strings
|
|
78
|
-
.page(query[:pagination][:page])
|
|
79
|
-
.per(query[:pagination][:perPage])
|
|
80
|
-
.order(:updated_at)
|
|
81
|
-
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def self.relevant current_user, query, params
|
|
86
|
-
# relevant strings:
|
|
87
|
-
# - missing translation for available language
|
|
88
|
-
# - need help
|
|
89
|
-
# - need translation
|
|
90
|
-
|
|
91
|
-
locale = query.dig(:order, :by)
|
|
92
|
-
strings = []
|
|
93
|
-
sql_where_condition = []
|
|
94
|
-
|
|
95
|
-
# add filter to select if is available language
|
|
96
|
-
if locale
|
|
97
|
-
if Rails.application.config.lesli.dig(:configuration, :locales).include?(locale.to_s)
|
|
98
|
-
sql_where_condition.push("#{locale.to_s} is NULL")
|
|
99
|
-
sql_where_condition.push("#{locale.to_s} = ''")
|
|
100
|
-
end
|
|
101
|
-
else
|
|
102
|
-
Rails.application.config.lesli.dig(:configuration, :locales).each do |locale|
|
|
103
|
-
sql_where_condition.push("#{locale} is NULL")
|
|
104
|
-
sql_where_condition.push("#{locale} = ''")
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
sql_where_condition.push("need_help = TRUE")
|
|
109
|
-
sql_where_condition.push("need_translation = TRUE")
|
|
110
|
-
|
|
111
|
-
strings = TranslationsService.strings.where(sql_where_condition.join(" OR ")).select(
|
|
112
|
-
:id,
|
|
113
|
-
:label,
|
|
114
|
-
:status,
|
|
115
|
-
:context,
|
|
116
|
-
:priority,
|
|
117
|
-
:need_help,
|
|
118
|
-
:need_translation,
|
|
119
|
-
Rails.application.config.lesli_settings["configuration"]["locales"],
|
|
120
|
-
"cloud_babel_modules.id as engine_id",
|
|
121
|
-
"cloud_babel_buckets.id as bucket_id",
|
|
122
|
-
"cloud_babel_buckets.name as bucket_name",
|
|
123
|
-
"cloud_babel_modules.name as engine_name",
|
|
124
|
-
"cloud_babel_modules.platform as platform",
|
|
125
|
-
"'' as path"
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
strings
|
|
129
|
-
.page(query[:pagination][:page])
|
|
130
|
-
.per(query[:pagination][:perPage])
|
|
131
|
-
.order(query.dig(:order, :by))
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
#######################################################################################
|
|
138
|
-
############################## Activities Log Methods ##############################
|
|
139
|
-
#######################################################################################
|
|
140
|
-
|
|
141
|
-
# @return [void]
|
|
142
|
-
# @param current_user [::User] The user that created the string
|
|
143
|
-
# @param [CloudBabel::String] The string that was created
|
|
144
|
-
# @description Creates an activity for this string indicating who created it. And
|
|
145
|
-
# also creates an activity with the initial status of the string
|
|
146
|
-
# Example
|
|
147
|
-
# params = {...}
|
|
148
|
-
# string = CloudBabel::String.create(params)
|
|
149
|
-
# CloudBabel::String.log_activity_create(User.find(1), string)
|
|
150
|
-
def self.log_activity_create(current_user, string)
|
|
151
|
-
string.activities.create(
|
|
152
|
-
user_creator: current_user,
|
|
153
|
-
category: "action_create",
|
|
154
|
-
reference_module_bucket_string: "#{string.reference_module_bucket}-#{string.label}"
|
|
155
|
-
)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
# @return [void]
|
|
159
|
-
# @param current_user [::User] The user that created the string
|
|
160
|
-
# @param string [CloudBabel::String] The string that was created
|
|
161
|
-
# @param old_attributes[Hash] The data of the record before update
|
|
162
|
-
# @param new_attributes[Hash] The data of the record after update
|
|
163
|
-
# @description Creates an activity for this string if someone changed any of this values
|
|
164
|
-
# Example
|
|
165
|
-
# string = CloudBabel::String.find(1)
|
|
166
|
-
# old_attributes = string.attributes.merge({detail_attributes: string.detail.attributes})
|
|
167
|
-
# string.update(user_main: User.find(33))
|
|
168
|
-
# new_attributes = string.attributes.merge({detail_attributes: string.detail.attributes})
|
|
169
|
-
# CloudBabel::String.log_activity_update(User.find(1), string, old_attributes, new_attributes)
|
|
170
|
-
def self.log_activity_update(current_user, string, old_attributes, new_attributes)
|
|
171
|
-
# Bucket is a special case because it's a foreign key
|
|
172
|
-
if old_attributes["cloud_babel_buckets_id"] != new_attributes["cloud_babel_buckets_id"]
|
|
173
|
-
string.activities.create(
|
|
174
|
-
user_creator: current_user,
|
|
175
|
-
category: "action_update",
|
|
176
|
-
field_name: "cloud_babel_buckets_id",
|
|
177
|
-
value_from: Bucket.find(old_attributes["cloud_babel_buckets_id"]).name,
|
|
178
|
-
value_to: Bucket.find(new_attributes["cloud_babel_buckets_id"]).name
|
|
179
|
-
)
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# We exclude certain keys that are not relevant
|
|
183
|
-
old_attributes.except!("id", "cloud_babe_buckets_id", "created_at", "updated_at", "deleted_at", "users_id")
|
|
184
|
-
|
|
185
|
-
old_attributes.each do |key, value|
|
|
186
|
-
if value != new_attributes[key]
|
|
187
|
-
value_from = value
|
|
188
|
-
value_to = new_attributes[key]
|
|
189
|
-
value_from = LC::Date.to_string_datetime(value_from) if value_from.is_a?(Time) || value_from.is_a?(Date)
|
|
190
|
-
value_to = LC::Date.to_string_datetime(value_to) if value_to.is_a?(Time) || value_to.is_a?(Date)
|
|
191
|
-
|
|
192
|
-
string.activities.create(
|
|
193
|
-
user_creator: current_user,
|
|
194
|
-
category: "action_update",
|
|
195
|
-
field_name: key,
|
|
196
|
-
value_from: value_from,
|
|
197
|
-
value_to: value_to,
|
|
198
|
-
reference_module_bucket_string: "#{string.reference_module_bucket}-#{string.label}"
|
|
199
|
-
)
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
# @return [void]
|
|
205
|
-
# @param current_user [::User] The user that created the string
|
|
206
|
-
# @param [CloudBabel::String] The string that was created
|
|
207
|
-
# @description Creates an activity for this string indicating that someone deleted it
|
|
208
|
-
# Example
|
|
209
|
-
# string = CloudBabel::String.find(1)
|
|
210
|
-
# CloudBabel::String.log_activity_show(User.find(1), string)
|
|
211
|
-
def self.log_activity_destroy(current_user, string)
|
|
212
|
-
string.activities.create(
|
|
213
|
-
user_creator: current_user,
|
|
214
|
-
category: "action_destroy",
|
|
215
|
-
reference_module_bucket_string: "#{string.reference_module_bucket}-#{string.label}"
|
|
216
|
-
)
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
def path
|
|
220
|
-
self[:engine_code]
|
|
221
|
-
.downcase
|
|
222
|
-
.concat(".")
|
|
223
|
-
.concat(self[:bucket_code])
|
|
224
|
-
.concat(".")
|
|
225
|
-
.concat(self[:label])
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
private
|
|
229
|
-
|
|
230
|
-
def clean_label_string
|
|
231
|
-
|
|
232
|
-
self.label = self.label
|
|
233
|
-
.downcase # string to lowercase
|
|
234
|
-
.gsub(/[^0-9A-Za-z\s\-\_]/, '') # remove special characters from string
|
|
235
|
-
.gsub(/-/, '_') # replace dashes with underscore
|
|
236
|
-
.gsub(/\s+/, '_') # replace spaces or spaces with single dash
|
|
237
|
-
|
|
238
|
-
self.status = "normal" if self.status.blank?
|
|
239
|
-
self.reference_bucket = "#{self.bucket.reference_module}-#{self.bucket.code}"
|
|
240
|
-
end
|
|
241
|
-
end
|
|
242
|
-
end
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
module LesliBabel
|
|
2
|
-
class DeployRailsService < Lesli::ApplicationLesliService
|
|
3
|
-
|
|
4
|
-
def build
|
|
5
|
-
|
|
6
|
-
Lesli::System.engines.each do |engine, engine_info|
|
|
7
|
-
|
|
8
|
-
# get all rails engines to buil
|
|
9
|
-
engine_id = Module
|
|
10
|
-
.where("platform in ('lesli_core', 'lesli_engine')")
|
|
11
|
-
.where(:code => engine_info[:code])
|
|
12
|
-
.pluck(:id)
|
|
13
|
-
|
|
14
|
-
engine_id_lesli = Module
|
|
15
|
-
.where("platform in ('lesli_core', 'lesli_engine')")
|
|
16
|
-
.where(:code => "lesli")
|
|
17
|
-
.pluck(:id)
|
|
18
|
-
|
|
19
|
-
bucket_id_shared = Bucket
|
|
20
|
-
.where(:code => "shared")
|
|
21
|
-
.where(:module_id => engine_id_lesli)
|
|
22
|
-
.pluck(:id)
|
|
23
|
-
|
|
24
|
-
bucket_id_application = Bucket
|
|
25
|
-
.where(:code => "application")
|
|
26
|
-
.where(:module_id => engine_id_lesli)
|
|
27
|
-
.pluck(:id)
|
|
28
|
-
|
|
29
|
-
# get strings filtered by module (only rails translations)
|
|
30
|
-
strings = StringService.new(current_user, query).list(engine_id)
|
|
31
|
-
strings_shared = StringService.new(current_user, query).list(engine_id_lesli, bucket_id_shared)
|
|
32
|
-
strings_application = StringService.new(current_user, query).list(engine_id_lesli, bucket_id_application)
|
|
33
|
-
|
|
34
|
-
strings = strings.select(
|
|
35
|
-
:id,
|
|
36
|
-
:label,
|
|
37
|
-
:status,
|
|
38
|
-
:context,
|
|
39
|
-
Lesli.config.locales.keys,
|
|
40
|
-
"lesli_babel_modules.id as engine_id",
|
|
41
|
-
"lesli_babel_buckets.id as bucket_id",
|
|
42
|
-
"lesli_babel_buckets.code as bucket_code",
|
|
43
|
-
"lesli_babel_modules.code as engine_code",
|
|
44
|
-
"lesli_babel_modules.platform as platform",
|
|
45
|
-
"'' as path"
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
translations = {}
|
|
49
|
-
|
|
50
|
-
available_locales = Lesli.config.locales.keys
|
|
51
|
-
|
|
52
|
-
# add key for every available language (required by i18n Rails gem)
|
|
53
|
-
available_locales.each do |lang|
|
|
54
|
-
translations[lang] = {
|
|
55
|
-
:file => "",
|
|
56
|
-
:labels => {}
|
|
57
|
-
}
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
engine_code = engine_info[:code]
|
|
61
|
-
|
|
62
|
-
available_locales.each do |lang|
|
|
63
|
-
|
|
64
|
-
# translations path for lesli core
|
|
65
|
-
translations[lang][:file] = "#{engine}::Engine".constantize.root.join(
|
|
66
|
-
"config", "locales", "translations.#{lang}.yml"
|
|
67
|
-
).to_s
|
|
68
|
-
|
|
69
|
-
# Create a collection of strings for the current module
|
|
70
|
-
strings.each do |string|
|
|
71
|
-
|
|
72
|
-
bucket_code = string[:bucket_code]
|
|
73
|
-
|
|
74
|
-
unless translations[lang][:labels].has_key? engine_code
|
|
75
|
-
translations[lang][:labels][engine_code] = { }
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
unless translations[lang][:labels][engine_code].has_key? bucket_code
|
|
79
|
-
translations[lang][:labels][engine_code][bucket_code] = { }
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# # send debug message for missing translations
|
|
83
|
-
string[lang] = ":" + string.path + ":" if string[lang].blank?
|
|
84
|
-
|
|
85
|
-
translations[lang][:labels][engine_code][bucket_code][string.label] = string[lang]
|
|
86
|
-
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
# Create a collection of strings for the shared labels of Lesli
|
|
90
|
-
strings_shared.each do |string|
|
|
91
|
-
|
|
92
|
-
unless translations[lang][:labels].has_key? "lesli"
|
|
93
|
-
translations[lang][:labels]["lesli"] = { }
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
unless translations[lang][:labels]["lesli"].has_key? "shared"
|
|
97
|
-
translations[lang][:labels]["lesli"]["shared"] = { }
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
# # send debug message for missing translations
|
|
101
|
-
string[lang] = ":" + string.path + ":" if string[lang].blank?
|
|
102
|
-
|
|
103
|
-
translations[lang][:labels]["lesli"]["shared"][string.label] = string[lang]
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
# Create a collection of strings for the application labels of Lesli
|
|
107
|
-
strings_application.each do |string|
|
|
108
|
-
|
|
109
|
-
unless translations[lang][:labels].has_key? "lesli"
|
|
110
|
-
translations[lang][:labels]["lesli"] = { }
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
unless translations[lang][:labels]["lesli"].has_key? "application"
|
|
114
|
-
translations[lang][:labels]["lesli"]["application"] = { }
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# # send debug message for missing translations
|
|
118
|
-
string[lang] = ":" + string.path + ":" if string[lang].blank?
|
|
119
|
-
|
|
120
|
-
translations[lang][:labels]["lesli"]["application"][string.label] = string[lang]
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
translations.each do |lang, translations|
|
|
126
|
-
|
|
127
|
-
# creates folder and subfolders
|
|
128
|
-
FileUtils.makedirs(File.dirname(translations[:file]))
|
|
129
|
-
|
|
130
|
-
# creates translation file for every available language
|
|
131
|
-
translation_file = File.new(translations[:file], "w+")
|
|
132
|
-
|
|
133
|
-
translation_file.write({ "#{lang}": translations[:labels] }.to_yaml)
|
|
134
|
-
|
|
135
|
-
translation_file.close
|
|
136
|
-
|
|
137
|
-
#L2.msg "file added: #{ translations[:file] }"
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
module LesliBabel
|
|
2
|
-
class StringService < Lesli::ApplicationLesliService
|
|
3
|
-
|
|
4
|
-
def list engines_id=nil, buckets_id=nil
|
|
5
|
-
|
|
6
|
-
# get strings with bucket and module information
|
|
7
|
-
strings = String
|
|
8
|
-
.joins("inner join lesli_babel_buckets on lesli_babel_buckets.id = lesli_babel_strings.bucket_id and lesli_babel_buckets.deleted_at is NULL")
|
|
9
|
-
.joins("inner join lesli_babel_modules on lesli_babel_modules.id = lesli_babel_buckets.module_id and lesli_babel_modules.deleted_at is NULL")
|
|
10
|
-
.where("lesli_babel_modules.id in (?)", ModuleService.new(current_user, query).list())
|
|
11
|
-
|
|
12
|
-
# filter by specific engines
|
|
13
|
-
if engines_id
|
|
14
|
-
strings = strings.where("lesli_babel_modules.id in (?)", engines_id)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# filter by specific engine buckets
|
|
18
|
-
if buckets_id
|
|
19
|
-
strings = strings.where("lesli_babel_buckets.id in (?)", buckets_id)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
strings.select(
|
|
23
|
-
:id,
|
|
24
|
-
:label,
|
|
25
|
-
:status,
|
|
26
|
-
:context,
|
|
27
|
-
Lesli.config.locales.keys,
|
|
28
|
-
"lesli_babel_modules.id as engine_id",
|
|
29
|
-
"lesli_babel_buckets.id as bucket_id",
|
|
30
|
-
"lesli_babel_buckets.code as bucket_code",
|
|
31
|
-
"lesli_babel_modules.code as engine_code",
|
|
32
|
-
"lesli_babel_modules.platform as platform",
|
|
33
|
-
"'' as path"
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def index params
|
|
39
|
-
self.list(params[:module])
|
|
40
|
-
.page(query[:pagination][:page])
|
|
41
|
-
.per(query[:pagination][:perPage])
|
|
42
|
-
.order(:updated_at)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def stats
|
|
46
|
-
|
|
47
|
-
Rails.cache.fetch("babel/strings/stats", expires_in: 1.hour) do
|
|
48
|
-
|
|
49
|
-
# total translations registered in babel
|
|
50
|
-
total_strings = self.list.reselect(:id).count
|
|
51
|
-
|
|
52
|
-
# total translations by language
|
|
53
|
-
total_strings_translations = []
|
|
54
|
-
|
|
55
|
-
Lesli.config.locales.each do |locale|
|
|
56
|
-
total_strings_translations.push({
|
|
57
|
-
code: locale[0],
|
|
58
|
-
name: locale[1],
|
|
59
|
-
total: self.list.reselect(:id).where("#{locale[0]} is not null").where("#{locale[0]} != ''").count
|
|
60
|
-
})
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
# total translations that needs help
|
|
64
|
-
total_strings_waiting_for_help = 0#self.list.reselect(:id).where(:status => 1).count
|
|
65
|
-
|
|
66
|
-
# total translations that needs translation
|
|
67
|
-
total_strings_waiting_for_translation = 0 #self.list.reselect(:id).where(:status => 2).count
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
total_strings: total_strings,
|
|
71
|
-
total_strings_translations: total_strings_translations,
|
|
72
|
-
total_strings_waiting_for_help: total_strings_waiting_for_help,
|
|
73
|
-
total_strings_waiting_for_translation: total_strings_waiting_for_translation
|
|
74
|
-
}
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<%= form_with(model: bucket, local: true) do |form| %>
|
|
2
|
-
<% if bucket.errors.any? %>
|
|
3
|
-
<div id="error_explanation">
|
|
4
|
-
<h2><%= pluralize(bucket.errors.count, "error") %> prohibited this bucket from being saved:</h2>
|
|
5
|
-
|
|
6
|
-
<ul>
|
|
7
|
-
<% bucket.errors.full_messages.each do |message| %>
|
|
8
|
-
<li><%= message %></li>
|
|
9
|
-
<% end %>
|
|
10
|
-
</ul>
|
|
11
|
-
</div>
|
|
12
|
-
<% end %>
|
|
13
|
-
|
|
14
|
-
<div class="actions">
|
|
15
|
-
<%= form.submit %>
|
|
16
|
-
</div>
|
|
17
|
-
<% end %>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<p id="notice"><%= notice %></p>
|
|
2
|
-
|
|
3
|
-
<h1>Buckets</h1>
|
|
4
|
-
|
|
5
|
-
<table>
|
|
6
|
-
<thead>
|
|
7
|
-
<tr>
|
|
8
|
-
<th colspan="3"></th>
|
|
9
|
-
</tr>
|
|
10
|
-
</thead>
|
|
11
|
-
|
|
12
|
-
<tbody>
|
|
13
|
-
<% @buckets.each do |bucket| %>
|
|
14
|
-
<tr>
|
|
15
|
-
<td><%= link_to 'Show', bucket %></td>
|
|
16
|
-
<td><%= link_to 'Edit', edit_bucket_path(bucket) %></td>
|
|
17
|
-
<td><%= link_to 'Destroy', bucket, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
18
|
-
</tr>
|
|
19
|
-
<% end %>
|
|
20
|
-
</tbody>
|
|
21
|
-
</table>
|
|
22
|
-
|
|
23
|
-
<br>
|
|
24
|
-
|
|
25
|
-
<%= link_to 'New Bucket', new_bucket_path %>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
=begin
|
|
3
|
-
Copyright (c) 2021, all rights reserved.
|
|
4
|
-
|
|
5
|
-
All the information provided by this platform is protected by international laws related to
|
|
6
|
-
industrial property, intellectual property, copyright and relative international laws.
|
|
7
|
-
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
|
8
|
-
pictures and any other information belongs to the owner of this platform.
|
|
9
|
-
|
|
10
|
-
Without the written permission of the owner, any replication, modification,
|
|
11
|
-
transmission, publication is strictly forbidden.
|
|
12
|
-
|
|
13
|
-
For more information read the license file including with this software.
|
|
14
|
-
|
|
15
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
16
|
-
// ·
|
|
17
|
-
|
|
18
|
-
=end
|
|
19
|
-
%>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
=begin
|
|
3
|
-
Copyright (c) 2021, all rights reserved.
|
|
4
|
-
|
|
5
|
-
All the information provided by this platform is protected by international laws related to
|
|
6
|
-
industrial property, intellectual property, copyright and relative international laws.
|
|
7
|
-
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
|
8
|
-
pictures and any other information belongs to the owner of this platform.
|
|
9
|
-
|
|
10
|
-
Without the written permission of the owner, any replication, modification,
|
|
11
|
-
transmission, publication is strictly forbidden.
|
|
12
|
-
|
|
13
|
-
For more information read the license file including with this software.
|
|
14
|
-
|
|
15
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
16
|
-
// ·
|
|
17
|
-
|
|
18
|
-
=end
|
|
19
|
-
%>
|
|
20
|
-
<router-view></router-view>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
=begin
|
|
3
|
-
Copyright (c) 2021, all rights reserved.
|
|
4
|
-
|
|
5
|
-
All the information provided by this platform is protected by international laws related to
|
|
6
|
-
industrial property, intellectual property, copyright and relative international laws.
|
|
7
|
-
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
|
8
|
-
pictures and any other information belongs to the owner of this platform.
|
|
9
|
-
|
|
10
|
-
Without the written permission of the owner, any replication, modification,
|
|
11
|
-
transmission, publication is strictly forbidden.
|
|
12
|
-
|
|
13
|
-
For more information read the license file including with this software.
|
|
14
|
-
|
|
15
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
16
|
-
// ·
|
|
17
|
-
|
|
18
|
-
=end
|
|
19
|
-
%>
|
|
20
|
-
<router-view></router-view>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
=begin
|
|
3
|
-
Copyright (c) 2021, all rights reserved.
|
|
4
|
-
|
|
5
|
-
All the information provided by this platform is protected by international laws related to
|
|
6
|
-
industrial property, intellectual property, copyright and relative international laws.
|
|
7
|
-
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
|
8
|
-
pictures and any other information belongs to the owner of this platform.
|
|
9
|
-
|
|
10
|
-
Without the written permission of the owner, any replication, modification,
|
|
11
|
-
transmission, publication is strictly forbidden.
|
|
12
|
-
|
|
13
|
-
For more information read the license file including with this software.
|
|
14
|
-
|
|
15
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
16
|
-
// ·
|
|
17
|
-
|
|
18
|
-
=end
|
|
19
|
-
%>
|
|
20
|
-
<router-view></router-view>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
=begin
|
|
3
|
-
Copyright (c) 2021, all rights reserved.
|
|
4
|
-
|
|
5
|
-
All the information provided by this platform is protected by international laws related to
|
|
6
|
-
industrial property, intellectual property, copyright and relative international laws.
|
|
7
|
-
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
|
8
|
-
pictures and any other information belongs to the owner of this platform.
|
|
9
|
-
|
|
10
|
-
Without the written permission of the owner, any replication, modification,
|
|
11
|
-
transmission, publication is strictly forbidden.
|
|
12
|
-
|
|
13
|
-
For more information read the license file including with this software.
|
|
14
|
-
|
|
15
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
16
|
-
// ·
|
|
17
|
-
|
|
18
|
-
=end
|
|
19
|
-
%>
|
|
20
|
-
<router-view></router-view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<router-view></router-view>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<%= form_with(model: module, local: true) do |form| %>
|
|
2
|
-
<% if module.errors.any? %>
|
|
3
|
-
<div id="error_explanation">
|
|
4
|
-
<h2><%= pluralize(module.errors.count, "error") %> prohibited this module from being saved:</h2>
|
|
5
|
-
|
|
6
|
-
<ul>
|
|
7
|
-
<% module.errors.full_messages.each do |message| %>
|
|
8
|
-
<li><%= message %></li>
|
|
9
|
-
<% end %>
|
|
10
|
-
</ul>
|
|
11
|
-
</div>
|
|
12
|
-
<% end %>
|
|
13
|
-
|
|
14
|
-
<div class="actions">
|
|
15
|
-
<%= form.submit %>
|
|
16
|
-
</div>
|
|
17
|
-
<% end %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<router-view></router-view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<router-view></router-view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<router-view></router-view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<router-view></router-view>
|