lesli_babel 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_babel_manifest.js +7 -0
  4. data/app/assets/images/lesli_babel/babel-logo.svg +157 -0
  5. data/app/assets/javascripts/lesli_babel/application.js +3288 -0
  6. data/app/assets/stylesheets/lesli_babel/application.scss +41 -0
  7. data/app/assets/stylesheets/lesli_babel/dashboards.scss +55 -0
  8. data/app/assets/stylesheets/lesli_babel/modules.scss +33 -0
  9. data/app/assets/stylesheets/lesli_babel/translations.scss +58 -0
  10. data/app/controllers/lesli_babel/application_controller.rb +37 -0
  11. data/app/controllers/lesli_babel/buckets_controller.rb +79 -0
  12. data/app/controllers/lesli_babel/clones_controller.rb +80 -0
  13. data/app/controllers/lesli_babel/dashboards_controller.rb +38 -0
  14. data/app/controllers/lesli_babel/modules_controller.rb +91 -0
  15. data/app/controllers/lesli_babel/relevants_controller.rb +38 -0
  16. data/app/controllers/lesli_babel/strings_controller.rb +142 -0
  17. data/app/controllers/lesli_babel/translations_controller.rb +134 -0
  18. data/app/jobs/lesli_babel/application_job.rb +7 -0
  19. data/app/mailers/lesli_babel/application_mailer.rb +6 -0
  20. data/app/models/lesli_babel/application_record.rb +36 -0
  21. data/app/models/lesli_babel/bucket.rb +6 -0
  22. data/app/models/lesli_babel/clone.rb +24 -0
  23. data/app/models/lesli_babel/dashboard.rb +35 -0
  24. data/app/models/lesli_babel/module.rb +35 -0
  25. data/app/models/lesli_babel/relevant.rb +21 -0
  26. data/app/models/lesli_babel/string/activity.rb +5 -0
  27. data/app/models/lesli_babel/string/discussion.rb +68 -0
  28. data/app/models/lesli_babel/string.rb +225 -0
  29. data/app/models/lesli_babel/translation.rb +5 -0
  30. data/app/services/lesli_babel/module_service.rb +18 -0
  31. data/app/services/lesli_babel/old/translations_android_service.rb +82 -0
  32. data/app/services/lesli_babel/old/translations_clone_service.rb +161 -0
  33. data/app/services/lesli_babel/old/translations_flutter_service.rb +102 -0
  34. data/app/services/lesli_babel/old/translations_ios_service.rb +119 -0
  35. data/app/services/lesli_babel/old/translations_js_service.rb +114 -0
  36. data/app/services/lesli_babel/old/translations_middleman_service.rb +77 -0
  37. data/app/services/lesli_babel/old/translations_rails_service.rb +119 -0
  38. data/app/services/lesli_babel/old/translations_service.rb +97 -0
  39. data/app/services/lesli_babel/old/translations_synchronization_service.rb +215 -0
  40. data/app/services/lesli_babel/string_service.rb +80 -0
  41. data/app/views/lesli_babel/buckets/_form.html.erb +17 -0
  42. data/app/views/lesli_babel/buckets/edit.html.erb +6 -0
  43. data/app/views/lesli_babel/buckets/index.html.erb +25 -0
  44. data/app/views/lesli_babel/buckets/new.html.erb +5 -0
  45. data/app/views/lesli_babel/buckets/show.html.erb +4 -0
  46. data/app/views/lesli_babel/clones/_form.html.erb +19 -0
  47. data/app/views/lesli_babel/clones/edit.html.erb +20 -0
  48. data/app/views/lesli_babel/clones/index.html.erb +20 -0
  49. data/app/views/lesli_babel/clones/new.html.erb +20 -0
  50. data/app/views/lesli_babel/clones/show.html.erb +20 -0
  51. data/app/views/lesli_babel/dashboards/show.html.erb +1 -0
  52. data/app/views/lesli_babel/dashboards/stats..html.erb +1 -0
  53. data/app/views/lesli_babel/modules/_form.html.erb +17 -0
  54. data/app/views/lesli_babel/modules/edit.html.erb +1 -0
  55. data/app/views/lesli_babel/modules/index.html.erb +1 -0
  56. data/app/views/lesli_babel/modules/new.html.erb +1 -0
  57. data/app/views/lesli_babel/modules/show.html.erb +1 -0
  58. data/app/views/lesli_babel/partials/_engine-navigation.html.erb +37 -0
  59. data/app/views/lesli_babel/partials/_engine-sidebar.html.erb +45 -0
  60. data/app/views/lesli_babel/relevants/edit.html.erb +20 -0
  61. data/app/views/lesli_babel/relevants/index.html.erb +21 -0
  62. data/app/views/lesli_babel/relevants/new.html.erb +20 -0
  63. data/app/views/lesli_babel/relevants/show.html.erb +20 -0
  64. data/app/views/lesli_babel/string/activities/_form.html.erb +17 -0
  65. data/app/views/lesli_babel/string/activities/edit.html.erb +6 -0
  66. data/app/views/lesli_babel/string/activities/index.html.erb +25 -0
  67. data/app/views/lesli_babel/string/activities/new.html.erb +5 -0
  68. data/app/views/lesli_babel/string/activities/show.html.erb +4 -0
  69. data/app/views/lesli_babel/string/discussions/_form.html.erb +17 -0
  70. data/app/views/lesli_babel/string/discussions/edit.html.erb +6 -0
  71. data/app/views/lesli_babel/string/discussions/index.html.erb +25 -0
  72. data/app/views/lesli_babel/string/discussions/new.html.erb +5 -0
  73. data/app/views/lesli_babel/string/discussions/show.html.erb +4 -0
  74. data/app/views/lesli_babel/strings/_form.html.erb +17 -0
  75. data/app/views/lesli_babel/strings/edit.html.erb +6 -0
  76. data/app/views/lesli_babel/strings/index.html.erb +25 -0
  77. data/app/views/lesli_babel/strings/new.html.erb +5 -0
  78. data/app/views/lesli_babel/strings/show.html.erb +4 -0
  79. data/app/views/lesli_babel/translations/_form.html.erb +17 -0
  80. data/app/views/lesli_babel/translations/edit.html.erb +6 -0
  81. data/app/views/lesli_babel/translations/index.html.erb +1 -0
  82. data/app/views/lesli_babel/translations/new.html.erb +5 -0
  83. data/app/views/lesli_babel/translations/show.html.erb +1 -0
  84. data/config/routes.rb +63 -0
  85. data/db/migrate/v1.0/0901100110_create_lesli_babel_modules.rb +42 -0
  86. data/db/migrate/v1.0/0901110110_create_lesli_babel_buckets.rb +43 -0
  87. data/db/migrate/v1.0/0901120110_create_lesli_babel_strings.rb +80 -0
  88. data/lib/lesli_babel/engine.rb +54 -0
  89. data/lib/lesli_babel/version.rb +3 -0
  90. data/lib/lesli_babel.rb +6 -0
  91. data/lib/tasks/lesli_babel_tasks.rake +121 -0
  92. data/lib/vue/application.js +46 -0
  93. data/lib/vue/apps/dashboards/show.vue +85 -0
  94. data/lib/vue/apps/modules/show.vue +97 -0
  95. data/lib/vue/apps/relevants/index.vue +47 -0
  96. data/lib/vue/apps/translations/index.vue +64 -0
  97. data/lib/vue/components/actions.vue +29 -0
  98. data/lib/vue/components/form-label-editor.vue +439 -0
  99. data/lib/vue/components/form-string-new.vue +171 -0
  100. data/lib/vue/stores/module.js +49 -0
  101. data/lib/vue/stores/statistics.js +42 -0
  102. data/lib/vue/stores/strings.js +141 -0
  103. data/lib/vue/stores/translations.js +73 -0
  104. data/license +674 -0
  105. data/readme.md +19 -0
  106. metadata +149 -0
@@ -0,0 +1,141 @@
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
+ })
@@ -0,0 +1,73 @@
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("Translations deployed")
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
+ })