lesli_babel 0.2.0 → 0.4.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 +1824 -1386
- 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 +11 -3
- data/app/models/lesli_babel/string.rb +3 -4
- data/app/services/lesli_babel/deploy_rails_service.rb +142 -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 +3 -3
- data/config/locales/translations.en.yml +20 -0
- data/config/locales/translations.es.yml +20 -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/engine.rb +2 -0
- data/lib/lesli_babel/version.rb +2 -2
- data/lib/tasks/lesli_babel_tasks.rake +112 -54
- data/lib/vue/application.js +33 -10
- data/lib/vue/apps/modules/show.vue +25 -11
- data/lib/vue/components/form-string-new.vue +14 -43
- data/lib/vue/stores/module.js +25 -11
- data/lib/vue/stores/string.js +84 -0
- data/lib/vue/stores/translations.js +1 -1
- data/lib/vue/stores/translations.json +48 -0
- data/readme.md +62 -9
- metadata +42 -7
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
:es:
|
3
|
+
lesli:
|
4
|
+
shared:
|
5
|
+
view_discussions: Discusiones
|
6
|
+
button_add_new: Agregar nuevo
|
7
|
+
button_reload: Recargar
|
8
|
+
view_files: Archivos
|
9
|
+
view_quick_actions: Acciones rapidas
|
10
|
+
button_list: Lista
|
11
|
+
button_save: Guardar
|
12
|
+
button_delete: Eliminar
|
13
|
+
button_edit: Editar
|
14
|
+
view_status_active: Activo
|
15
|
+
view_status_inactive: Inactivo
|
16
|
+
button_settings: Configuración
|
17
|
+
button_show: Ver
|
18
|
+
application:
|
19
|
+
navigation_logout: Cerrar sesión
|
20
|
+
navigation_my_profile: Mi perfil
|
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/engine.rb
CHANGED
@@ -43,6 +43,8 @@ module LesliBabel
|
|
43
43
|
config.i18n.default_locale = Lesli.config.locales.keys.first || :en
|
44
44
|
config.i18n.available_locales = Lesli.config.locales.keys || [:en]
|
45
45
|
|
46
|
+
config.i18n.load_path += Dir["#{Lesli::Engine.root.to_s}/config/locales/*.yml"]
|
47
|
+
|
46
48
|
# register engine migrations path
|
47
49
|
unless app.root.to_s.match root.to_s
|
48
50
|
config.paths["db/migrate"].expanded.each do |expanded_path|
|
data/lib/lesli_babel/version.rb
CHANGED
@@ -30,8 +30,8 @@ Building a better future, one line of code at a time.
|
|
30
30
|
// ·
|
31
31
|
=end
|
32
32
|
|
33
|
+
# ·
|
33
34
|
require "json"
|
34
|
-
|
35
35
|
namespace :lesli_babel do
|
36
36
|
|
37
37
|
desc "Delete translations files"
|
@@ -45,77 +45,135 @@ namespace :lesli_babel do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
desc "Create standard structure for translations according to the objects in the app"
|
48
|
-
task
|
48
|
+
task build: [:environment] do
|
49
49
|
|
50
|
-
engines = Lesli::SystemController.index(matrix:
|
50
|
+
engines = Lesli::SystemController.index(matrix: true)
|
51
51
|
|
52
|
-
engines.each do |
|
52
|
+
engines.each do |engine, routes|
|
53
53
|
|
54
54
|
platform = "lesli_engine"
|
55
|
-
platform = "lesli_core" if
|
55
|
+
platform = "lesli_core" if engine == "lesli"
|
56
|
+
platform = "rails_app" if engine == "main_app"
|
57
|
+
|
58
|
+
|
59
|
+
translation_module = LesliBabel::Module
|
60
|
+
.create_with(:platform => platform)
|
61
|
+
.find_or_create_by!(:code => engine)
|
56
62
|
|
57
|
-
# add object to the translation workflow
|
58
|
-
translation_module = LesliBabel::Module.find_or_create_by(name: t[:engine], platform: platform)
|
59
|
-
translation_bucket = LesliBabel::Bucket.find_or_create_by(name: t[:controller], module: translation_module, reference_module: translation_module.name)
|
60
|
-
translation_bucket = LesliBabel::Bucket.find_or_create_by({ name: "shared", module: translation_module, reference_module: translation_module.name })
|
61
63
|
|
62
|
-
|
64
|
+
routes.each do |controller, route|
|
65
|
+
|
66
|
+
LesliBabel::Bucket.find_or_create_by(
|
67
|
+
code: route[:route].sub("#{ engine }/", ""),
|
68
|
+
module: translation_module,
|
69
|
+
reference_module: translation_module.code
|
70
|
+
)
|
71
|
+
|
72
|
+
LesliBabel::Bucket.find_or_create_by(
|
73
|
+
code: "shared",
|
74
|
+
module: translation_module,
|
75
|
+
reference_module: translation_module.code
|
76
|
+
)
|
77
|
+
end
|
78
|
+
end
|
63
79
|
|
64
80
|
L2.msg "CloudBabel: Module/Controllers scanned and registered"
|
65
81
|
|
66
82
|
end
|
67
83
|
|
68
|
-
desc "Scan for descriptors and register labels for translations for them"
|
69
|
-
task descriptors: [:environment] do
|
70
84
|
|
71
|
-
|
85
|
+
desc "Export translations to json files"
|
86
|
+
task :export => :environment do |task, args|
|
87
|
+
|
88
|
+
Lesli::System.engines.each do |engine, engine_info|
|
89
|
+
# You can provide the config directly using the following
|
90
|
+
config = {
|
91
|
+
"translations"=> [
|
92
|
+
{
|
93
|
+
"file"=>"engines/#{engine}/lib/vue/stores/translations.json",
|
94
|
+
"patterns"=>[
|
95
|
+
"!*.date",
|
96
|
+
"!*.devise",
|
97
|
+
"!*.faker",
|
98
|
+
"!*.flash",
|
99
|
+
"!*.helpers",
|
100
|
+
"!*.number",
|
101
|
+
"!*.views",
|
102
|
+
"!*.time",
|
103
|
+
"!*.support",
|
104
|
+
"!*.i18n",
|
105
|
+
"!*.activerecord",
|
106
|
+
"!*.errors",
|
107
|
+
"!*.number.nth",
|
108
|
+
"*.lesli.shared.*",
|
109
|
+
"*.lesli.application.*",
|
110
|
+
"*.#{engine_info[:code]}.*",
|
111
|
+
|
112
|
+
]
|
113
|
+
}
|
114
|
+
]
|
115
|
+
}
|
116
|
+
|
117
|
+
pp I18nJS.call(config: config)
|
118
|
+
end
|
119
|
+
end
|
72
120
|
|
73
|
-
translation_module = CloudBabel::Module.find_or_create_by({ name: "Core", platform: "rails_core" })
|
74
|
-
translation_bucket = CloudBabel::Bucket.find_or_create_by({
|
75
|
-
name: "descriptors",
|
76
|
-
module: translation_module,
|
77
|
-
reference_module: translation_module.name
|
78
|
-
})
|
79
121
|
|
80
|
-
|
81
|
-
|
82
|
-
:label => "descriptor_#{descriptor["name"]}",
|
83
|
-
:bucket => translation_bucket
|
84
|
-
})
|
85
|
-
end
|
86
|
-
|
122
|
+
desc "Load local translations into LesliBabel"
|
123
|
+
task :load => :environment do |task, args|
|
87
124
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
Rails.application.routes.routes.each do |route|
|
94
|
-
route = route.defaults
|
95
|
-
|
96
|
-
next if route[:controller].blank?
|
97
|
-
next if route[:controller].include? "rails"
|
98
|
-
next if route[:controller].include? "action_mailbox"
|
99
|
-
next if route[:controller].include? "active_storage"
|
100
|
-
|
101
|
-
controller_list[route[:controller]] = [] unless controller_list[route[:controller]]
|
102
|
-
|
103
|
-
controller_list[route[:controller]].push(route[:action])
|
104
|
-
end
|
125
|
+
# Get all the locally installed engines
|
126
|
+
engines = Lesli::System.engines
|
127
|
+
|
128
|
+
|
129
|
+
engines.each do |engine, engine_info|
|
105
130
|
|
106
|
-
|
107
|
-
|
108
|
-
platform = "rails_builder" if engine[:type] == "builder"
|
109
|
-
routes = "#{engine[:name]}::Engine".constantize.routes.routes.each do |route|
|
110
|
-
route = route.defaults
|
111
|
-
|
112
|
-
controller_list[route[:controller]] = [] if controller_list[route[:controller]].blank?
|
113
|
-
|
114
|
-
controller_list[route[:controller]].push(route[:action])
|
131
|
+
# cache the engine code
|
132
|
+
engine_code = engine_info[:code]
|
115
133
|
|
134
|
+
# platform name
|
135
|
+
platform = "lesli_engine"
|
136
|
+
platform = "lesli_core" if engine_code == "lesli"
|
137
|
+
|
138
|
+
|
139
|
+
# create the babel module if it does not exists
|
140
|
+
translation_module = LesliBabel::Module
|
141
|
+
.create_with(:platform => platform)
|
142
|
+
.find_or_create_by!(:code => engine_code)
|
143
|
+
|
144
|
+
|
145
|
+
# Iterate over the available locales
|
146
|
+
I18n.available_locales.each do |locale|
|
147
|
+
|
148
|
+
# get the translations for an specific engine for an specific locale
|
149
|
+
translations = I18n.t(engine_code, locale: locale)
|
150
|
+
|
151
|
+
# check if the translations is an object
|
152
|
+
next unless translations.class == Hash
|
153
|
+
translations.each do |bucket, labels|
|
154
|
+
|
155
|
+
# create the bucket if it does not exist
|
156
|
+
translation_bucket = LesliBabel::Bucket.find_or_create_by(
|
157
|
+
code: bucket,
|
158
|
+
module: translation_module,
|
159
|
+
reference_module: translation_module.code
|
160
|
+
)
|
161
|
+
|
162
|
+
labels.each do |label, translation|
|
163
|
+
|
164
|
+
# create or get the label
|
165
|
+
label = LesliBabel::String.create_with(
|
166
|
+
reference_bucket: "#{translation_module.code}-#{translation_bucket.code}"
|
167
|
+
).find_or_create_by(
|
168
|
+
label: label,
|
169
|
+
bucket_id: translation_bucket.id
|
170
|
+
)
|
171
|
+
|
172
|
+
# add the correct translation to the label
|
173
|
+
label.update(locale => translation)
|
174
|
+
end
|
175
|
+
end
|
116
176
|
end
|
117
177
|
end
|
118
|
-
|
119
|
-
return controller_list
|
120
178
|
end
|
121
179
|
end
|
data/lib/vue/application.js
CHANGED
@@ -1,23 +1,42 @@
|
|
1
1
|
/*
|
2
|
-
|
2
|
+
Lesli
|
3
3
|
|
4
|
-
|
5
|
-
industrial property, intellectual property, copyright and relative international laws.
|
6
|
-
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
7
|
-
pictures and any other information belongs to the owner of this platform.
|
4
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
8
5
|
|
9
|
-
|
10
|
-
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
11
10
|
|
12
|
-
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
13
15
|
|
14
|
-
|
16
|
+
You should have received a copy of the GNU General Public License
|
17
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
|
+
|
19
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
20
|
+
|
21
|
+
Made with ♥ by https://www.lesli.tech
|
22
|
+
Building a better future, one line of code at a time.
|
23
|
+
|
24
|
+
@contact hello@lesli.tech
|
25
|
+
@website https://www.lesli.tech
|
26
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
|
+
|
28
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
15
29
|
// ·
|
16
30
|
*/
|
17
31
|
|
18
32
|
|
19
|
-
// ·
|
33
|
+
// · Import Lesli builders
|
20
34
|
import application from "Lesli/application"
|
35
|
+
import translation from "Lesli/translation"
|
36
|
+
|
37
|
+
|
38
|
+
// · Import engine translations
|
39
|
+
import translations from "LesliBabel/stores/translations.json"
|
21
40
|
|
22
41
|
|
23
42
|
// ·
|
@@ -27,6 +46,10 @@ import appTranslationsIndex from "LesliBabel/apps/translations/index.vue"
|
|
27
46
|
import appModulesShow from "LesliBabel/apps/modules/show.vue"
|
28
47
|
|
29
48
|
|
49
|
+
// · Buil Lesli translations
|
50
|
+
translation(translations)
|
51
|
+
|
52
|
+
|
30
53
|
// ·
|
31
54
|
application("LesliBabel", [{
|
32
55
|
path: "/",
|
@@ -1,18 +1,32 @@
|
|
1
1
|
<script setup>
|
2
2
|
/*
|
3
|
-
|
3
|
+
Lesli
|
4
4
|
|
5
|
-
|
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.
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
9
6
|
|
10
|
-
|
11
|
-
|
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.
|
12
11
|
|
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/.
|
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
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
16
30
|
// ·
|
17
31
|
*/
|
18
32
|
|
@@ -66,9 +80,9 @@ watch(() => route.params.id, () => {
|
|
66
80
|
</script>
|
67
81
|
<template>
|
68
82
|
<lesli-application-container>
|
69
|
-
<lesli-header :title="storeModule.
|
83
|
+
<lesli-header :title="storeModule.code">
|
70
84
|
<component-actions></component-actions>
|
71
|
-
<lesli-button
|
85
|
+
<lesli-button main icon="add" @click="storeStrings.showPanel = true">
|
72
86
|
add new string
|
73
87
|
</lesli-button>
|
74
88
|
</lesli-header>
|
@@ -37,13 +37,13 @@ import { ref, reactive, onMounted, watch, computed, onUnmounted } from "vue"
|
|
37
37
|
|
38
38
|
|
39
39
|
// ·
|
40
|
-
import {
|
40
|
+
import { useString } from "LesliBabel/stores/string"
|
41
41
|
import { useModule } from "LesliBabel/stores/module"
|
42
42
|
|
43
43
|
|
44
44
|
// · implement stores
|
45
45
|
const storeModule = useModule()
|
46
|
-
const storeString =
|
46
|
+
const storeString = useString()
|
47
47
|
|
48
48
|
|
49
49
|
// ·
|
@@ -55,12 +55,6 @@ const props = defineProps({
|
|
55
55
|
})
|
56
56
|
|
57
57
|
|
58
|
-
// ·
|
59
|
-
onMounted(() => {
|
60
|
-
|
61
|
-
})
|
62
|
-
|
63
|
-
|
64
58
|
// ·
|
65
59
|
const bucket = ref('')
|
66
60
|
const prefix = ref('')
|
@@ -68,7 +62,7 @@ const string = ref('')
|
|
68
62
|
|
69
63
|
|
70
64
|
// ·
|
71
|
-
const
|
65
|
+
const components = [{
|
72
66
|
label: "column",
|
73
67
|
value: "column"
|
74
68
|
}, {
|
@@ -87,68 +81,45 @@ const prefixes = [{
|
|
87
81
|
label: "chart",
|
88
82
|
value: "chart"
|
89
83
|
}, {
|
90
|
-
label: "
|
91
|
-
value: "
|
92
|
-
}, {
|
93
|
-
label: "table_action",
|
94
|
-
value: "table_action"
|
84
|
+
label: "tab",
|
85
|
+
value: "tab"
|
95
86
|
}, {
|
96
|
-
label: "
|
97
|
-
value: "
|
98
|
-
}, {
|
99
|
-
label: "title",
|
100
|
-
value: "title"
|
87
|
+
label: "table",
|
88
|
+
value: "table"
|
101
89
|
}, {
|
102
90
|
label: "toolbar",
|
103
91
|
value: "toolbar"
|
104
92
|
}, {
|
105
93
|
label: "view",
|
106
94
|
value: "view"
|
107
|
-
}, {
|
108
|
-
label: "view_text",
|
109
|
-
value: "view_text"
|
110
|
-
}, {
|
111
|
-
label: "view_placeholder",
|
112
|
-
value: "view_placeholder"
|
113
95
|
}]
|
114
96
|
|
115
|
-
|
116
|
-
function postString() {
|
117
|
-
storeString.post({
|
118
|
-
bucket_id: bucket.value,
|
119
|
-
context: '',
|
120
|
-
label: prefix.value + "_" + string.value
|
121
|
-
})
|
122
|
-
|
123
|
-
string.value = ''
|
124
|
-
}
|
125
|
-
|
126
97
|
</script>
|
127
98
|
<template>
|
128
|
-
<lesli-form @submit="
|
99
|
+
<lesli-form @submit="storeString.post()">
|
129
100
|
<div class="card-content">
|
130
101
|
<div class="field">
|
131
102
|
<label class="label">Bucket</label>
|
132
103
|
<div class="control">
|
133
104
|
<lesli-select
|
134
|
-
v-model="
|
135
|
-
:options="storeModule.buckets.map(b => { return { value: b.id, label: b.
|
105
|
+
v-model="storeString.string.bucket_id"
|
106
|
+
:options="storeModule.buckets.map(b => { return { value: b.id, label: b.code }})">
|
136
107
|
</lesli-select>
|
137
108
|
</div>
|
138
109
|
</div>
|
139
110
|
<div class="field">
|
140
|
-
<label class="label">
|
111
|
+
<label class="label">Component</label>
|
141
112
|
<div class="control">
|
142
113
|
<lesli-select
|
143
|
-
v-model="
|
144
|
-
:options="
|
114
|
+
v-model="storeString.component"
|
115
|
+
:options="components">
|
145
116
|
</lesli-select>
|
146
117
|
</div>
|
147
118
|
</div>
|
148
119
|
<div class="field">
|
149
120
|
<label class="label">Label</label>
|
150
121
|
<div class="control">
|
151
|
-
<input required v-model="string" class="input" type="text" placeholder="Add label to translation workflow" />
|
122
|
+
<input required v-model="storeString.string.label" class="input" type="text" placeholder="Add label to translation workflow" />
|
152
123
|
</div>
|
153
124
|
</div>
|
154
125
|
<div class="control">
|
data/lib/vue/stores/module.js
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
/*
|
2
|
-
|
2
|
+
Lesli
|
3
3
|
|
4
|
-
|
5
|
-
industrial property, intellectual property, copyright and relative international laws.
|
6
|
-
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
7
|
-
pictures and any other information belongs to the owner of this platform.
|
4
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
8
5
|
|
9
|
-
|
10
|
-
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
11
10
|
|
12
|
-
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
13
15
|
|
14
|
-
|
16
|
+
You should have received a copy of the GNU General Public License
|
17
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
|
+
|
19
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
20
|
+
|
21
|
+
Made with ♥ by https://www.lesli.tech
|
22
|
+
Building a better future, one line of code at a time.
|
23
|
+
|
24
|
+
@contact hello@lesli.tech
|
25
|
+
@website https://www.lesli.tech
|
26
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
|
+
|
28
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
15
29
|
// ·
|
16
30
|
*/
|
17
31
|
|
@@ -25,7 +39,7 @@ export const useModule = defineStore("babel.module", {
|
|
25
39
|
state: () => {
|
26
40
|
return {
|
27
41
|
id: 0,
|
28
|
-
|
42
|
+
code: "",
|
29
43
|
platform: "",
|
30
44
|
buckets: []
|
31
45
|
}
|
@@ -35,7 +49,7 @@ export const useModule = defineStore("babel.module", {
|
|
35
49
|
if (!modulo) return;
|
36
50
|
this.http.get(this.url.babel("modules/:id", modulo)).then(result => {
|
37
51
|
this.id = result.id
|
38
|
-
this.
|
52
|
+
this.code = result.code
|
39
53
|
this.platform = result.platform
|
40
54
|
this.fetchBuckets()
|
41
55
|
})
|
@@ -0,0 +1,84 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2022, all rights reserved.
|
3
|
+
|
4
|
+
All the information provided by this platform is protected by international laws related to
|
5
|
+
industrial property, intellectual property, copyright and relative international laws.
|
6
|
+
All intellectual or industrial property rights of the code, texts, trade mark, design,
|
7
|
+
pictures and any other information belongs to the owner of this platform.
|
8
|
+
|
9
|
+
Without the written permission of the owner, any replication, modification,
|
10
|
+
transmission, publication is strictly forbidden.
|
11
|
+
|
12
|
+
For more information read the license file including with this software.
|
13
|
+
|
14
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
15
|
+
// ·
|
16
|
+
*/
|
17
|
+
|
18
|
+
|
19
|
+
// ·
|
20
|
+
import { defineStore } from "pinia"
|
21
|
+
|
22
|
+
|
23
|
+
// ·
|
24
|
+
export const useString = defineStore("babel.string", {
|
25
|
+
state: () => {
|
26
|
+
return {
|
27
|
+
component: "",
|
28
|
+
string: {
|
29
|
+
bucket_id: null,
|
30
|
+
context: "",
|
31
|
+
label: ""
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},
|
35
|
+
actions: {
|
36
|
+
|
37
|
+
updateString(string, locale=false) {
|
38
|
+
clearTimeout(this.timer)
|
39
|
+
this.timer = setTimeout(() => {
|
40
|
+
this.putString(string, locale)
|
41
|
+
}, 1500)
|
42
|
+
},
|
43
|
+
|
44
|
+
putString(string, locale=false) {
|
45
|
+
|
46
|
+
// we need to send only properties that we can update
|
47
|
+
let stringToUpdate = {
|
48
|
+
status: string.status,
|
49
|
+
context: string.context,
|
50
|
+
priority: string.priority,
|
51
|
+
need_help: string.need_help,
|
52
|
+
need_translation: string.need_translation
|
53
|
+
}
|
54
|
+
|
55
|
+
// if locale send then we update only the specific translation
|
56
|
+
if (locale) {
|
57
|
+
stringToUpdate[locale] = string[locale]
|
58
|
+
}
|
59
|
+
|
60
|
+
this.http.put(this.url.babel("strings/:id", string.id), {
|
61
|
+
string: stringToUpdate
|
62
|
+
}).then(result => {
|
63
|
+
this.msg.success("Translation updated successfully")
|
64
|
+
}).catch(error => {
|
65
|
+
console.log(error)
|
66
|
+
})
|
67
|
+
},
|
68
|
+
|
69
|
+
post() {
|
70
|
+
this.http.post(this.url.babel('strings'), {
|
71
|
+
string: {
|
72
|
+
bucket_id: this.string.bucket_id,
|
73
|
+
context: this.string.context,
|
74
|
+
label: this.component + "_" + this.string.label
|
75
|
+
}
|
76
|
+
}).then(result => {
|
77
|
+
this.msg.success("Label successfully added")
|
78
|
+
this.string.label = ""
|
79
|
+
}).finally(() => {
|
80
|
+
|
81
|
+
})
|
82
|
+
}
|
83
|
+
}
|
84
|
+
})
|
@@ -39,7 +39,7 @@ export const useTranslations = defineStore("babel.translations", {
|
|
39
39
|
},
|
40
40
|
postDeploy() {
|
41
41
|
this.http.post(this.url.babel("translations/deploy")).then(result => {
|
42
|
-
this.msg.success("
|
42
|
+
this.msg.success("Deploy successfully")
|
43
43
|
})
|
44
44
|
},
|
45
45
|
postSync() {
|