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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/lesli_babel/application.css +294 -23
- data/app/controllers/lesli_babel/application_controller.rb +14 -0
- data/app/controllers/lesli_babel/buckets_controller.rb +1 -7
- data/app/controllers/lesli_babel/labels_controller.rb +53 -35
- data/app/controllers/lesli_babel/translations_controller.rb +33 -43
- data/app/helpers/lesli_babel/labels_helper.rb +51 -2
- data/app/models/lesli_babel/application_record.rb +1 -1
- data/app/models/lesli_babel/label.rb +19 -2
- data/app/services/lesli_babel/label_service.rb +35 -6
- data/app/services/lesli_babel/translation_deploy_service.rb +144 -0
- data/app/services/lesli_babel/translation_export_service.rb +119 -0
- data/app/services/lesli_babel/translation_import_service.rb +184 -0
- data/app/services/lesli_babel/translation_service.rb +39 -151
- data/app/views/lesli_babel/dashboards/show.html.erb +62 -11
- data/app/views/lesli_babel/labels/_copy_path.html.erb +15 -0
- data/app/views/lesli_babel/labels/_delete_button.html.erb +14 -0
- data/app/views/lesli_babel/labels/_form.html.erb +56 -9
- data/app/views/lesli_babel/labels/_module_navigation.html.erb +15 -0
- data/app/views/lesli_babel/labels/index.html.erb +65 -36
- data/app/views/lesli_babel/labels/panel.html.erb +8 -0
- data/app/views/lesli_babel/labels/show.html.erb +10 -2
- data/app/views/lesli_babel/partials/_deploy_button.html.erb +21 -0
- data/config/locales/navigation.en.yml +5 -0
- data/config/locales/navigation.es.yml +5 -0
- data/config/locales/translations.en.yml +11 -1
- data/config/locales/translations.es.yml +11 -1
- data/config/locales/translations.fr.yml +2 -1
- data/config/locales/translations.it.yml +2 -1
- data/config/locales/translations.pt.yml +2 -1
- data/config/routes.rb +1 -2
- data/db/migrate/v1.0/0901100110_create_lesli_babel_modules.rb +6 -5
- data/db/migrate/v1.0/0901110110_create_lesli_babel_buckets.rb +7 -6
- data/db/migrate/v1.0/0901120110_create_lesli_babel_labels.rb +23 -22
- data/lib/lesli_babel/version.rb +2 -2
- data/lib/tasks/lesli_babel_tasks.rake +135 -83
- data/readme.md +4 -2
- metadata +12 -3
- 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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
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 %>
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
<%= render(LesliView::Components::Header.new(
|
|
5
5
|
@label.text.titleize,
|
|
6
|
-
:
|
|
6
|
+
render("copy_path", path: @label.translation_path),
|
|
7
|
+
back: labels_path
|
|
7
8
|
)) %>
|
|
8
9
|
|
|
9
|
-
|
|
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 %>
|
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)
|
|
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
|
|
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)
|
|
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
|
|
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
|
-
|
|
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)
|
|
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
|
|
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.
|
|
40
|
-
|
|
41
|
-
t.
|
|
42
|
-
t.
|
|
43
|
-
t.
|
|
44
|
-
t.
|
|
45
|
-
t.
|
|
46
|
-
t.
|
|
47
|
-
t.
|
|
48
|
-
t.
|
|
49
|
-
t.
|
|
50
|
-
t.
|
|
51
|
-
t.
|
|
52
|
-
t.
|
|
53
|
-
t.
|
|
54
|
-
t.
|
|
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
|
data/lib/lesli_babel/version.rb
CHANGED