Files
sure/app/views/settings/api_keys/created.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

88 lines
3.7 KiB
Plaintext

<%= content_for :page_title, t(".page_title") %>
<%= settings_section title: t(".success_title"), subtitle: t(".success_description") do %>
<div class="space-y-4">
<div class="p-3 shadow-border-xs bg-container rounded-lg">
<div class="flex items-start gap-3">
<%= render DS::FilledIcon.new(
icon: "check-circle",
rounded: true,
size: "lg",
variant: :success
) %>
<div class="flex-1">
<h3 class="font-medium text-primary"><%= t(".success_title") %></h3>
<p class="text-secondary text-sm mt-1"><%= t(".key_ready", name: @api_key.name) %></p>
</div>
</div>
</div>
<div class="bg-surface-inset rounded-xl p-4">
<h4 class="font-medium text-primary mb-3"><%= t(".your_api_key") %></h4>
<p class="text-secondary text-sm mb-3"><%= t(".copy_store_securely") %></p>
<div class="bg-container rounded-lg p-3 border border-primary" data-controller="clipboard">
<div class="flex items-center justify-between gap-3">
<code id="api-key-display" class="font-mono text-sm text-primary break-all" data-clipboard-target="source"><%= @api_key.plain_key %></code>
<%= render DS::Button.new(
text: t(".copy_key"),
variant: "ghost",
icon: "copy",
data: { action: "clipboard#copy" }
) %>
</div>
</div>
</div>
<div class="bg-surface-inset rounded-xl p-4">
<h4 class="font-medium text-primary mb-3"><%= t(".key_details_title") %></h4>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-secondary"><%= t(".key_name_label") %></span>
<span class="text-primary font-medium"><%= @api_key.name %></span>
</div>
<div class="flex justify-between">
<span class="text-secondary"><%= t(".permissions_label") %></span>
<span class="text-primary">
<%= @api_key.scopes.map { |scope|
case scope
when "read_accounts" then t("settings.api_keys_controller.scope_descriptions.read_accounts")
when "read_transactions" then t("settings.api_keys_controller.scope_descriptions.read_transactions")
when "read_balances" then t("settings.api_keys_controller.scope_descriptions.read_balances")
when "write_transactions" then t("settings.api_keys_controller.scope_descriptions.write_transactions")
else scope.humanize
end
}.join(", ") %>
</span>
</div>
<div class="flex justify-between">
<span class="text-secondary"><%= t(".created_label") %></span>
<span class="text-primary"><%= @api_key.created_at.strftime("%B %d, %Y at %I:%M %p") %></span>
</div>
</div>
</div>
<%= render DS::Alert.new(title: t(".security_note_title"), variant: :warning) do %>
<p>
<%= t(".security_note_body") %>
</p>
<% end %>
<div class="bg-surface-inset rounded-xl p-4">
<h4 class="font-medium text-primary mb-3"><%= t(".usage_instructions_title") %></h4>
<p class="text-secondary text-sm mb-3"><%= t("settings.api_keys.show.current_api_key.usage_instructions", product_name: product_name) %></p>
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary">
curl -H "X-Api-Key: <%= @api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
</div>
</div>
<div class="flex justify-end pt-4 border-t border-primary">
<%= render DS::Link.new(
text: t(".continue"),
href: settings_api_key_path,
variant: "primary"
) %>
</div>
</div>
<% end %>