Skip to content

Commit 9dcca43

Browse files
committed
pass translation of on and off as the default label of toggle switch
1 parent cadfc87 commit 9dcca43

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/components/primer/alpha/toggle_switch.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def initialize(
8484

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

87-
@on_label = on_label || "On"
88-
@off_label = off_label || "Off"
87+
@on_label = on_label || I18n.t("label_switch_on")
88+
@off_label = off_label || I18n.t("label_switch_off")
8989
end
9090

9191
def on?

config/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ en:
1818
label_title: "Title"
1919
label_loading: "Loading..."
2020
label_more: "More"
21+
label_switch_on: "On"
22+
label_switch_off: "Off"
2123

2224
danger_dialog:
2325
confirmation_live_message_checked: "The button to proceed is now active."

0 commit comments

Comments
 (0)