Skip to content

A platform for community discussion. Free, open, simple.

FIX: Update i18n key for toggle localization button (#34405)

Natalie Taye74772e79d33
diff --git a/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs b/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs
index 5de9d0b1000..c0a8180cf53 100644
--- a/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs
@@ -35,8 +35,8 @@ export default class TopicLocalizedContentToggle extends Component {
get title() {
return this.showingOriginal
- ? "translator.content_not_translated"
- : "translator.content_translated";
+ ? "content_localization.toggle_localized.not_translated"
+ : "content_localization.toggle_localized.translated";
}
<template>
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index ab204c90dc6..332421fbc67 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -5580,6 +5580,10 @@ en:
default: "%{filter} topics in %{category} without tags"
categories: "All categories"
+ content_localization:
+ toggle_localized:
+ translated: "Page is machine-translated. Click to view original."
+ not_translated: "Page is not translated. Click to translate."
# This section is exported to the javascript for i18n in the admin section
admin_js:
diff --git a/spec/system/content_localization_spec.rb b/spec/system/content_localization_spec.rb
index 7efc1d42ebe..cd79e2999bd 100644
--- a/spec/system/content_localization_spec.rb
+++ b/spec/system/content_localization_spec.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
describe "Content Localization" do
+ TOGGLE_LOCALIZE_BUTTON_SELECTOR = "button.btn-toggle-localized-content"
+
fab!(:japanese_user) { Fabricate(:user, locale: "ja") }
fab!(:site_local_user) { Fabricate(:user, locale: "en") }
fab!(:admin)
@@ -68,9 +70,16 @@ describe "Content Localization" do
topic_list.visit_topic_with_title("孫子兵法からの人生戦略")
expect(topic_page.has_topic_title?("孫子兵法からの人生戦略")).to eq(true)
- page.find("button.btn-toggle-localized-content").click
+
+ expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
+ I18n.t("js.content_localization.toggle_localized.translated"),
+ )
+ page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR).click
expect(topic_page.has_topic_title?("Life strategies from The Art of War")).to eq(true)
+ expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
+ I18n.t("js.content_localization.toggle_localized.not_translated"),
+ )
visit("/")
topic_list.visit_topic_with_title("Life strategies from The Art of War")