diff --git a/lib/bds/desktop/menu_bar.ex b/lib/bds/desktop/menu_bar.ex
index dea3e61..98ffe71 100644
--- a/lib/bds/desktop/menu_bar.ex
+++ b/lib/bds/desktop/menu_bar.ex
@@ -7,6 +7,7 @@ defmodule BDS.Desktop.MenuBar do
alias BDS.UI.MenuBar, as: ShellMenuBar
alias Desktop.OS
alias Desktop.Window
+ use Gettext, backend: BDS.Gettext
def groups(opts \\ []) do
opts
@@ -140,60 +141,58 @@ defmodule BDS.Desktop.MenuBar do
defp native_label(label, nil), do: label
defp native_label(label, shortcut), do: label <> "\t" <> shortcut
- defp group_label(:file), do: translate("menuBar.file")
- defp group_label(:edit), do: translate("menuBar.edit")
- defp group_label(:view), do: translate("menuBar.view")
- defp group_label(:blog), do: translate("menuBar.blog")
- defp group_label(:help), do: translate("menuBar.help")
+ defp group_label(:file), do: dgettext("ui", "File")
+ defp group_label(:edit), do: dgettext("ui", "Edit")
+ defp group_label(:view), do: dgettext("ui", "View")
+ defp group_label(:blog), do: dgettext("ui", "Blog")
+ defp group_label(:help), do: dgettext("ui", "Help")
- defp item_label(:new_post), do: translate("menuBar.newPost")
- defp item_label(:import_media), do: translate("menuBar.importMedia")
- defp item_label(:save), do: translate("menuBar.save")
- defp item_label(:open_in_browser), do: translate("menuBar.openInBrowser")
- defp item_label(:open_data_folder), do: translate("menuBar.openDataFolder")
- defp item_label(:close_tab), do: translate("menuBar.closeTab")
- defp item_label(:quit), do: translate("menuBar.quit")
- defp item_label(:undo), do: translate("menuBar.undo")
- defp item_label(:redo), do: translate("menuBar.redo")
- defp item_label(:cut), do: translate("menuBar.cut")
- defp item_label(:copy), do: translate("menuBar.copy")
- defp item_label(:paste), do: translate("menuBar.paste")
- defp item_label(:delete), do: translate("menuBar.delete")
- defp item_label(:select_all), do: translate("menuBar.selectAll")
- defp item_label(:find), do: translate("menuBar.find")
- defp item_label(:replace), do: translate("menuBar.replace")
- defp item_label(:edit_preferences), do: translate("menuBar.preferences")
- defp item_label(:view_posts), do: translate("menuBar.viewPosts")
- defp item_label(:view_media), do: translate("menuBar.viewMedia")
- defp item_label(:toggle_sidebar), do: translate("menuBar.toggleSidebar")
- defp item_label(:toggle_panel), do: translate("menuBar.togglePanel")
- defp item_label(:toggle_assistant_sidebar), do: translate("menuBar.toggleAssistantSidebar")
- defp item_label(:toggle_dev_tools), do: translate("menuBar.toggleDevTools")
- defp item_label(:reload), do: translate("menuBar.reload")
- defp item_label(:force_reload), do: translate("menuBar.forceReload")
- defp item_label(:reset_zoom), do: translate("menuBar.resetZoom")
- defp item_label(:zoom_in), do: translate("menuBar.zoomIn")
- defp item_label(:zoom_out), do: translate("menuBar.zoomOut")
- defp item_label(:toggle_full_screen), do: translate("menuBar.toggleFullScreen")
- defp item_label(:publish_selected), do: translate("menuBar.publishSelected")
- defp item_label(:preview_post), do: translate("menuBar.previewPost")
- defp item_label(:edit_menu), do: translate("menuBar.editMenu")
- defp item_label(:rebuild_database), do: translate("menuBar.rebuildDatabase")
- defp item_label(:reindex_text), do: translate("menuBar.reindexText")
- defp item_label(:rebuild_embedding_index), do: translate("menuBar.rebuildEmbeddingIndex")
- defp item_label(:metadata_diff), do: translate("menuBar.metadataDiff")
- defp item_label(:regenerate_calendar), do: translate("menuBar.regenerateCalendar")
- defp item_label(:validate_translations), do: translate("menuBar.validateTranslations")
- defp item_label(:fill_missing_translations), do: translate("menuBar.fillMissingTranslations")
- defp item_label(:find_duplicates), do: translate("menuBar.findDuplicates")
- defp item_label(:generate_sitemap), do: translate("menuBar.generateSite")
- defp item_label(:validate_site), do: translate("menuBar.validateSite")
- defp item_label(:upload_site), do: translate("menuBar.uploadSite")
- defp item_label(:about), do: translate("menuBar.about")
- defp item_label(:documentation), do: translate("menuBar.documentation")
- defp item_label(:api_documentation), do: translate("menuBar.apiDocumentation")
- defp item_label(:view_on_github), do: translate("menuBar.viewOnGithub")
- defp item_label(:report_issue), do: translate("menuBar.reportIssue")
-
- defp translate(text), do: ShellData.translate(text, %{}, UILocale.current())
+ defp item_label(:new_post), do: dgettext("ui", "New Post")
+ defp item_label(:import_media), do: dgettext("ui", "Import Media")
+ defp item_label(:save), do: dgettext("ui", "Save")
+ defp item_label(:open_in_browser), do: dgettext("ui", "Open in Browser")
+ defp item_label(:open_data_folder), do: dgettext("ui", "Open Data Folder")
+ defp item_label(:close_tab), do: dgettext("ui", "Close Tab")
+ defp item_label(:quit), do: dgettext("ui", "Quit")
+ defp item_label(:undo), do: dgettext("ui", "Undo")
+ defp item_label(:redo), do: dgettext("ui", "Redo")
+ defp item_label(:cut), do: dgettext("ui", "Cut")
+ defp item_label(:copy), do: dgettext("ui", "Copy")
+ defp item_label(:paste), do: dgettext("ui", "Paste")
+ defp item_label(:delete), do: dgettext("ui", "Delete")
+ defp item_label(:select_all), do: dgettext("ui", "Select All")
+ defp item_label(:find), do: dgettext("ui", "Find")
+ defp item_label(:replace), do: dgettext("ui", "Replace")
+ defp item_label(:edit_preferences), do: dgettext("ui", "Preferences")
+ defp item_label(:view_posts), do: dgettext("ui", "Posts")
+ defp item_label(:view_media), do: dgettext("ui", "Media")
+ defp item_label(:toggle_sidebar), do: dgettext("ui", "Toggle Sidebar")
+ defp item_label(:toggle_panel), do: dgettext("ui", "Toggle Panel")
+ defp item_label(:toggle_assistant_sidebar), do: dgettext("ui", "Toggle Assistant Sidebar")
+ defp item_label(:toggle_dev_tools), do: dgettext("ui", "Toggle Dev Tools")
+ defp item_label(:reload), do: dgettext("ui", "Reload")
+ defp item_label(:force_reload), do: dgettext("ui", "Force Reload")
+ defp item_label(:reset_zoom), do: dgettext("ui", "Reset Zoom")
+ defp item_label(:zoom_in), do: dgettext("ui", "Zoom In")
+ defp item_label(:zoom_out), do: dgettext("ui", "Zoom Out")
+ defp item_label(:toggle_full_screen), do: dgettext("ui", "Toggle Full Screen")
+ defp item_label(:publish_selected), do: dgettext("ui", "Publish Selected")
+ defp item_label(:preview_post), do: dgettext("ui", "Preview Post")
+ defp item_label(:edit_menu), do: dgettext("ui", "Edit Menu")
+ defp item_label(:rebuild_database), do: dgettext("ui", "Rebuild Database")
+ defp item_label(:reindex_text), do: dgettext("ui", "Reindex Text")
+ defp item_label(:rebuild_embedding_index), do: dgettext("ui", "Rebuild Embedding Index")
+ defp item_label(:metadata_diff), do: dgettext("ui", "Metadata Diff")
+ defp item_label(:regenerate_calendar), do: dgettext("ui", "Regenerate Calendar")
+ defp item_label(:validate_translations), do: dgettext("ui", "Validate Translations")
+ defp item_label(:fill_missing_translations), do: dgettext("ui", "Fill Missing Translations")
+ defp item_label(:find_duplicates), do: dgettext("ui", "Find Duplicate Posts")
+ defp item_label(:generate_sitemap), do: dgettext("ui", "Generate Site")
+ defp item_label(:validate_site), do: dgettext("ui", "Validate Site")
+ defp item_label(:upload_site), do: dgettext("ui", "Upload Site")
+ defp item_label(:about), do: dgettext("ui", "About")
+ defp item_label(:documentation), do: dgettext("ui", "Documentation")
+ defp item_label(:api_documentation), do: dgettext("ui", "API Documentation")
+ defp item_label(:view_on_github), do: dgettext("ui", "View on GitHub")
+ defp item_label(:report_issue), do: dgettext("ui", "Report Issue")
end
diff --git a/lib/bds/desktop/shell_data.ex b/lib/bds/desktop/shell_data.ex
index 7353307..6acf9b0 100644
--- a/lib/bds/desktop/shell_data.ex
+++ b/lib/bds/desktop/shell_data.ex
@@ -1,6 +1,8 @@
defmodule BDS.Desktop.ShellData do
@moduledoc false
+ use Gettext, backend: BDS.Gettext
+
alias BDS.Git
alias BDS.I18n
alias BDS.Projects
@@ -12,12 +14,24 @@ defmodule BDS.Desktop.ShellData do
Application.get_env(:bds, :desktop)[:title] || "Blogging Desktop Server"
end
- def ui_language do
- I18n.current_ui_locale()
+ def activity_icon(id) do
+ case to_string(id) do
+ "posts" -> ~s( )
+ "pages" -> ~s( )
+ "media" -> ~s( )
+ "scripts" -> ~s( )
+ "templates" -> ~s( )
+ "tags" -> ~s( )
+ "chat" -> ~s( )
+ "import" -> ~s( )
+ "git" -> ~s( )
+ "settings" -> ~s( )
+ _other -> activity_icon("posts")
+ end
end
- def translations(locale \\ nil) do
- I18n.get_ui_translations(effective_ui_language(locale))
+ def ui_language do
+ I18n.current_ui_locale()
end
def supported_ui_languages do
@@ -26,14 +40,6 @@ defmodule BDS.Desktop.ShellData do
end)
end
- def translate(key, bindings \\ %{}, locale \\ nil) do
- text = Map.get(translations(locale), to_string(key), to_string(key))
-
- Enum.reduce(bindings, text, fn {binding, value}, acc ->
- String.replace(acc, "%{#{binding}}", to_string(value))
- end)
- end
-
def project_snapshot do
Projects.shell_snapshot()
rescue
@@ -77,20 +83,20 @@ defmodule BDS.Desktop.ShellData do
def assistant_cards do
[
- %{label: "Offline Gate", text: "Automatic AI actions stay gated by airplane mode."},
+ %{label: dgettext("ui", "Offline Gate"), text: dgettext("ui", "Automatic AI actions stay gated by airplane mode.")},
%{
- label: "Filesystem Sync",
- text: "Metadata flush, diffing, and rebuild hooks still need editor wiring."
+ label: dgettext("ui", "Filesystem Sync"),
+ text: dgettext("ui", "Metadata flush, diffing, and rebuild hooks still need editor wiring.")
},
- %{label: "Desktop Runtime", text: "The app window is now served from LiveView state."}
+ %{label: dgettext("ui", "Desktop Runtime"), text: dgettext("ui", "The app window is now served from LiveView state.")}
]
end
def editor_meta(task_status) do
[
- %{label: "Status", value: task_status.running_task_message || "Idle"},
- %{label: "Mode", value: "Offline"},
- %{label: "Main Language", value: ui_language()}
+ %{label: dgettext("ui", "Status"), value: task_status.running_task_message || dgettext("ui", "Idle")},
+ %{label: dgettext("ui", "Mode"), value: dgettext("ui", "Offline")},
+ %{label: dgettext("ui", "Main Language"), value: ui_language()}
]
end
@@ -140,70 +146,18 @@ defmodule BDS.Desktop.ShellData do
|> Enum.uniq()
end
- defp git_remote_state_provider do
- Application.get_env(:bds, :git_remote_state_provider, &Git.remote_state/2)
- end
-
- defp parse_positive_count(value) do
- case Integer.parse(value) do
- {count, _rest} when count > 0 -> count
- _other -> 0
- end
- end
-
- def activity_icon(id) do
- case to_string(id) do
- "posts" ->
- ~s( )
-
- "pages" ->
- ~s( )
-
- "media" ->
- ~s( )
-
- "scripts" ->
- ~s( )
-
- "templates" ->
- ~s( )
-
- "tags" ->
- ~s( )
-
- "chat" ->
- ~s( )
-
- "import" ->
- ~s( )
-
- "git" ->
- ~s( )
-
- "settings" ->
- ~s( )
-
- _other ->
- activity_icon("posts")
- end
- end
-
def dashboard_status_label(status) do
case to_string(status) do
- "draft" -> translate("dashboard.status.draft")
- "published" -> translate("dashboard.status.published")
- "archived" -> translate("dashboard.status.archived")
+ "draft" -> dgettext("ui", "Draft")
+ "published" -> dgettext("ui", "Published")
+ "archived" -> dgettext("ui", "Archived")
other -> other |> String.replace("_", " ") |> String.capitalize()
end
end
def dashboard_post_count_label(count) do
normalized_count = count || 0
-
- key =
- if normalized_count == 1, do: "dashboard.postCount.one", else: "dashboard.postCount.other"
-
- translate(key, %{count: normalized_count})
+ dngettext("ui", "%{count} post", "%{count} posts", normalized_count, count: normalized_count)
end
def dashboard_tag_cloud_items(items) when is_list(items) do
@@ -258,10 +212,10 @@ defmodule BDS.Desktop.ShellData do
def route_label(route) do
case to_string(route) do
"git_log" ->
- "Git Log"
+ dgettext("ui", "Git Log")
"post_links" ->
- "Post Links"
+ dgettext("ui", "Post Links")
other ->
other
@@ -288,11 +242,16 @@ defmodule BDS.Desktop.ShellData do
end
end
- defp effective_ui_language(nil) do
- BDS.Desktop.UILocale.current() || ui_language()
+ defp git_remote_state_provider do
+ Application.get_env(:bds, :git_remote_state_provider, &Git.remote_state/2)
end
- defp effective_ui_language(locale), do: locale
+ defp parse_positive_count(value) do
+ case Integer.parse(value) do
+ {count, _rest} when count > 0 -> count
+ _other -> 0
+ end
+ end
defp maybe_add_panel_tab(tabs, :post, :post_links), do: tabs ++ [:post_links]
diff --git a/lib/bds/desktop/shell_live.ex b/lib/bds/desktop/shell_live.ex
index c043444..b7da0d4 100644
--- a/lib/bds/desktop/shell_live.ex
+++ b/lib/bds/desktop/shell_live.ex
@@ -57,6 +57,7 @@ defmodule BDS.Desktop.ShellLive do
alias BDS.UI.{Commands, MenuBar, Session, Workbench}
alias Desktop.OS
alias BDS.Desktop.Shutdown
+ use Gettext, backend: BDS.Gettext
@refresh_interval 1_500
@output_entry_limit 20
@@ -586,29 +587,26 @@ defmodule BDS.Desktop.ShellLive do
|> assign(:current_tab, current_tab(workbench))
end
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, UILocale.current())
-
defp encoded_shortcuts(shortcuts), do: Jason.encode!(shortcuts)
defp encoded_workbench_session(workbench), do: Jason.encode!(Session.serialize(workbench))
- defp panel_tab_label(:tasks), do: translated("Tasks")
- defp panel_tab_label(:output), do: translated("Output")
- defp panel_tab_label(:git_log), do: translated("Git Log")
+ defp panel_tab_label(:tasks), do: dgettext("ui", "Tasks")
+ defp panel_tab_label(:output), do: dgettext("ui", "Output")
+ defp panel_tab_label(:git_log), do: dgettext("ui", "Git Log")
defp panel_tab_label(tab), do: ShellData.route_label(tab)
- defp activity_label("AI Assistant"), do: "Chat"
- defp activity_label("Source Control"), do: "Git"
- defp activity_label(label), do: translated(label)
+ defp activity_label("AI Assistant"), do: dgettext("ui", "Chat")
+ defp activity_label("Source Control"), do: dgettext("ui", "Git")
+ defp activity_label(label), do: label
defp active_sidebar_label(activity_buttons, active_view, sidebar_data) do
- Enum.find_value(activity_buttons, translated(Map.get(sidebar_data, :title, "")), fn button ->
+ Enum.find_value(activity_buttons, Map.get(sidebar_data, :title, ""), fn button ->
if button.id == active_view, do: activity_label(button.label), else: nil
end)
end
- defp sidebar_header_label(label), do: translated(label)
+ defp sidebar_header_label(label), do: label
defp timeline_height(entry, entries) do
max_count =
@@ -680,6 +678,8 @@ defmodule BDS.Desktop.ShellLive do
if normalized == socket.assigns.page_language do
socket
else
+ UILocale.put(normalized)
+
socket
|> assign(:page_language, normalized)
|> reload_shell(socket.assigns.workbench)
diff --git a/lib/bds/desktop/shell_live/chat_editor.ex b/lib/bds/desktop/shell_live/chat_editor.ex
index 270e95d..3862159 100644
--- a/lib/bds/desktop/shell_live/chat_editor.ex
+++ b/lib/bds/desktop/shell_live/chat_editor.ex
@@ -6,9 +6,9 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
import Phoenix.HTML, only: [raw: 1]
alias BDS.{AI, BoundedAtoms, MapUtils, Persistence}
- alias BDS.Desktop.ShellData
alias BDS.Desktop.ShellLive.ChatEditor.{MessageBuild, ModelSelection, ToolTracking}
alias BDS.Desktop.ShellLive.TabHelpers
+ use Gettext, backend: BDS.Gettext
embed_templates("chat_editor_html/*")
@@ -72,7 +72,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
{:noreply, assign(socket, :model_selector_open?, false) |> build_data()}
{:error, reason} ->
- notify_parent({:chat_editor_output, translated("Chat"), inspect(reason), "error"})
+ notify_parent({:chat_editor_output, dgettext("ui", "Chat"), inspect(reason), "error"})
{:noreply, assign(socket, :model_selector_open?, false) |> build_data()}
end
end
@@ -196,8 +196,8 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
socket.assigns.offline_mode ->
notify_parent(
- {:chat_editor_output, translated("Chat"),
- translated("Automatic AI actions stay gated by airplane mode."), "info"}
+ {:chat_editor_output, dgettext("ui", "Chat"),
+ dgettext("ui", "Automatic AI actions stay gated by airplane mode."), "info"}
)
build_data(socket)
@@ -272,7 +272,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
assign(socket, :request, nil) |> build_data()
{:error, reason} ->
- notify_parent({:chat_editor_output, translated("Chat"), format_error(reason), "error"})
+ notify_parent({:chat_editor_output, dgettext("ui", "Chat"), format_error(reason), "error"})
assign(socket, :request, nil) |> build_data()
end
end
@@ -483,8 +483,8 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
# ── HEEx-callable helpers ─────────────────────────────────────────────────
@spec message_role_label(atom()) :: String.t()
- def message_role_label(:user), do: translated("chat.role.you")
- def message_role_label(_role), do: translated("chat.role.assistant")
+ def message_role_label(:user), do: dgettext("ui", "You")
+ def message_role_label(_role), do: dgettext("ui", "Assistant")
defdelegate tool_call_name(tool_call), to: ToolTracking
defdelegate tool_call_arguments(tool_call), to: ToolTracking
@@ -547,10 +547,10 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
<% end %>
@@ -571,7 +571,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
<%= case @surface.type do %>
@@ -848,7 +848,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
defp present?(value), do: not is_nil(value)
defp format_error(%{kind: :endpoint_not_configured}),
- do: translated("chat.apiKeyRequiredDescription")
+ do: dgettext("ui", "Configure an API key in Settings to enable AI chat.")
defp format_error(reason), do: inspect(reason)
@@ -860,7 +860,4 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
:error -> 0
end
end
-
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
end
diff --git a/lib/bds/desktop/shell_live/chat_editor/message_build.ex b/lib/bds/desktop/shell_live/chat_editor/message_build.ex
index 9479722..c1908ed 100644
--- a/lib/bds/desktop/shell_live/chat_editor/message_build.ex
+++ b/lib/bds/desktop/shell_live/chat_editor/message_build.ex
@@ -3,8 +3,8 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.MessageBuild do
alias BDS.AI
alias BDS.AI.ChatConversation
- alias BDS.Desktop.ShellData
alias BDS.Desktop.ShellLive.ChatEditor.{ModelSelection, ToolSurfaces, ToolTracking}
+ use Gettext, backend: BDS.Gettext
@spec build(term()) :: term()
def build(%{current_tab: %{type: :chat, id: conversation_id}} = assigns) do
@@ -22,7 +22,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.MessageBuild do
%{
id: conversation.id,
- title: conversation.title || translated("chat.newChat"),
+ title: conversation.title || dgettext("ui", "New Chat"),
model: conversation.model,
effective_model: effective_model,
available_models: available_models,
@@ -268,7 +268,4 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.MessageBuild do
defp request_started_at(%{started_at: started_at}) when is_integer(started_at), do: started_at
defp request_started_at(_request), do: nil
-
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
end
diff --git a/lib/bds/desktop/shell_live/chat_editor/model_selection.ex b/lib/bds/desktop/shell_live/chat_editor/model_selection.ex
index ebfca46..44a7084 100644
--- a/lib/bds/desktop/shell_live/chat_editor/model_selection.ex
+++ b/lib/bds/desktop/shell_live/chat_editor/model_selection.ex
@@ -2,9 +2,9 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.ModelSelection do
@moduledoc false
alias BDS.AI
- alias BDS.Desktop.ShellData
import Phoenix.Component, only: [assign: 3]
+ use Gettext, backend: BDS.Gettext
@spec toggle_model_selector(term(), term()) :: term()
def toggle_model_selector(socket, reload) do
@@ -34,7 +34,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.ModelSelection do
{:error, reason} ->
socket
- |> append_output.(translated("Chat"), inspect(reason), nil, "error")
+ |> append_output.(dgettext("ui", "Chat"), inspect(reason), nil, "error")
|> reload.(socket.assigns.workbench)
end
end
@@ -78,7 +78,4 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.ModelSelection do
defp blank?(value) when is_binary(value), do: String.trim(value) == ""
defp blank?(nil), do: true
-
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
end
diff --git a/lib/bds/desktop/shell_live/chat_editor/tool_surfaces.ex b/lib/bds/desktop/shell_live/chat_editor/tool_surfaces.ex
index 7965199..bfebca2 100644
--- a/lib/bds/desktop/shell_live/chat_editor/tool_surfaces.ex
+++ b/lib/bds/desktop/shell_live/chat_editor/tool_surfaces.ex
@@ -1,7 +1,7 @@
defmodule BDS.Desktop.ShellLive.ChatEditor.ToolSurfaces do
@moduledoc false
- alias BDS.Desktop.ShellData
+ use Gettext, backend: BDS.Gettext
@render_tool_names MapSet.new([
"render_card",
@@ -85,7 +85,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.ToolSurfaces do
|> List.wrap()
|> Enum.map(fn entry ->
%{
- label: map_value(entry, "label", translated("chat.role.assistant")),
+ label: map_value(entry, "label", dgettext("ui", "Assistant")),
value: numeric_value(map_value(entry, "value", 0)),
segments: List.wrap(map_value(entry, "segments", []))
}
@@ -173,7 +173,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.ToolSurfaces do
fields: fields,
submit_label:
map_value(arguments, "submitLabel") ||
- map_value(arguments, "submit_label", translated("chat.stop")),
+ map_value(arguments, "submit_label", dgettext("ui", "Stop")),
submit_action:
map_value(arguments, "submitAction") ||
map_value(arguments, "submit_action", "submitForm")
@@ -249,7 +249,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.ToolSurfaces do
defp decode_surface_actions(actions) when is_list(actions) do
Enum.map(actions, fn action ->
%{
- label: map_value(action, "label", translated("chat.openSettings")),
+ label: map_value(action, "label", dgettext("ui", "Open Settings")),
action: map_value(action, "action", "openSettings"),
payload: map_value(action, "payload", %{})
}
@@ -296,7 +296,4 @@ defmodule BDS.Desktop.ShellLive.ChatEditor.ToolSurfaces do
defp truthy?(value) when value in [true, "true", 1, "1", "on"], do: true
defp truthy?(_value), do: false
-
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
end
diff --git a/lib/bds/desktop/shell_live/chat_editor_html/chat_editor.html.heex b/lib/bds/desktop/shell_live/chat_editor_html/chat_editor.html.heex
index 2abe445..98e6a06 100644
--- a/lib/bds/desktop/shell_live/chat_editor_html/chat_editor.html.heex
+++ b/lib/bds/desktop/shell_live/chat_editor_html/chat_editor.html.heex
@@ -3,7 +3,7 @@
<%= if @chat_editor.needs_api_key? do %>
- <%= translated("chat.setupTitle") %>
+ <%= dgettext("ui", "AI Chat Setup") %>
<% else %>
<%= @chat_editor.title %>
<% end %>
@@ -18,7 +18,7 @@
phx-target={@myself}
data-testid="chat-model-selector-button"
>
- <%= @chat_editor.effective_model || translated("chat.modelUnavailable") %>
+ <%= @chat_editor.effective_model || dgettext("ui", "No model") %>
▾
@@ -59,24 +59,24 @@
<%= if @chat_editor.needs_api_key? do %>
🔑
-
<%= translated("chat.apiKeyRequiredTitle") %>
-
<%= translated("chat.apiKeyRequiredDescription") %>
+
<%= dgettext("ui", "API Key Required") %>
+
<%= dgettext("ui", "Configure an API key in Settings to enable AI chat.") %>
- <%= translated("chat.openSettings") %>
+ <%= dgettext("ui", "Open Settings") %>
<% else %>
<%= if Enum.empty?(@chat_editor.messages) and not @chat_editor.is_streaming do %>
🤖
-
<%= translated("chat.welcomeTitle") %>
-
<%= translated("chat.welcomeDescription") %>
+
<%= dgettext("ui", "Welcome to the AI Assistant") %>
+
<%= dgettext("ui", "I can help you manage your blog with rich visualizations. Try asking me to:") %>
- <%= translated("chat.welcomeTipSearch") %>
- <%= translated("chat.welcomeTipChart") %>
- <%= translated("chat.welcomeTipTable") %>
- <%= translated("chat.welcomeTipMetadata") %>
- <%= translated("chat.welcomeTipTabs") %>
+ <%= dgettext("ui", "Search for posts about a specific topic") %>
+ <%= dgettext("ui", "Show a chart of posts published per month") %>
+ <%= dgettext("ui", "Compare my recent posts in a table") %>
+ <%= dgettext("ui", "Update metadata for posts or media") %>
+ <%= dgettext("ui", "Show post statistics by year in tabs with charts") %>
<% else %>
@@ -149,11 +149,11 @@
<%= unless @chat_editor.needs_api_key? do %>
<%= if @chat_editor.is_streaming do %>
-
◼ <%= translated("chat.stop") %>
+
◼ <%= dgettext("ui", "Stop") %>
<% end %>
diff --git a/lib/bds/desktop/shell_live/chat_surface.ex b/lib/bds/desktop/shell_live/chat_surface.ex
index c444b04..a8977fc 100644
--- a/lib/bds/desktop/shell_live/chat_surface.ex
+++ b/lib/bds/desktop/shell_live/chat_surface.ex
@@ -3,7 +3,7 @@ defmodule BDS.Desktop.ShellLive.ChatSurface do
import Phoenix.Component, only: [assign: 3]
- alias BDS.Desktop.ShellData
+ use Gettext, backend: BDS.Gettext
def assistant_turn(prompt, socket) do
[
@@ -12,12 +12,12 @@ defmodule BDS.Desktop.ShellLive.ChatSurface do
]
end
- def assistant_project_name(nil), do: translated("Projects")
+ def assistant_project_name(nil), do: dgettext("ui", "Projects")
def assistant_project_name(project), do: project.name
- def assistant_message_label("assistant"), do: translated("Assistant")
- def assistant_message_label("user"), do: translated("You")
- def assistant_message_label(_role), do: translated("Assistant")
+ def assistant_message_label("assistant"), do: dgettext("ui", "Assistant")
+ def assistant_message_label("user"), do: dgettext("ui", "You")
+ def assistant_message_label(_role), do: dgettext("ui", "Assistant")
def assistant_message_testid(role), do: "assistant-message-#{role}"
@@ -30,19 +30,9 @@ defmodule BDS.Desktop.ShellLive.ChatSurface do
defp assistant_reply(socket) do
if socket.assigns.offline_mode do
- ShellData.translate(
- "Automatic AI actions stay gated by airplane mode.",
- %{},
- socket.assigns.page_language
- )
+ BDS.Gettext.lgettext(socket.assigns.page_language, "ui", "Automatic AI actions stay gated by airplane mode.")
else
- ShellData.translate(
- "The assistant sidebar chat surface is ready, but model execution is not connected yet.",
- %{},
- socket.assigns.page_language
- )
+ BDS.Gettext.lgettext(socket.assigns.page_language, "ui", "The assistant sidebar chat surface is ready, but model execution is not connected yet.")
end
end
-
- defp translated(text), do: ShellData.translate(text, %{}, BDS.Desktop.UILocale.current())
end
diff --git a/lib/bds/desktop/shell_live/import_editor.ex b/lib/bds/desktop/shell_live/import_editor.ex
index 849c8b2..5d48fde 100644
--- a/lib/bds/desktop/shell_live/import_editor.ex
+++ b/lib/bds/desktop/shell_live/import_editor.ex
@@ -30,6 +30,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
translate_execution_phase: 1
]
+ use Gettext, backend: BDS.Gettext
import TaxonomyEditing,
only: [
existing_taxonomy_terms: 1,
@@ -162,7 +163,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
definition_id = socket.assigns.definition_id
socket =
- case FolderPicker.choose_directory(translated("importAnalysis.uploadsFolder")) do
+ case FolderPicker.choose_directory(dgettext("ui", "Uploads Folder")) do
{:ok, uploads_folder_path} ->
{:ok, _definition} =
ImportDefinitions.update_definition(definition_id, %{
@@ -175,7 +176,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
build_data(socket)
{:error, %{message: message}} ->
- notify_output(translated("activity.import"), message, "error")
+ notify_output(dgettext("ui", "Import"), message, "error")
build_data(socket)
end
@@ -187,7 +188,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
project_id = socket.assigns.project_id
socket =
- case FilePicker.choose_file(translated("importAnalysis.wxrFile")) do
+ case FilePicker.choose_file(dgettext("ui", "WXR File")) do
{:ok, wxr_file_path} ->
{:ok, definition} =
ImportDefinitions.update_definition(definition_id, %{
@@ -214,7 +215,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
socket
|> assign(:analysis_state, %{
loading: true,
- step: translated("importAnalysis.analyzingWxr"),
+ step: dgettext("ui", "Analyzing WXR file..."),
detail: Path.basename(wxr_file_path),
file_path: wxr_file_path,
ref: task.ref
@@ -226,7 +227,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
build_data(socket)
{:error, %{message: message}} ->
- notify_output(translated("activity.import"), message, "error")
+ notify_output(dgettext("ui", "Import"), message, "error")
build_data(socket)
end
@@ -430,12 +431,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
%{} = report <- ImportDefinitions.decode_analysis_result(definition) do
if socket.assigns.offline_mode? do
notify_output(
- translated("activity.import"),
- ShellData.translate(
- "Automatic AI actions stay gated by airplane mode.",
- %{},
- socket.assigns[:page_language] || ShellData.ui_language()
- ),
+ dgettext("ui", "Import"),
+ BDS.Gettext.lgettext(socket.assigns[:page_language] || ShellData.ui_language(), "ui", "Automatic AI actions stay gated by airplane mode."),
"info"
)
@@ -467,15 +464,15 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
mapped_count = TaxonomyEditing.auto_mapped_count(report, updated_report)
notify_output(
- translated("activity.import"),
- translated("importAnalysis.mappedCount", %{count: mapped_count}),
+ dgettext("ui", "Import"),
+ dgettext("ui", "%{count} mapped", count: mapped_count),
"info"
)
build_data(socket)
{:error, reason} ->
- notify_output(translated("activity.import"), inspect(reason), "error")
+ notify_output(dgettext("ui", "Import"), inspect(reason), "error")
build_data(socket)
end
end
@@ -552,7 +549,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
socket
|> assign(:analysis_state, default_analysis_state())
- |> notify_output(translated("activity.import"), message, "error")
+ |> notify_output(dgettext("ui", "Import"), message, "error")
match?(%{ref: ^ref}, socket.assigns.execution_state) and reason not in [:normal, :shutdown] ->
message = if is_binary(reason), do: reason, else: inspect(reason)
@@ -567,7 +564,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
ref: nil
})
)
- |> notify_output(translated("activity.import"), message, "error")
+ |> notify_output(dgettext("ui", "Import"), message, "error")
true ->
socket
@@ -630,11 +627,11 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
end
defp maybe_update_tab_meta(socket, name) do
- title = name || translated("importAnalysis.untitledImport")
+ title = name || dgettext("ui", "Untitled Import")
notify_parent(
{:import_editor_tab_meta, socket.assigns.definition_id, title,
- translated("importAnalysis.headerDescription")}
+ dgettext("ui", "Select a WordPress export file (WXR) and an uploads folder to analyze what would be imported.")}
)
socket
@@ -653,7 +650,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
end
end
- defp selected_model_label(nil, []), do: translated("importAnalysis.analyzeWith")
+ defp selected_model_label(nil, []), do: dgettext("ui", "Analyze with...")
defp selected_model_label(nil, [model | _rest]), do: model.name || model.id
defp selected_model_label(model_id, available_models) do
@@ -685,14 +682,14 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
socket
{:error, reason} ->
- notify_output(socket, translated("activity.import"), inspect(reason), "error")
+ notify_output(socket, dgettext("ui", "Import"), inspect(reason), "error")
end
{:error, %{message: message}} ->
- notify_output(socket, translated("activity.import"), message, "error")
+ notify_output(socket, dgettext("ui", "Import"), message, "error")
{:error, reason} ->
- notify_output(socket, translated("activity.import"), inspect(reason), "error")
+ notify_output(socket, dgettext("ui", "Import"), inspect(reason), "error")
end
end
@@ -713,8 +710,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
ref: nil
})
|> notify_output(
- translated("activity.import"),
- translated("importAnalysis.importComplete", %{count: previous_state.count}),
+ dgettext("ui", "Import"),
+ dgettext("ui", "Import completed successfully!", count: previous_state.count),
"info"
)
@@ -727,7 +724,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
error: message,
ref: nil
})
- |> notify_output(translated("activity.import"), message, "error")
+ |> notify_output(dgettext("ui", "Import"), message, "error")
{:error, reason} ->
message = inspect(reason)
@@ -740,7 +737,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
error: message,
ref: nil
})
- |> notify_output(translated("activity.import"), message, "error")
+ |> notify_output(dgettext("ui", "Import"), message, "error")
end
# Allow DB connections to settle before rebuilding
@@ -812,27 +809,27 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
class="import-definition-name"
type="text"
name="import_definition[name]"
- value={@import_editor.definition_name || translated("importAnalysis.untitledImport")}
- placeholder={translated("importAnalysis.namePlaceholder")}
+ value={@import_editor.definition_name || dgettext("ui", "Untitled Import")}
+ placeholder={dgettext("ui", "Import name...")}
/>
-
<%= translated("importAnalysis.headerDescription") %>
+
<%= dgettext("ui", "Select a WordPress export file (WXR) and an uploads folder to analyze what would be imported.") %>
-
<%= translated("importAnalysis.uploadsFolder") %>
+
<%= dgettext("ui", "Uploads Folder") %>
- <%= @import_editor.uploads_folder_path || translated("importAnalysis.noFolderSelected") %>
+ <%= @import_editor.uploads_folder_path || dgettext("ui", "No folder selected") %>
-
<%= translated("Open") %>
+
<%= dgettext("ui", "Open") %>
-
<%= translated("importAnalysis.wxrFile") %>
+
<%= dgettext("ui", "WXR File") %>
- <%= @import_editor.wxr_file_path || translated("importAnalysis.selectFileToAnalyze") %>
+ <%= @import_editor.wxr_file_path || dgettext("ui", "Select a file to analyze") %>
-
<%= translated("importAnalysis.selectAndAnalyze") %>
+
<%= dgettext("ui", "Select & Analyze") %>
@@ -840,7 +837,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
-
<%= @analysis_state.step || translated("importAnalysis.analyzingWxr") %>
+
<%= @analysis_state.step || dgettext("ui", "Analyzing WXR file...") %>
<%= if present?(@analysis_state.detail) do %>
<%= @analysis_state.detail %>
<% end %>
@@ -851,37 +848,37 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= if not is_nil(@report) and not @import_editor.is_loading do %>
- <%= translated("importAnalysis.site") %>
- <%= get_in(@report, [:site_info, :title]) || translated("importAnalysis.untitled") %>
+ <%= dgettext("ui", "Site") %>
+ <%= get_in(@report, [:site_info, :title]) || dgettext("ui", "Untitled") %>
- <%= translated("importAnalysis.url") %>
- <%= get_in(@report, [:site_info, :url]) || translated("importAnalysis.notAvailable") %>
+ <%= dgettext("ui", "URL") %>
+ <%= get_in(@report, [:site_info, :url]) || dgettext("ui", "N/A") %>
- <%= translated("importAnalysis.language") %>
- <%= get_in(@report, [:site_info, :language]) || translated("importAnalysis.notAvailable") %>
+ <%= dgettext("ui", "Language") %>
+ <%= get_in(@report, [:site_info, :language]) || dgettext("ui", "N/A") %>
- <%= translated("importAnalysis.file") %>
+ <%= dgettext("ui", "File") %>
<%= @import_editor.wxr_file_path |> to_string() |> Path.basename() %>
- <.stat_card label={translated("importAnalysis.posts")} stats={@report.post_stats} />
+ <.stat_card label={dgettext("ui", "posts")} stats={@report.post_stats} />
<%= if Map.get(@report, :other_stats) && Map.get(@report.other_stats, :total, 0) > 0 do %>
- <.other_stat_card label={translated("importAnalysis.other")} stats={@report.other_stats} />
+ <.other_stat_card label={dgettext("ui", "Other")} stats={@report.other_stats} />
<% end %>
- <.stat_card label={translated("importAnalysis.pages")} stats={@report.page_stats} />
- <.media_stat_card label={translated("importAnalysis.media")} stats={@report.media_stats} />
- <.taxonomy_stat_card label={translated("importAnalysis.categories")} stats={@report.category_stats} />
- <.taxonomy_stat_card label={translated("importAnalysis.tags")} stats={@report.tag_stats} />
+ <.stat_card label={dgettext("ui", "pages")} stats={@report.page_stats} />
+ <.media_stat_card label={dgettext("ui", "media")} stats={@report.media_stats} />
+ <.taxonomy_stat_card label={dgettext("ui", "Categories")} stats={@report.category_stats} />
+ <.taxonomy_stat_card label={dgettext("ui", "Tags")} stats={@report.tag_stats} />
<%= if Enum.any?(Map.get(@report, :date_distribution, [])) do %>
-
<%= translated("importAnalysis.dateDistribution") %>
+
<%= dgettext("ui", "Date Distribution") %>
<%= for row <- @report.date_distribution do %>
@@ -900,13 +897,13 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= if @execution_state.is_executing do %>
-
<%= @execution_state.phase || translated("importAnalysis.executionStarting") %>
+
<%= @execution_state.phase || dgettext("ui", "Starting...") %>
<%= if present?(@execution_state.detail) do %>
<%= @execution_state.detail %>
<% end %>
@@ -921,18 +918,18 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= if not @execution_state.is_executing and not @execution_state.completed do %>
- <%= translated("importAnalysis.readyToImport") %>
- <%= if @counts.tags > 0 do %><%= @counts.tags %> <%= translated("importAnalysis.tagsCategories") %> <% end %>
- <%= if @counts.posts > 0 do %><%= @counts.posts %> <%= translated("importAnalysis.posts") %> <% end %>
- <%= if @counts.media > 0 do %><%= @counts.media %> <%= translated("importAnalysis.media") %> <% end %>
- <%= if @counts.pages > 0 do %><%= @counts.pages %> <%= translated("importAnalysis.pages") %> <% end %>
+ <%= dgettext("ui", "Ready to import:") %>
+ <%= if @counts.tags > 0 do %><%= @counts.tags %> <%= dgettext("ui", "tags/categories") %> <% end %>
+ <%= if @counts.posts > 0 do %><%= @counts.posts %> <%= dgettext("ui", "posts") %> <% end %>
+ <%= if @counts.media > 0 do %><%= @counts.media %> <%= dgettext("ui", "media") %> <% end %>
+ <%= if @counts.pages > 0 do %><%= @counts.pages %> <%= dgettext("ui", "pages") %> <% end %>
<%= if @counts.total == 0 do %>
- <%= translated("importAnalysis.nothingToImport") %>
+ <%= dgettext("ui", "Nothing to Import") %>
<% else %>
- <%= translated("importAnalysis.importItems", %{count: @counts.total}) %>
+ <%= dgettext("ui", "Import %{count} Items", count: @counts.total) %>
<% end %>
@@ -940,56 +937,56 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= if @execution_state.completed do %>
- <%= translated("importAnalysis.importComplete", %{count: @execution_state.count || @counts.total}) %>
+ <%= dgettext("ui", "Import completed successfully!", count: @execution_state.count || @counts.total) %>
<% end %>
<%= if present?(@execution_state.error) do %>
- <%= translated("importAnalysis.importFailed", %{error: @execution_state.error}) %>
+ <%= dgettext("ui", "Import failed: %{error}", error: @execution_state.error) %>
<% end %>
<%= if Enum.any?(@post_conflicts) do %>
- <.conflict_section title={translated("importAnalysis.postSlugConflicts")} items={@post_conflicts} expanded={@sections.post_conflicts} section="post_conflicts" myself={@myself} />
+ <.conflict_section title={dgettext("ui", "Post Slug Conflicts")} items={@post_conflicts} expanded={@sections.post_conflicts} section="post_conflicts" myself={@myself} />
<% end %>
<%= if Enum.any?(@page_conflicts) do %>
- <.conflict_section title={translated("importAnalysis.pageSlugConflicts")} items={@page_conflicts} expanded={@sections.page_conflicts} section="page_conflicts" myself={@myself} />
+ <.conflict_section title={dgettext("ui", "Page Slug Conflicts")} items={@page_conflicts} expanded={@sections.page_conflicts} section="page_conflicts" myself={@myself} />
<% end %>
<%= if Enum.any?(@post_items) do %>
- <.post_detail_section title={translated("importAnalysis.postsWithCount", %{count: length(@post_items)})} items={@post_items} expanded={@sections.posts} section="posts" myself={@myself} />
+ <.post_detail_section title={dgettext("ui", "Posts (%{count})", count: length(@post_items))} items={@post_items} expanded={@sections.posts} section="posts" myself={@myself} />
<% end %>
<%= if Enum.any?(@other_items) do %>
- <.post_detail_section title={translated("importAnalysis.otherWithCount", %{count: length(@other_items)})} items={@other_items} expanded={@sections.other} section="other" show_type={true} myself={@myself} />
+ <.post_detail_section title={dgettext("ui", "Other (%{count})", count: length(@other_items))} items={@other_items} expanded={@sections.other} section="other" show_type={true} myself={@myself} />
<% end %>
<%= if Enum.any?(@detail_pages) do %>
- <.post_detail_section title={translated("importAnalysis.pagesWithCount", %{count: length(@detail_pages)})} items={@detail_pages} expanded={@sections.pages} section="pages" myself={@myself} />
+ <.post_detail_section title={dgettext("ui", "Pages (%{count})", count: length(@detail_pages))} items={@detail_pages} expanded={@sections.pages} section="pages" myself={@myself} />
<% end %>
<%= if Enum.any?(@detail_media) do %>
- <.media_detail_section title={translated("importAnalysis.mediaWithCount", %{count: length(@detail_media)})} items={@detail_media} expanded={@sections.media} section="media" myself={@myself} />
+ <.media_detail_section title={dgettext("ui", "Media (%{count})", count: length(@detail_media))} items={@detail_media} expanded={@sections.media} section="media" myself={@myself} />
<% end %>
<%= if Enum.any?(Map.get(@report.items, :categories, [])) or Enum.any?(Map.get(@report.items, :tags, [])) do %>
- <%= translated("importAnalysis.taxonomyTitle") %>
+ <%= dgettext("ui", "Categories & Tags") %>
<%= if @sections.taxonomy, do: "▾", else: "▸" %>
<%= if @sections.taxonomy do %>
-
<%= translated("importAnalysis.analyzeWith") %>
+
<%= dgettext("ui", "Analyze with...") %>
<%= if @import_editor.model_selector_open? do %>
<%= for model <- @import_editor.available_models do %>
- <%= model.provider_name || model.provider || translated("importAnalysis.unknown") %>: <%= model.name || model.id %>
+ <%= model.provider_name || model.provider || dgettext("ui", "Unknown") %>: <%= model.name || model.id %>
<% end %>
@@ -1000,12 +997,12 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= @import_editor.selected_model_label %>
-
<%= translated("importAnalysis.aiMappingHint") %>
+
<%= dgettext("ui", "AI will suggest mappings from new to existing items to avoid duplicates") %>
<.taxonomy_group
- title={translated("importAnalysis.categories")}
+ title={dgettext("ui", "Categories")}
items={Map.get(@report.items, :categories, [])}
suggestions={Map.get(@import_editor.taxonomy_terms, :categories, [])}
edit={@import_editor.taxonomy_edit}
@@ -1013,7 +1010,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
myself={@myself}
/>
<.taxonomy_group
- title={translated("importAnalysis.tags")}
+ title={dgettext("ui", "Tags")}
items={Map.get(@report.items, :tags, [])}
suggestions={Map.get(@import_editor.taxonomy_terms, :tags, [])}
edit={@import_editor.taxonomy_edit}
@@ -1029,14 +1026,14 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= if Enum.any?(Map.get(macros, :discovered, [])) do %>
- <%= translated("importAnalysis.macrosWithCount", %{count: macros.total || length(macros.discovered)}) %>
+ <%= dgettext("ui", "Macros (%{count})", count: macros.total || length(macros.discovered)) %>
<%= if @sections.macros, do: "▾", else: "▸" %>
<%= if @sections.macros do %>
- <%= translated("importAnalysis.mappedCount", %{count: macros.mapped_count || 0}) %>
- <%= translated("importAnalysis.unmappedCount", %{count: macros.unmapped_count || 0}) %>
+ <%= dgettext("ui", "%{count} mapped", count: macros.mapped_count || 0) %>
+ <%= dgettext("ui", "%{count} unmapped", count: macros.unmapped_count || 0) %>
<%= for macro <- macros.discovered do %>
@@ -1044,9 +1041,9 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= if Enum.any?(Map.get(macro, :usages, [])) do %>
@@ -1058,17 +1055,17 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= k %>=<%= v %>
<% end %>
<% else %>
- <%= translated("importAnalysis.noParameters") %>
+ <%= dgettext("ui", "(no parameters)") %>
<% end %>
- <%= translated("importAnalysis.macroUses", %{count: usage.count}) %>
+ <%= dgettext("ui", "%{count} uses", count: usage.count) %>
<% end %>
<% end %>
<%= if Enum.any?(Map.get(macro, :post_slugs, [])) do %>
- <%= translated("importAnalysis.usedIn", %{items: Enum.join(Enum.take(macro.post_slugs, 5), ", "), more: if(length(macro.post_slugs) > 5, do: translated("importAnalysis.moreSuffix", %{count: length(macro.post_slugs) - 5}), else: "")}) %>
+ <%= dgettext("ui", "Used in: %{items}%{more}", items: Enum.join(Enum.take(macro.post_slugs, 5), ", "), more: (if length(macro.post_slugs) > 5, do: dgettext("ui", ", +%{count} more", count: length(macro.post_slugs) - 5), else: "")) %>
<% end %>
@@ -1084,7 +1081,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
-
<%= translated("importAnalysis.emptyState") %>
+
<%= dgettext("ui", "Select a WordPress export file to begin analysis.") %>
<% end %>
<% end %>
@@ -1111,10 +1108,10 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
- <%= translated("importAnalysis.slug") %>
- <%= translated("importAnalysis.newEntryWxr") %>
- <%= translated("importAnalysis.existingEntry") %>
- <%= translated("importAnalysis.resolution") %>
+ <%= dgettext("ui", "Slug") %>
+ <%= dgettext("ui", "New Entry (WXR)") %>
+ <%= dgettext("ui", "Existing Entry") %>
+ <%= dgettext("ui", "Resolution") %>
@@ -1122,15 +1119,15 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= Map.get(item, :slug) %>
<%= Map.get(item, :title) %>
- <%= Map.get(item, :existing_title) || translated("importAnalysis.none") %>
+ <%= Map.get(item, :existing_title) || dgettext("ui", "--") %>
- <%= translated("importAnalysis.ignore") %>
- <%= translated("importAnalysis.overwrite") %>
- <%= translated("importAnalysis.importNewSlug") %>
+ <%= dgettext("ui", "Ignore") %>
+ <%= dgettext("ui", "Overwrite") %>
+ <%= dgettext("ui", "Import (new slug)") %>
@@ -1163,15 +1160,15 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
- <%= translated("importAnalysis.status") %>
+ <%= dgettext("ui", "Status") %>
<%= if @show_type do %>
- <%= translated("importAnalysis.type") %>
+ <%= dgettext("ui", "Type") %>
<% end %>
- <%= translated("importAnalysis.title") %>
- <%= translated("importAnalysis.slug") %>
- <%= translated("importAnalysis.categories") %>
- <%= translated("importAnalysis.wpStatus") %>
- <%= translated("importAnalysis.existingMatch") %>
+ <%= dgettext("ui", "Title") %>
+ <%= dgettext("ui", "Slug") %>
+ <%= dgettext("ui", "Categories") %>
+ <%= dgettext("ui", "WP Status") %>
+ <%= dgettext("ui", "Existing Match") %>
@@ -1184,8 +1181,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= Map.get(item, :title) %>
<%= Map.get(item, :slug) %>
<%= joined_or_none(Map.get(item, :categories)) %>
- <%= Map.get(item, :wp_status) || translated("importAnalysis.none") %>
- <%= Map.get(item, :existing_title) || translated("importAnalysis.none") %>
+ <%= Map.get(item, :wp_status) || dgettext("ui", "--") %>
+ <%= Map.get(item, :existing_title) || dgettext("ui", "--") %>
<% end %>
@@ -1214,11 +1211,11 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
- <%= translated("importAnalysis.status") %>
- <%= translated("importAnalysis.filename") %>
- <%= translated("importAnalysis.type") %>
- <%= translated("importAnalysis.path") %>
- <%= translated("importAnalysis.existingMatch") %>
+ <%= dgettext("ui", "Status") %>
+ <%= dgettext("ui", "Filename") %>
+ <%= dgettext("ui", "Type") %>
+ <%= dgettext("ui", "Path") %>
+ <%= dgettext("ui", "Existing Match") %>
@@ -1226,9 +1223,9 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= item.status %>
<%= Map.get(item, :filename) %>
- <%= Map.get(item, :mime_type) || translated("importAnalysis.none") %>
+ <%= Map.get(item, :mime_type) || dgettext("ui", "--") %>
<%= Map.get(item, :relative_path) %>
- <%= Map.get(item, :existing_title) || translated("importAnalysis.none") %>
+ <%= Map.get(item, :existing_title) || dgettext("ui", "--") %>
<% end %>
@@ -1248,10 +1245,10 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= @label %>
<%= total_stats(@stats) %>
- <%= if @stats.new_count > 0 do %><%= @stats.new_count %> <%= translated("importAnalysis.new") %> <% end %>
- <%= if @stats.update_count > 0 do %><%= @stats.update_count %> <%= translated("importAnalysis.update") %> <% end %>
- <%= if @stats.conflict_count > 0 do %><%= @stats.conflict_count %> <%= translated("importAnalysis.conflict") %> <% end %>
- <%= if @stats.duplicate_count > 0 do %><%= @stats.duplicate_count %> <%= translated("importAnalysis.duplicate") %> <% end %>
+ <%= if @stats.new_count > 0 do %><%= @stats.new_count %> <%= dgettext("ui", "new") %> <% end %>
+ <%= if @stats.update_count > 0 do %><%= @stats.update_count %> <%= dgettext("ui", "update") %> <% end %>
+ <%= if @stats.conflict_count > 0 do %><%= @stats.conflict_count %> <%= dgettext("ui", "conflict") %> <% end %>
+ <%= if @stats.duplicate_count > 0 do %><%= @stats.duplicate_count %> <%= dgettext("ui", "duplicate") %> <% end %>
"""
@@ -1285,11 +1282,11 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= @label %>
<%= total_media_stats(@stats) %>
- <%= if @stats.new_count > 0 do %><%= @stats.new_count %> <%= translated("importAnalysis.new") %> <% end %>
- <%= if @stats.update_count > 0 do %><%= @stats.update_count %> <%= translated("importAnalysis.update") %> <% end %>
- <%= if @stats.conflict_count > 0 do %><%= @stats.conflict_count %> <%= translated("importAnalysis.conflict") %> <% end %>
- <%= if @stats.duplicate_count > 0 do %><%= @stats.duplicate_count %> <%= translated("importAnalysis.duplicate") %> <% end %>
- <%= if @stats.missing_count > 0 do %><%= @stats.missing_count %> <%= translated("importAnalysis.missing") %> <% end %>
+ <%= if @stats.new_count > 0 do %><%= @stats.new_count %> <%= dgettext("ui", "new") %> <% end %>
+ <%= if @stats.update_count > 0 do %><%= @stats.update_count %> <%= dgettext("ui", "update") %> <% end %>
+ <%= if @stats.conflict_count > 0 do %><%= @stats.conflict_count %> <%= dgettext("ui", "conflict") %> <% end %>
+ <%= if @stats.duplicate_count > 0 do %><%= @stats.duplicate_count %> <%= dgettext("ui", "duplicate") %> <% end %>
+ <%= if @stats.missing_count > 0 do %><%= @stats.missing_count %> <%= dgettext("ui", "missing") %> <% end %>
"""
@@ -1305,9 +1302,9 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
<%= @label %>
<%= @stats.existing_count + @stats.mapped_count + @stats.new_count %>
- <%= if @stats.existing_count > 0 do %><%= @stats.existing_count %> <%= translated("importAnalysis.existing") %> <% end %>
- <%= if @stats.mapped_count > 0 do %><%= @stats.mapped_count %> <%= translated("importAnalysis.mapped") %> <% end %>
- <%= if @stats.new_count > 0 do %><%= @stats.new_count %> <%= translated("importAnalysis.new") %> <% end %>
+ <%= if @stats.existing_count > 0 do %><%= @stats.existing_count %> <%= dgettext("ui", "existing") %> <% end %>
+ <%= if @stats.mapped_count > 0 do %><%= @stats.mapped_count %> <%= dgettext("ui", "mapped") %> <% end %>
+ <%= if @stats.new_count > 0 do %><%= @stats.new_count %> <%= dgettext("ui", "new") %> <% end %>
"""
@@ -1342,14 +1339,14 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
type="text"
name="mapped_to"
value={Map.get(@edit || %{}, :value, Map.get(item, :mapped_to) || "") || ""}
- placeholder={translated("importAnalysis.mapToPlaceholder")}
+ placeholder={dgettext("ui", "Map to...")}
list={"taxonomy-suggestions-#{@type}"}
autocomplete="off"
/>
- ✓
- ×
+ ✓
+ ×
<%= if present?(item.mapped_to) do %>
- ×
+ ×
<% end %>
<% else %>
@@ -1380,7 +1377,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
phx-value-name={item.name}
phx-value-mapped_to={Map.get(item, :mapped_to) || ""}
><%= item.mapped_to %>
- ×
+ ×
<% end %>
<% end %>
@@ -1416,7 +1413,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
end
defp joined_or_none(values) when is_list(values) and values != [], do: Enum.join(values, ", ")
- defp joined_or_none(_values), do: translated("importAnalysis.none")
+ defp joined_or_none(_values), do: dgettext("ui", "--")
defp status_badge_class(status), do: ["status-badge", status]
@@ -1445,7 +1442,4 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do
defp maybe_put(map, _key, nil), do: map
defp maybe_put(map, key, value), do: Map.put(map, key, value)
-
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
end
diff --git a/lib/bds/desktop/shell_live/import_editor/analysis_state.ex b/lib/bds/desktop/shell_live/import_editor/analysis_state.ex
index e6e6574..c357eb8 100644
--- a/lib/bds/desktop/shell_live/import_editor/analysis_state.ex
+++ b/lib/bds/desktop/shell_live/import_editor/analysis_state.ex
@@ -2,7 +2,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
@moduledoc false
alias BDS.{ImportAnalysis, ImportDefinitions, Metadata}
- alias BDS.Desktop.{FilePicker, FolderPicker, ShellData}
+ alias BDS.Desktop.{FilePicker, FolderPicker}
+ use Gettext, backend: BDS.Gettext
@spec change_definition(term(), term(), term()) :: term()
def change_definition(socket, params, reload) do
@@ -18,7 +19,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
@spec select_uploads_folder(term(), term(), term()) :: term()
def select_uploads_folder(socket, reload, append_output) do
with %{id: definition_id} <- socket.assigns.current_tab do
- case FolderPicker.choose_directory(translated("importAnalysis.uploadsFolder")) do
+ case FolderPicker.choose_directory(dgettext("ui", "Uploads Folder")) do
{:ok, uploads_folder_path} ->
{:ok, _definition} =
ImportDefinitions.update_definition(definition_id, %{
@@ -32,7 +33,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
{:error, %{message: message}} ->
socket
- |> append_output.(translated("activity.import"), message, nil, "error")
+ |> append_output.(dgettext("ui", "Import"), message, nil, "error")
|> reload.(socket.assigns.workbench)
end
else
@@ -44,7 +45,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
def select_and_analyze(socket, reload, append_output) do
with %{id: definition_id} <- socket.assigns.current_tab,
%{} = definition <- ImportDefinitions.get_definition(definition_id) do
- case FilePicker.choose_file(translated("importAnalysis.wxrFile")) do
+ case FilePicker.choose_file(dgettext("ui", "WXR File")) do
{:ok, wxr_file_path} ->
project_id = socket.assigns.projects.active_project_id
@@ -78,7 +79,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
:import_editor_analysis_states,
Map.put(socket.assigns.import_editor_analysis_states, definition_id, %{
loading: true,
- step: translated("importAnalysis.analyzingWxr"),
+ step: dgettext("ui", "Analyzing WXR file..."),
detail: Path.basename(wxr_file_path),
file_path: wxr_file_path,
ref: task.ref
@@ -99,7 +100,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
{:error, %{message: message}} ->
socket
- |> append_output.(translated("activity.import"), message, nil, "error")
+ |> append_output.(dgettext("ui", "Import"), message, nil, "error")
|> reload.(socket.assigns.workbench)
end
else
@@ -167,18 +168,18 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
{:error, reason} ->
socket
- |> append_output.(translated("activity.import"), inspect(reason), nil, "error")
+ |> append_output.(dgettext("ui", "Import"), inspect(reason), nil, "error")
|> reload.(socket.assigns.workbench)
end
{:error, %{message: message}} ->
socket
- |> append_output.(translated("activity.import"), message, nil, "error")
+ |> append_output.(dgettext("ui", "Import"), message, nil, "error")
|> reload.(socket.assigns.workbench)
{:error, reason} ->
socket
- |> append_output.(translated("activity.import"), inspect(reason), nil, "error")
+ |> append_output.(dgettext("ui", "Import"), inspect(reason), nil, "error")
|> reload.(socket.assigns.workbench)
end
end
@@ -200,7 +201,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
:import_editor_analysis_states,
Map.delete(socket.assigns.import_editor_analysis_states, definition_id)
)
- |> append_output.(translated("activity.import"), message, nil, "error")
+ |> append_output.(dgettext("ui", "Import"), message, nil, "error")
|> reload.(socket.assigns.workbench)
end
end
@@ -294,12 +295,12 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
def translate_phase(step) when is_binary(step) do
case step do
- "parsing" -> translated("importAnalysis.analysisPhase.parsing")
- "scanning" -> translated("importAnalysis.analysisPhase.scanning")
- "taxonomies" -> translated("importAnalysis.analysisPhase.taxonomies")
- "posts" -> translated("importAnalysis.analysisPhase.posts")
- "media" -> translated("importAnalysis.analysisPhase.media")
- "complete" -> translated("importAnalysis.analysisPhase.complete")
+ "parsing" -> dgettext("ui", "Parsing WXR file...")
+ "scanning" -> dgettext("ui", "Scanning entries...")
+ "taxonomies" -> dgettext("ui", "Analyzing taxonomies...")
+ "posts" -> dgettext("ui", "Analyzing posts...")
+ "media" -> dgettext("ui", "Analyzing media...")
+ "complete" -> dgettext("ui", "Analysis complete")
other -> other
end
end
@@ -307,8 +308,5 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do
@spec translate_phase(term()) :: term()
def translate_phase(other), do: other
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
-
defp present?(value), do: value not in [nil, ""]
end
diff --git a/lib/bds/desktop/shell_live/import_editor/progress_tracking.ex b/lib/bds/desktop/shell_live/import_editor/progress_tracking.ex
index 6f9d739..fe0afc2 100644
--- a/lib/bds/desktop/shell_live/import_editor/progress_tracking.ex
+++ b/lib/bds/desktop/shell_live/import_editor/progress_tracking.ex
@@ -2,8 +2,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.ProgressTracking do
@moduledoc false
alias BDS.{ImportDefinitions, ImportExecution}
- alias BDS.Desktop.ShellData
alias BDS.Desktop.ShellLive.ImportEditor.AnalysisState
+ use Gettext, backend: BDS.Gettext
@spec execute_import(term(), term(), term()) :: term()
def execute_import(socket, reload, _append_output) do
@@ -129,8 +129,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.ProgressTracking do
})
)
|> append_output.(
- translated("activity.import"),
- translated("importAnalysis.importComplete", %{count: previous_state.count}),
+ dgettext("ui", "Import"),
+ dgettext("ui", "Import completed successfully!", count: previous_state.count),
nil,
"info"
)
@@ -148,7 +148,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.ProgressTracking do
ref: nil
})
)
- |> append_output.(translated("activity.import"), message, nil, "error")
+ |> append_output.(dgettext("ui", "Import"), message, nil, "error")
|> reload.(socket.assigns.workbench)
{:error, reason} ->
@@ -165,7 +165,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.ProgressTracking do
ref: nil
})
)
- |> append_output.(translated("activity.import"), message, nil, "error")
+ |> append_output.(dgettext("ui", "Import"), message, nil, "error")
|> reload.(socket.assigns.workbench)
end
end
@@ -208,7 +208,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.ProgressTracking do
ref: nil
})
)
- |> append_output.(translated("activity.import"), message, nil, "error")
+ |> append_output.(dgettext("ui", "Import"), message, nil, "error")
|> reload.(socket.assigns.workbench)
end
end
@@ -265,16 +265,16 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.ProgressTracking do
seconds = div(ms, 1000)
if seconds < 60 do
- translated("importAnalysis.eta", %{
- value: translated("importAnalysis.etaSeconds", %{count: seconds})
- })
+ dgettext("ui", "ETA: %{value}",
+ value: dgettext("ui", "%{count}s", count: seconds)
+ )
else
m = div(seconds, 60)
s = rem(seconds, 60)
- translated("importAnalysis.eta", %{
- value: translated("importAnalysis.etaMinutes", %{minutes: m, seconds: s})
- })
+ dgettext("ui", "ETA: %{value}",
+ value: dgettext("ui", "%{minutes}m %{seconds}s", minutes: m, seconds: s)
+ )
end
end
@@ -282,18 +282,15 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.ProgressTracking do
def translate_execution_phase(phase) when is_binary(phase) do
case phase do
- "tags" -> translated("importAnalysis.phase.tags")
- "posts" -> translated("importAnalysis.phase.posts")
- "media" -> translated("importAnalysis.phase.media")
- "pages" -> translated("importAnalysis.phase.pages")
- "complete" -> translated("importAnalysis.phase.complete")
+ "tags" -> dgettext("ui", "Importing tags & categories...")
+ "posts" -> dgettext("ui", "Importing posts...")
+ "media" -> dgettext("ui", "Importing media...")
+ "pages" -> dgettext("ui", "Importing pages...")
+ "complete" -> dgettext("ui", "Import complete")
other -> other
end
end
@spec translate_execution_phase(term()) :: term()
def translate_execution_phase(other), do: other
-
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
end
diff --git a/lib/bds/desktop/shell_live/import_editor/taxonomy_editing.ex b/lib/bds/desktop/shell_live/import_editor/taxonomy_editing.ex
index 9032ca9..6461140 100644
--- a/lib/bds/desktop/shell_live/import_editor/taxonomy_editing.ex
+++ b/lib/bds/desktop/shell_live/import_editor/taxonomy_editing.ex
@@ -2,7 +2,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.TaxonomyEditing do
@moduledoc false
alias BDS.{AI, ImportDefinitions, Metadata, Tags}
- alias BDS.Desktop.ShellData
+ use Gettext, backend: BDS.Gettext
@spec start_taxonomy_edit(term(), term(), term()) :: term()
def start_taxonomy_edit(
@@ -85,12 +85,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.TaxonomyEditing do
socket.assigns.offline_mode ->
socket
|> append_output.(
- translated("activity.import"),
- ShellData.translate(
- "Automatic AI actions stay gated by airplane mode.",
- %{},
- socket.assigns.page_language
- ),
+ dgettext("ui", "Import"),
+ BDS.Gettext.lgettext(socket.assigns.page_language, "ui", "Automatic AI actions stay gated by airplane mode."),
nil,
"info"
)
@@ -124,8 +120,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.TaxonomyEditing do
socket
|> append_output.(
- translated("activity.import"),
- translated("importAnalysis.mappedCount", %{count: mapped_count}),
+ dgettext("ui", "Import"),
+ dgettext("ui", "%{count} mapped", count: mapped_count),
Map.get(socket.assigns.import_editor_selected_models, definition_id),
"info"
)
@@ -134,7 +130,7 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.TaxonomyEditing do
{:error, reason} ->
socket
|> append_output.(
- translated("activity.import"),
+ dgettext("ui", "Import"),
inspect(reason),
Map.get(socket.assigns.import_editor_selected_models, definition_id),
"error"
@@ -274,19 +270,16 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.TaxonomyEditing do
def taxonomy_mapping_tooltip(item) do
action =
if present?(item.mapped_to),
- do: translated("importAnalysis.mappingActionEdit"),
- else: translated("importAnalysis.mappingActionAdd")
+ do: dgettext("ui", "edit"),
+ else: dgettext("ui", "add")
- translated("importAnalysis.mappingTooltip", %{action: action})
+ dgettext("ui", "Click to %{action} mapping", action: action)
end
@spec maybe_put_option(term(), term(), term()) :: term()
def maybe_put_option(opts, _key, nil), do: opts
def maybe_put_option(opts, key, value), do: Keyword.put(opts, key, value)
- defp translated(text, bindings \\ %{}),
- do: ShellData.translate(text, bindings, BDS.Desktop.UILocale.current())
-
defp present?(value), do: value not in [nil, ""]
defp blank_to_nil(""), do: nil
defp blank_to_nil(value), do: value
diff --git a/lib/bds/desktop/shell_live/index.html.heex b/lib/bds/desktop/shell_live/index.html.heex
index 57a9adb..4ae23a1 100644
--- a/lib/bds/desktop/shell_live/index.html.heex
+++ b/lib/bds/desktop/shell_live/index.html.heex
@@ -77,8 +77,8 @@
data-testid="toggle-sidebar"
type="button"
phx-click="toggle_sidebar"
- aria-label={translated("Toggle sidebar")}
- title={translated("Toggle sidebar")}
+ aria-label={dgettext("ui", "Toggle sidebar")}
+ title={dgettext("ui", "Toggle sidebar")}
>