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

54 lines
1.9 KiB
Plaintext

<%= content_for :page_title, t(".create_new_api_key") %>
<%= settings_section title: nil, subtitle: t(".subtitle") do %>
<%= styled_form_with model: @api_key, url: settings_api_key_path, class: "space-y-4" do |form| %>
<%= form.text_field :name,
placeholder: t(".name_placeholder"),
label: t(".name_label"),
help_text: t(".name_help_text") %>
<div>
<%= form.label :scopes, t(".permissions_label"), class: "block text-sm font-medium text-primary mb-2" %>
<p class="text-sm text-secondary mb-3"><%= t(".permissions_help") %></p>
<div class="space-y-2">
<% [
["read", t(".scope_read_only"), t(".scope_read_only_description")],
["read_write", t(".scope_read_write"), t(".scope_read_write_description")]
].each do |value, label, description| %>
<div class="bg-surface-inset rounded-lg p-3 border border-primary">
<label class="flex items-start gap-3 cursor-pointer">
<%= radio_button_tag "api_key[scopes]", value, (@api_key&.scopes || []).include?(value),
class: "mt-1" %>
<div class="flex-1">
<div class="font-medium text-primary"><%= label %></div>
<div class="text-sm text-secondary mt-1"><%= description %></div>
</div>
</label>
</div>
<% end %>
</div>
</div>
<%= render DS::Alert.new(title: t(".security_warning_title"), variant: :warning) do %>
<p>
<%= t(".security_warning_body") %>
</p>
<% end %>
<div class="flex justify-end gap-3 pt-4 border-t border-primary">
<%= render DS::Link.new(
text: t(".cancel"),
href: settings_api_key_path,
variant: "ghost"
) %>
<%= render DS::Button.new(
text: t(".save_api_key"),
variant: "primary",
type: "submit"
) %>
</div>
<% end %>
<% end %>