lesli_babel 1.0.0 → 1.1.1

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.
@@ -1,130 +0,0 @@
1
- <script setup>
2
- /*
3
-
4
- Lesli
5
-
6
- Copyright (c) 2023, Lesli Technologies, S. A.
7
-
8
- This program is free software: you can redistribute it and/or modify
9
- it under the terms of the GNU General Public License as published by
10
- the Free Software Foundation, either version 3 of the License, or
11
- (at your option) any later version.
12
-
13
- This program is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU General Public License for more details.
17
-
18
- You should have received a copy of the GNU General Public License
19
- along with this program. If not, see http://www.gnu.org/licenses/.
20
-
21
- Lesli · Ruby on Rails SaaS Development Framework.
22
-
23
- Made with ♥ by https://www.lesli.tech
24
- Building a better future, one line of code at a time.
25
-
26
- @contact hello@lesli.tech
27
- @website https://www.lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
- */
33
-
34
-
35
- // · import vue tools
36
- import { ref, reactive, onMounted, watch, computed, onUnmounted } from "vue"
37
-
38
-
39
- // ·
40
- import { useString } from "LesliBabel/vue/stores/string"
41
- import { useModule } from "LesliBabel/vue/stores/module"
42
-
43
-
44
- // · implement stores
45
- const storeModule = useModule()
46
- const storeString = useString()
47
-
48
-
49
- // ·
50
- const props = defineProps({
51
- moduleId: {
52
- type: Number,
53
- require: true
54
- }
55
- })
56
-
57
-
58
- // ·
59
- const bucket = ref('')
60
- const prefix = ref('')
61
- const string = ref('')
62
-
63
-
64
- // ·
65
- const components = [{
66
- label: "column",
67
- value: "column"
68
- }, {
69
- label: "message",
70
- value: "message"
71
- }, {
72
- label: "navigation",
73
- value: "navigation"
74
- }, {
75
- label: "error",
76
- value: "error"
77
- }, {
78
- label: "button",
79
- value: "button"
80
- }, {
81
- label: "chart",
82
- value: "chart"
83
- }, {
84
- label: "tab",
85
- value: "tab"
86
- }, {
87
- label: "table",
88
- value: "table"
89
- }, {
90
- label: "toolbar",
91
- value: "toolbar"
92
- }, {
93
- label: "view",
94
- value: "view"
95
- }]
96
-
97
- </script>
98
- <template>
99
- <lesli-form @submit="storeString.post()">
100
- <div class="card-content">
101
- <div class="field">
102
- <label class="label">Bucket</label>
103
- <div class="control">
104
- <lesli-select
105
- v-model="storeString.string.bucket_id"
106
- :options="storeModule.buckets.map(b => { return { value: b.id, label: b.code }})">
107
- </lesli-select>
108
- </div>
109
- </div>
110
- <div class="field">
111
- <label class="label">Component</label>
112
- <div class="control">
113
- <lesli-select
114
- v-model="storeString.component"
115
- :options="components">
116
- </lesli-select>
117
- </div>
118
- </div>
119
- <div class="field">
120
- <label class="label">Label</label>
121
- <div class="control">
122
- <input required v-model="storeString.string.label" class="input" type="text" placeholder="Add label to translation workflow" />
123
- </div>
124
- </div>
125
- <div class="control">
126
- <input class="button is-primary" type="submit" value="Save" />
127
- </div>
128
- </div>
129
- </lesli-form>
130
- </template>
@@ -1,63 +0,0 @@
1
- /*
2
- Lesli
3
-
4
- Copyright (c) 2023, Lesli Technologies, S. A.
5
-
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.
10
-
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.
15
-
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
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
- // ·
30
- */
31
-
32
-
33
- // ·
34
- import { defineStore } from "pinia"
35
-
36
-
37
- // ·
38
- export const useModule = defineStore("babel.module", {
39
- state: () => {
40
- return {
41
- id: 0,
42
- code: "",
43
- platform: "",
44
- buckets: []
45
- }
46
- },
47
- actions: {
48
- fetchModule(modulo) {
49
- if (!modulo) return;
50
- this.http.get(this.url.babel("modules/:id", modulo)).then(result => {
51
- this.id = result.id
52
- this.code = result.code
53
- this.platform = result.platform
54
- this.fetchBuckets()
55
- })
56
- },
57
- fetchBuckets() {
58
- this.http.get(this.url.babel("modules/:id/buckets", this.id)).then(result => {
59
- this.buckets = result
60
- })
61
- }
62
- }
63
- })
@@ -1,42 +0,0 @@
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 useStatistics = defineStore("statistics", {
25
- state: () => {
26
- return {
27
- lastSyncronizationAt: "",
28
- totalStrings: 0,
29
- languages: []
30
- }
31
- },
32
- actions: {
33
- fetch() {
34
- this.http.get(this.url.babel('strings/stats')).then(result => {
35
- this.lastSyncronizationAt = result.last_syncronization_at
36
- this.totalStrings = result.total_strings
37
- this.languages = result.total_strings_translations
38
- })
39
- },
40
-
41
- }
42
- })
@@ -1,84 +0,0 @@
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
- })
@@ -1,141 +0,0 @@
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 useStrings = defineStore("babel.strings", {
25
- state: () => {
26
- return {
27
- ids: null,
28
- showPanel: false,
29
- language: 'en', // working language
30
- timer: null,
31
- search: "",
32
- module: 0,
33
- bucket: 0,
34
- strings: {
35
- loading:false,
36
- records:[],
37
- pagination:{}
38
- }
39
- }
40
- },
41
- actions: {
42
-
43
- fetchSearch(search) {
44
- this.search = search
45
- this.fetchStrings()
46
- },
47
-
48
- fetchRelevant() {
49
- this.strings.loading = true
50
- this.strings.records = []
51
- this.http.get(
52
- this.url.babel("strings/relevant")
53
- .paginate(this.strings.pagination.page, 100) // get the first 100 missing translations
54
- .order(this.language)
55
- ).then(result => {
56
- this.strings.records = result.records
57
- this.strings.pagination = result.pagination
58
- }).catch(error => {
59
- console.log(error)
60
- }).finally(() => {
61
- this.strings.loading = false
62
- })
63
- },
64
-
65
- fetchStrings() {
66
-
67
- this.strings.loading = true
68
- this.strings.records = []
69
-
70
- let params = {}
71
-
72
- if (this.module > 0) { params['module'] = this.module }
73
- if (this.bucket > 0) { params['bucket'] = this.bucket }
74
-
75
- let url = this.url
76
- .babel("strings", params)
77
- .paginate(this.strings.pagination.page, 100)
78
-
79
- if (this.search != "") {
80
- url = url.search(this.search)
81
- }
82
-
83
- // requested specific labels through id
84
- if (this.ids != null) {
85
- url = url.query("ids", this.ids)
86
- }
87
-
88
- this.http.get(url).then(result => {
89
- this.strings.records = result.records
90
- this.strings.pagination = result.pagination
91
- }).catch(error => {
92
- }).finally(()=>{
93
- this.strings.loading = false
94
- })
95
- },
96
-
97
- updateString(string, locale=false) {
98
- clearTimeout(this.timer)
99
- this.timer = setTimeout(() => {
100
- this.putString(string, locale)
101
- }, 1500)
102
- },
103
-
104
- putString(string, locale=false) {
105
-
106
- // we need to send only properties that we can update
107
- let stringToUpdate = {
108
- status: string.status,
109
- context: string.context,
110
- priority: string.priority,
111
- need_help: string.need_help,
112
- need_translation: string.need_translation
113
- }
114
-
115
- // if locale send then we update only the specific translation
116
- if (locale) {
117
- stringToUpdate[locale] = string[locale]
118
- }
119
-
120
- this.http.put(this.url.babel("strings/:id", string.id), {
121
- string: stringToUpdate
122
- }).then(result => {
123
- this.msg.success("Translation updated successfully")
124
- }).catch(error => {
125
- console.log(error)
126
- })
127
- },
128
-
129
- post(string) {
130
- this.http.post(this.url.babel('strings'), {
131
- string: string
132
- }).then(result => {
133
- if (!result) {
134
- this.msg.error("Error adding label")
135
- return
136
- }
137
- this.msg.success("Label successfully added")
138
- })
139
- }
140
- }
141
- })
@@ -1,73 +0,0 @@
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 useTranslations = defineStore("babel.translations", {
25
- state: () => {
26
- return {
27
- locales: [],
28
- localeSource: [],
29
- options: {
30
- locales_available: []
31
- }
32
- }
33
- },
34
- actions: {
35
- postRenovate() {
36
- this.http.post(this.url.babel("translations/renovate")).then(result => {
37
- this.msg.success("Translations updated")
38
- })
39
- },
40
- postDeploy() {
41
- this.http.post(this.url.babel("translations/deploy")).then(result => {
42
- this.msg.success("Deploy successfully")
43
- })
44
- },
45
- postSync() {
46
- this.http.post(this.url.babel("translations/sync")).then(result => {
47
- this.msg.success("Synchronization successfully")
48
- })
49
- },
50
- fetchOptions() {
51
- this.http.get(this.url.babel("translations/options")).then(result => {
52
-
53
- this.options = result
54
-
55
- this.locales = []
56
- this.localeSource = [{ label:'Label', value:'label' }]
57
- for(let locale in result.locales_available) {
58
- this.locales.push({
59
- label: result.locales_available[locale],
60
- value: locale
61
- })
62
- this.localeSource.push({
63
- label: result.locales_available[locale],
64
- value: locale
65
- })
66
- }
67
-
68
- }).catch(error => {
69
- console.log(error)
70
- })
71
- }
72
- }
73
- })
@@ -1,162 +0,0 @@
1
- {
2
- "en": {
3
- "lesli": {
4
- "application": {
5
- "navigation_logout": "Logout",
6
- "navigation_my_profile": "My profile"
7
- },
8
- "dashboards": {
9
- "column_default": "Default",
10
- "column_name": "Name",
11
- "title": "Dashboards",
12
- "view_add_component": "Add component"
13
- },
14
- "shared": {
15
- "button_add_new": "Add new",
16
- "button_delete": "Delete",
17
- "button_edit": "Edit",
18
- "button_list": "List",
19
- "button_reload": "Reload",
20
- "button_save": "Save",
21
- "button_settings": "Settings",
22
- "button_show": "Show",
23
- "message_operation_error": "Operation failed. Please try again.",
24
- "message_operation_success": "Operation completed successfully",
25
- "toolbar_search": "Search...",
26
- "view_discussions": "Discussions",
27
- "view_files": "Files",
28
- "view_quick_actions": "Quick actions",
29
- "view_status_active": "Active",
30
- "view_status_inactive": "Inactive"
31
- }
32
- }
33
- },
34
- "es": {
35
- "lesli": {
36
- "application": {
37
- "navigation_logout": "Cerrar sesión",
38
- "navigation_my_profile": "Mi perfil"
39
- },
40
- "dashboards": {
41
- "column_default": "Default",
42
- "column_name": "Nombre",
43
- "title": "Dashboards",
44
- "view_add_component": "Agregar componente"
45
- },
46
- "shared": {
47
- "button_add_new": "Agregar nuevo",
48
- "button_delete": "Eliminar",
49
- "button_edit": "Editar",
50
- "button_list": "Lista",
51
- "button_reload": "Recargar",
52
- "button_save": "Guardar",
53
- "button_settings": "Configuración",
54
- "button_show": "Ver",
55
- "message_operation_error": "Operación fallida. Por favor, inténtelo de nuevo.",
56
- "message_operation_success": "Operacion realizada satisfactoriamente",
57
- "toolbar_search": "Buscar...",
58
- "view_discussions": "Discusiones",
59
- "view_files": "Archivos",
60
- "view_quick_actions": "Acciones rapidas",
61
- "view_status_active": "Activo",
62
- "view_status_inactive": "Inactivo"
63
- }
64
- }
65
- },
66
- "fr": {
67
- "lesli": {
68
- "application": {
69
- "navigation_logout": ":lesli.application.navigation_logout:",
70
- "navigation_my_profile": ":lesli.application.navigation_my_profile:"
71
- },
72
- "dashboards": {
73
- "column_default": ":lesli.dashboards.column_default:",
74
- "column_name": ":lesli.dashboards.column_name:",
75
- "title": ":lesli.dashboards.title:",
76
- "view_add_component": ":lesli.dashboards.view_add_component:"
77
- },
78
- "shared": {
79
- "button_add_new": ":lesli.shared.button_add_new:",
80
- "button_delete": ":lesli.shared.button_delete:",
81
- "button_edit": ":lesli.shared.button_edit:",
82
- "button_list": ":lesli.shared.button_list:",
83
- "button_reload": ":lesli.shared.button_reload:",
84
- "button_save": ":lesli.shared.button_save:",
85
- "button_settings": ":lesli.shared.button_settings:",
86
- "button_show": ":lesli.shared.button_show:",
87
- "message_operation_error": ":lesli.shared.message_operation_error:",
88
- "message_operation_success": ":lesli.shared.message_operation_success:",
89
- "toolbar_search": ":lesli.shared.toolbar_search:",
90
- "view_discussions": ":lesli.shared.view_discussions:",
91
- "view_files": ":lesli.shared.view_files:",
92
- "view_quick_actions": ":lesli.shared.view_quick_actions:",
93
- "view_status_active": ":lesli.shared.view_status_active:",
94
- "view_status_inactive": ":lesli.shared.view_status_inactive:"
95
- }
96
- }
97
- },
98
- "it": {
99
- "lesli": {
100
- "application": {
101
- "navigation_logout": ":lesli.application.navigation_logout:",
102
- "navigation_my_profile": ":lesli.application.navigation_my_profile:"
103
- },
104
- "dashboards": {
105
- "column_default": ":lesli.dashboards.column_default:",
106
- "column_name": ":lesli.dashboards.column_name:",
107
- "title": ":lesli.dashboards.title:",
108
- "view_add_component": ":lesli.dashboards.view_add_component:"
109
- },
110
- "shared": {
111
- "button_add_new": ":lesli.shared.button_add_new:",
112
- "button_delete": ":lesli.shared.button_delete:",
113
- "button_edit": ":lesli.shared.button_edit:",
114
- "button_list": ":lesli.shared.button_list:",
115
- "button_reload": ":lesli.shared.button_reload:",
116
- "button_save": ":lesli.shared.button_save:",
117
- "button_settings": ":lesli.shared.button_settings:",
118
- "button_show": ":lesli.shared.button_show:",
119
- "message_operation_error": ":lesli.shared.message_operation_error:",
120
- "message_operation_success": ":lesli.shared.message_operation_success:",
121
- "toolbar_search": ":lesli.shared.toolbar_search:",
122
- "view_discussions": ":lesli.shared.view_discussions:",
123
- "view_files": ":lesli.shared.view_files:",
124
- "view_quick_actions": ":lesli.shared.view_quick_actions:",
125
- "view_status_active": ":lesli.shared.view_status_active:",
126
- "view_status_inactive": ":lesli.shared.view_status_inactive:"
127
- }
128
- }
129
- },
130
- "pt": {
131
- "lesli": {
132
- "application": {
133
- "navigation_logout": ":lesli.application.navigation_logout:",
134
- "navigation_my_profile": ":lesli.application.navigation_my_profile:"
135
- },
136
- "dashboards": {
137
- "column_default": ":lesli.dashboards.column_default:",
138
- "column_name": ":lesli.dashboards.column_name:",
139
- "title": ":lesli.dashboards.title:",
140
- "view_add_component": ":lesli.dashboards.view_add_component:"
141
- },
142
- "shared": {
143
- "button_add_new": ":lesli.shared.button_add_new:",
144
- "button_delete": ":lesli.shared.button_delete:",
145
- "button_edit": ":lesli.shared.button_edit:",
146
- "button_list": ":lesli.shared.button_list:",
147
- "button_reload": ":lesli.shared.button_reload:",
148
- "button_save": ":lesli.shared.button_save:",
149
- "button_settings": ":lesli.shared.button_settings:",
150
- "button_show": ":lesli.shared.button_show:",
151
- "message_operation_error": ":lesli.shared.message_operation_error:",
152
- "message_operation_success": ":lesli.shared.message_operation_success:",
153
- "toolbar_search": ":lesli.shared.toolbar_search:",
154
- "view_discussions": ":lesli.shared.view_discussions:",
155
- "view_files": ":lesli.shared.view_files:",
156
- "view_quick_actions": ":lesli.shared.view_quick_actions:",
157
- "view_status_active": ":lesli.shared.view_status_active:",
158
- "view_status_inactive": ":lesli.shared.view_status_inactive:"
159
- }
160
- }
161
- }
162
- }