diff --git a/.changeset/cuddly-pants-rule.md b/.changeset/cuddly-pants-rule.md new file mode 100644 index 0000000000..f8205a27ec --- /dev/null +++ b/.changeset/cuddly-pants-rule.md @@ -0,0 +1,5 @@ +--- +"@openproject/primer-view-components": patch +--- + +[62820] Primer Alpha::ToggleSwitch locale support, set default values for On and Off labels diff --git a/app/components/primer/alpha/toggle_switch.rb b/app/components/primer/alpha/toggle_switch.rb index a1971a4463..96fd419a12 100644 --- a/app/components/primer/alpha/toggle_switch.rb +++ b/app/components/primer/alpha/toggle_switch.rb @@ -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("toggle_switch.label_on") + @off_label = off_label || I18n.t("toggle_switch.label_off") end def on? diff --git a/config/locales/en.yml b/config/locales/en.yml index b6801c19bf..5ab9a1fa97 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -15,6 +15,10 @@ en: include_sub_items: "Include sub-items" no_results_text: "No results" + toggle_switch: + label_on: "On" + label_off: "Off" + label_title: "Title" label_loading: "Loading..." label_more: "More"