Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cuddly-pants-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openproject/primer-view-components": patch
---

[62820] Primer Alpha::ToggleSwitch locale support, set default values for On and Off labels
4 changes: 2 additions & 2 deletions app/components/primer/alpha/toggle_switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def initialize(

@system_arguments[:src] = @src if @src

@on_label = on_label || "On"
@off_label = off_label || "Off"
@on_label = on_label || I18n.t("label_switch_on")
@off_label = off_label || I18n.t("label_switch_off")
end

def on?
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ en:
label_title: "Title"
label_loading: "Loading..."
label_more: "More"
label_switch_on: "On"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer the custom component specific labels to follow the structure we have for the danger dialog with the component name as the first key. So

toggle_switch:
  label_on: "On"
  label_off: "Off"

label_switch_off: "Off"

danger_dialog:
confirmation_live_message_checked: "The button to proceed is now active."
Expand Down
Loading