Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 4 additions & 0 deletions config/locales/client.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 10 additions & 1 deletion spec/system/content_localization_spec.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -68,9 +70,16 @@
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")
Expand Down
Loading