Files
sure/app/views/users/_user_menu.html.erb
Brendon Scheiber 0c126b1674 feat(i18n): extract hardcoded English strings to locale files (#1806)
* Extract hardcoded strings to i18n

Replace numerous hardcoded English strings with I18n lookups (t / I18n.t) across controllers, views, helpers, and components, and convert model validation error messages to symbol keys. Added multiple locale files under config/locales for models and views. This centralizes user-facing notices/alerts, UI text, import/validation messages, and prepares the app for localization and easier translation maintenance.

* Update en.yml

* Update preview-cleanup.yml

* Revert "Update preview-cleanup.yml"

This reverts commit 1ba6d3c34c.

* test: align i18n assertions with translated messages

* Standardize balance error key and tweak locales

Replace SophtronAccount's :requires_balance error key with :no_balance and update related locale strings for sophtron, plaid, and simplefin accounts to use the new key and clearer copy. Also switch the QIF upload redirect notice to use a relative translation key (t('.qif_uploaded')), remove an unused SSO providers help line, and fix a trailing-newline/whitespace issue in the subscriptions locale. These changes standardize validation keys and improve translation consistency and messaging.

---------

Co-authored-by: KiloClaw <kiloclaw@openclaw.ai>
2026-05-17 09:52:49 +02:00

64 lines
2.6 KiB
Plaintext

<%# locals: (user:, placement: "right-start", offset: 16, intro_mode: false) %>
<% intro_mode = local_assigns.fetch(:intro_mode, false) %>
<div data-testid="user-menu">
<%= render DS::Menu.new(
variant: "avatar",
avatar_url: user.profile_image&.variant(:small)&.url,
initials: user.initials,
placement: placement,
offset: offset
) do |menu| %>
<% if intro_mode %>
<% menu.with_button do %>
<%= render DS::Button.new(variant: "icon", icon: "settings", data: { DS__menu_target: "button" }) %>
<% end %>
<% end %>
<%= menu.with_header do %>
<div class="px-4 py-3 flex items-center gap-3">
<div class="w-9 h-9 shrink-0">
<%= render "settings/user_avatar", avatar_url: user.profile_image&.variant(:small)&.url, initials: user.initials, lazy: true %>
</div>
<div class="overflow-hidden text-ellipsis text-sm">
<p class="font-medium"><%= user.display_name %></p>
<% if user.display_name != user.email %>
<p class="text-secondary"><%= user.email %></p>
<% end %>
</div>
</div>
<% if self_hosted? %>
<div class="px-4 py-3 border-t border-tertiary">
<p class="text-sm">
<span class="font-medium text-primary"><%= t(".version") %>:</span>
<%= link_to Sure.version.to_release_tag, "https://github.com/we-promise/sure/releases/tag/#{Sure.version.to_release_tag}", target: "_blank", class: "hover:underline" %>
<% if Sure.commit_sha.present? %>
(<%= link_to Sure.commit_sha.first(7), "https://github.com/we-promise/sure/commit/#{Sure.commit_sha}", target: "_blank", class: "hover:underline" %>)
<% end %>
</p>
</div>
<% end %>
<% end %>
<% menu.with_item(
variant: "link",
text: t(".settings"),
icon: "settings",
href: intro_mode ? settings_profile_path : accounts_path(return_to: request.fullpath)
) %>
<% menu.with_item(variant: "link", text: t(".changelog"), icon: "box", href: changelog_path) %>
<% if self_hosted? && !intro_mode %>
<% menu.with_item(variant: "link", text: t(".feedback"), icon: "megaphone", href: feedback_path) %>
<% end %>
<% menu.with_item(variant: "link", text: t(".contact"), icon: "message-square-more", href: "https://discord.gg/36ZGBsxYEK", target: "_blank", rel: "noopener noreferrer") %>
<% menu.with_item(variant: "divider") %>
<% menu.with_item(variant: "button", text: t(".log_out"), icon: "log-out", href: session_path(Current.session), method: :delete) %>
<% end %>
</div>