lesli_babel 1.1.3 → 1.1.4

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/lesli_babel/application.css +294 -23
  3. data/app/controllers/lesli_babel/application_controller.rb +14 -0
  4. data/app/controllers/lesli_babel/buckets_controller.rb +1 -7
  5. data/app/controllers/lesli_babel/labels_controller.rb +53 -35
  6. data/app/controllers/lesli_babel/translations_controller.rb +33 -43
  7. data/app/helpers/lesli_babel/labels_helper.rb +51 -2
  8. data/app/models/lesli_babel/application_record.rb +1 -1
  9. data/app/models/lesli_babel/label.rb +19 -2
  10. data/app/services/lesli_babel/label_service.rb +35 -6
  11. data/app/services/lesli_babel/translation_deploy_service.rb +144 -0
  12. data/app/services/lesli_babel/translation_export_service.rb +119 -0
  13. data/app/services/lesli_babel/translation_import_service.rb +184 -0
  14. data/app/services/lesli_babel/translation_service.rb +39 -151
  15. data/app/views/lesli_babel/dashboards/show.html.erb +62 -11
  16. data/app/views/lesli_babel/labels/_copy_path.html.erb +15 -0
  17. data/app/views/lesli_babel/labels/_delete_button.html.erb +14 -0
  18. data/app/views/lesli_babel/labels/_form.html.erb +56 -9
  19. data/app/views/lesli_babel/labels/_module_navigation.html.erb +15 -0
  20. data/app/views/lesli_babel/labels/index.html.erb +65 -36
  21. data/app/views/lesli_babel/labels/panel.html.erb +8 -0
  22. data/app/views/lesli_babel/labels/show.html.erb +10 -2
  23. data/app/views/lesli_babel/partials/_deploy_button.html.erb +21 -0
  24. data/config/locales/navigation.en.yml +5 -0
  25. data/config/locales/navigation.es.yml +5 -0
  26. data/config/locales/translations.en.yml +11 -1
  27. data/config/locales/translations.es.yml +11 -1
  28. data/config/locales/translations.fr.yml +2 -1
  29. data/config/locales/translations.it.yml +2 -1
  30. data/config/locales/translations.pt.yml +2 -1
  31. data/config/routes.rb +1 -2
  32. data/db/migrate/v1.0/0901100110_create_lesli_babel_modules.rb +6 -5
  33. data/db/migrate/v1.0/0901110110_create_lesli_babel_buckets.rb +7 -6
  34. data/db/migrate/v1.0/0901120110_create_lesli_babel_labels.rb +23 -22
  35. data/lib/lesli_babel/version.rb +2 -2
  36. data/lib/tasks/lesli_babel_tasks.rake +135 -83
  37. data/readme.md +4 -2
  38. metadata +12 -3
  39. data/app/views/lesli_babel/partials/_sidebar.html.erb +0 -45
@@ -16,46 +16,75 @@ columns = [{
16
16
 
17
17
  <%= render(LesliView::Layout::Container.new("babel-labels")) do %>
18
18
 
19
- <%= render(LesliView::Components::Header.new((@module&.code&.titleize || "Labels"))) do %>
20
- <%= render(LesliView::Elements::Button.new('Deploy', icon:'rocket_launch', url:deploy_translations_path, method: :post)) %>
21
- <%= render(LesliView::Elements::Button.new("Add new label", icon:"add", url:new_label_path({ modules_id: @module.id }))) if @module %>
19
+ <%
20
+ title = if @missing_locale
21
+ "Pending #{@missing_locale} translations"
22
+ elsif @missing_translations
23
+ "Pending translations"
24
+ else
25
+ @module&.code&.titleize || "Labels"
26
+ end
27
+ %>
28
+ <%= render(LesliView::Components::Header.new(title)) do %>
29
+ <%= render "lesli_babel/partials/deploy_button" %>
30
+ <%= render(LesliView::Elements::Button.new(
31
+ "Add new label",
32
+ icon: "add",
33
+ url: new_label_path(modules_id: @module.id)
34
+ )) if @module %>
22
35
  <% end %>
23
36
 
24
- <%= render(LesliView::Components::Toolbar.new) %>
37
+ <div class="flex min-w-0 flex-col gap-6 lg:flex-row lg:items-start">
38
+ <%= render "lesli_babel/labels/module_navigation" %>
25
39
 
26
- <%= render LesliView::Elements::Table.new(columns: columns) do |table| %>
27
- <% @labels[:records].each do |record| %>
28
- <% table.with_row(status: record.category) do |row| %>
29
- <% row.with_cell(align: :center) do %>
30
- <%= turbo_link_to(record["id"], label_path(record["id"])) %>
31
- <% end %>
32
- <% row.with_cell do %>
33
- <%= turbo_link_to(record["text"], label_path(record["id"])) %>
34
- <% end %>
35
- <%# row.with_cell do %>
36
- <%#= turbo_link_to(record["en"] || "", label_path(record["id"])) %>
37
- <%# end %>
38
- <% row.with_cell do %>
39
- <div x-data="{ copied: false }">
40
- <button
41
- type="button"
42
- class="group inline-flex max-w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium text-slate-600 transition-colors hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/40"
43
- :aria-label="copied ? 'Path copied' : 'Copy path'"
44
- @click="
45
- navigator.clipboard.writeText($refs.path.innerText.trim());
46
- copied = true;
47
- setTimeout(() => copied = false, 2000)
48
- ">
49
- <span class="inline-flex size-5 shrink-0 items-center justify-center text-slate-400 transition-colors group-hover:text-slate-600" aria-hidden="true">
50
- <span class="material-symbols text-lg leading-none" x-text="copied ? 'check' : 'content_copy'" x-transition></span>
51
- </span>
52
- <span class="break-all font-mono text-xs leading-5" x-ref="path">
53
- <%= record["path"] %>
54
- </span>
55
- </button>
56
- </div>
40
+ <div class="min-w-0 flex-1 overflow-hidden">
41
+ <%= render(LesliView::Components::Toolbar.new) %>
42
+
43
+ <%= render LesliView::Elements::Table.new(columns: columns) do |table| %>
44
+ <% @labels[:records].each do |record| %>
45
+ <% table.with_row(status: record.category) do |row| %>
46
+ <% row.with_cell(align: :center) do %>
47
+ <%= record["id"] %>
48
+ <% end %>
49
+ <% row.with_cell do %>
50
+ <%= link_to(
51
+ record["text"],
52
+ label_path(record["id"]),
53
+ class: "link inline-block max-w-full break-all py-2",
54
+ data: { turbo_frame: "babel-label-editor" },
55
+ "x-data": "",
56
+ "@click": "$dispatch('babel-label-panel')"
57
+ ) %>
58
+ <% end %>
59
+ <% row.with_cell do %>
60
+ <div class="min-w-0 max-w-xl" x-data="{ copied: false }">
61
+ <button
62
+ type="button"
63
+ class="group inline-flex w-full min-w-0 items-start gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium text-slate-600 transition-colors hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/40"
64
+ :aria-label="copied ? 'Path copied' : 'Copy path'"
65
+ @click="
66
+ navigator.clipboard.writeText($refs.path.innerText.trim());
67
+ copied = true;
68
+ setTimeout(() => copied = false, 2000)
69
+ ">
70
+ <span class="inline-flex size-5 shrink-0 items-center justify-center text-slate-400 transition-colors group-hover:text-slate-600" aria-hidden="true">
71
+ <span class="material-symbols text-lg leading-none" x-text="copied ? 'check' : 'content_copy'" x-transition></span>
72
+ </span>
73
+ <span class="break-all font-mono text-xs leading-5" x-ref="path">
74
+ <%= record["path"] %>
75
+ </span>
76
+ </button>
77
+ </div>
78
+ <% end %>
79
+ <% end %>
57
80
  <% end %>
58
81
  <% end %>
59
- <% end %>
82
+ </div>
83
+ </div>
84
+ <% end %>
85
+
86
+ <%= render(LesliView::Components::Panel.new("Translation editor", "babel-label-panel")) do %>
87
+ <%= turbo_frame_tag("babel-label-editor") do %>
88
+ <p class="text-sm text-slate-500">Select a translation to edit.</p>
60
89
  <% end %>
61
90
  <% end %>
@@ -0,0 +1,8 @@
1
+ <%= turbo_frame_tag("babel-label-editor") do %>
2
+ <div class="mb-6">
3
+ <h3 class="break-all text-xl font-semibold text-slate-900"><%= @label.text.titleize %></h3>
4
+ </div>
5
+
6
+ <%= render("form") %>
7
+ <%= render("delete_button") %>
8
+ <% end %>
@@ -3,8 +3,16 @@
3
3
 
4
4
  <%= render(LesliView::Components::Header.new(
5
5
  @label.text.titleize,
6
- :back => module_path(@label.bucket.module.id)
6
+ render("copy_path", path: @label.translation_path),
7
+ back: labels_path
7
8
  )) %>
8
9
 
9
- <%= render("form") %>
10
+ <div class="flex min-w-0 flex-col gap-6 lg:flex-row lg:items-start">
11
+ <%= render "module_navigation" %>
12
+
13
+ <div class="min-w-0 flex-1 overflow-hidden">
14
+ <%= render "form" %>
15
+ <%= render "delete_button" %>
16
+ </div>
17
+ </div>
10
18
  <% end %>
@@ -0,0 +1,21 @@
1
+ <% if web_deploy_allowed? %>
2
+ <%= render LesliView::Elements::Button.new(
3
+ "Deploy",
4
+ solid: true,
5
+ icon: "rocket_launch",
6
+ url: deploy_translations_path,
7
+ method: :post,
8
+ data: {
9
+ turbo_confirm: "Deploy translations? This will replace the official YAML translation files with the translations currently stored in the database.",
10
+ turbo_submits_with: "Deploying..."
11
+ }
12
+ ) %>
13
+ <% else %>
14
+ <%= render LesliView::Elements::Button.new(
15
+ "Web deploy disabled",
16
+ solid: false,
17
+ icon: "lock",
18
+ disabled: true,
19
+ aria_label: "Web translation deploy is disabled"
20
+ ) %>
21
+ <% end %>
@@ -0,0 +1,5 @@
1
+ en:
2
+ lesli_babel:
3
+ navigation:
4
+ modules: "Modules"
5
+ all_modules: "All modules"
@@ -0,0 +1,5 @@
1
+ es:
2
+ lesli_babel:
3
+ navigation:
4
+ modules: "Módulos"
5
+ all_modules: "Todos los módulos"
@@ -1,2 +1,12 @@
1
1
  ---
2
- :en: {}
2
+ en:
3
+ lesli_babel:
4
+ buckets: {}
5
+ dashboards: {}
6
+ items/attachments: {}
7
+ items/discussions: {}
8
+ items/tasks: {}
9
+ labels: {}
10
+ modules: {}
11
+ shared: {}
12
+ translations: {}
@@ -1,2 +1,12 @@
1
1
  ---
2
- :es: {}
2
+ es:
3
+ lesli_babel:
4
+ buckets: {}
5
+ dashboards: {}
6
+ items/attachments: {}
7
+ items/discussions: {}
8
+ items/tasks: {}
9
+ labels: {}
10
+ modules: {}
11
+ shared: {}
12
+ translations: {}
@@ -1,2 +1,3 @@
1
1
  ---
2
- :fr: {}
2
+ fr:
3
+ lesli_babel: {}
@@ -1,2 +1,3 @@
1
1
  ---
2
- :it: {}
2
+ it:
3
+ lesli_babel: {}
@@ -1,2 +1,3 @@
1
1
  ---
2
- :pt: {}
2
+ pt:
3
+ lesli_babel: {}
data/config/routes.rb CHANGED
@@ -34,7 +34,7 @@ LesliBabel::Engine.routes.draw do
34
34
 
35
35
  Lesli::Router.mount_lesli_engine_routes(self)
36
36
 
37
- resources :labels, only: [:index, :new, :create, :show, :update]
37
+ resources :labels, only: [:index, :new, :create, :show, :update, :destroy]
38
38
 
39
39
  # working with modules
40
40
  resources :modules, only: [:index, :show] do
@@ -45,7 +45,6 @@ LesliBabel::Engine.routes.draw do
45
45
  resources :translations, only: [] do
46
46
  collection do
47
47
  post :deploy # Write translations files using translations in the database
48
- post :sync # Update database translations using translations files
49
48
  end
50
49
  end
51
50
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2026, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
20
  Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
- Made with ♥ by https://www.lesli.tech
22
+ Made with ♥ by LesliTech
23
23
  Building a better future, one line of code at a time.
24
24
 
25
25
  @contact hello@lesli.tech
@@ -33,10 +33,11 @@ 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 :code # engine code
37
- t.string :platform # rails, reactnative, etc
38
- t.datetime :deleted_at
36
+ t.string :code, null: false # engine code
37
+ t.string :platform, null: false # rails, reactnative, etc
39
38
  t.timestamps
40
39
  end
40
+
41
+ add_index(:lesli_babel_modules, %i[platform code], unique: true, name: "idx_babel_modules_unique_platform_code")
41
42
  end
42
43
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2026, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
20
  Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
- Made with ♥ by https://www.lesli.tech
22
+ Made with ♥ by LesliTech
23
23
  Building a better future, one line of code at a time.
24
24
 
25
25
  @contact hello@lesli.tech
@@ -33,11 +33,12 @@ 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 :code
37
- t.string :reference_module
38
- t.datetime :deleted_at
36
+ t.string :code, null: false
37
+ t.string :reference_module, null: false
39
38
  t.timestamps
40
39
  end
41
- add_reference(:lesli_babel_buckets, :module, foreign_key: { to_table: :lesli_babel_modules })
40
+
41
+ add_reference(:lesli_babel_buckets, :module, null: false, foreign_key: { to_table: :lesli_babel_modules })
42
+ add_index(:lesli_babel_buckets, %i[module_id code], unique: true, name: "idx_babel_buckets_unique_module_code")
42
43
  end
43
44
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2026, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
20
  Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
- Made with ♥ by https://www.lesli.tech
22
+ Made with ♥ by LesliTech
23
23
  Building a better future, one line of code at a time.
24
24
 
25
25
  @contact hello@lesli.tech
@@ -34,24 +34,24 @@ class CreateLesliBabelLabels < ActiveRecord::Migration[7.2]
34
34
  def change
35
35
  create_table :lesli_babel_labels do |t|
36
36
 
37
- t.string :text
37
+ t.string :text, null: false
38
38
  t.string :status
39
- t.string :context
40
-
41
- t.string :es # spanish
42
- t.string :en # english
43
- t.string :de # deutsch/german
44
- t.string :fr # french
45
- t.string :nl # nederlands/netherlands/holanda
46
- t.string :pl # polski/polish/poland
47
- t.string :pt # portuguese
48
- t.string :it # italian
49
- t.string :tr # turkish
50
- t.string :ro # romanian
51
- t.string :bg # bulgarian
52
- t.string :uk # Ukrainian
53
- t.string :sr # Serbian
54
- t.string :hr # Hrvatski/Croatian
39
+ t.text :context
40
+
41
+ t.text :es # spanish
42
+ t.text :en # english
43
+ t.text :de # deutsch/german
44
+ t.text :fr # french
45
+ t.text :nl # nederlands/netherlands/holanda
46
+ t.text :pl # polski/polish/poland
47
+ t.text :pt # portuguese
48
+ t.text :it # italian
49
+ t.text :tr # turkish
50
+ t.text :ro # romanian
51
+ t.text :bg # bulgarian
52
+ t.text :uk # Ukrainian
53
+ t.text :sr # Serbian
54
+ t.text :hr # Hrvatski/Croatian
55
55
 
56
56
  t.datetime :last_update_es
57
57
  t.datetime :last_update_en
@@ -71,11 +71,12 @@ class CreateLesliBabelLabels < ActiveRecord::Migration[7.2]
71
71
  t.datetime :last_update_status
72
72
  t.datetime :last_update_context
73
73
 
74
- t.string :reference_bucket
74
+ t.string :reference_bucket, null: false
75
75
 
76
- t.datetime :deleted_at
77
76
  t.timestamps
78
77
  end
79
- add_reference(:lesli_babel_labels, :bucket, foreign_key: { to_table: :lesli_babel_buckets })
78
+ add_reference(:lesli_babel_labels, :bucket, null: false, foreign_key: { to_table: :lesli_babel_buckets })
79
+ add_index(:lesli_babel_labels, %i[bucket_id text], unique: true, name: "idx_babel_labels_unique_bucket_text")
80
+ add_index(:lesli_babel_labels, :status, name: "idx_babel_labels_on_status")
80
81
  end
81
82
  end
@@ -1,4 +1,4 @@
1
1
  module LesliBabel
2
- VERSION = "1.1.3"
3
- BUILD = "1792716699"
2
+ VERSION = "1.1.4"
3
+ BUILD = "1794794731"
4
4
  end