Skip to content

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

UX: Keep navigational items like tags and categories translated (#39030)

Natalie Tay5df8bb137ff5
diff --git a/lib/content_localization.rb b/lib/content_localization.rb
index 9ce2a036761..b606c4f226f 100644
--- a/lib/content_localization.rb
+++ b/lib/content_localization.rb
@@ -33,7 +33,7 @@ class ContentLocalization
# @return [Boolean]
def self.show_translated_category?(category, scope)
SiteSetting.content_localization_enabled && category.locale.present? &&
- !category.in_user_locale? && !show_original?(scope)
+ !category.in_user_locale?
end
# This method returns true when we should try to show the translated tag.
@@ -41,7 +41,6 @@ class ContentLocalization
# @param scope [Object] The serializer scope from which the method is called
# @return [Boolean]
def self.show_translated_tag?(tag, scope)
- SiteSetting.content_localization_enabled && tag.locale.present? && !tag.in_user_locale? &&
- !show_original?(scope)
+ SiteSetting.content_localization_enabled && tag.locale.present? && !tag.in_user_locale?
end
end
diff --git a/spec/lib/content_localization_spec.rb b/spec/lib/content_localization_spec.rb
index 3f9a867ef8a..ee05f0c488d 100644
--- a/spec/lib/content_localization_spec.rb
+++ b/spec/lib/content_localization_spec.rb
@@ -144,15 +144,6 @@ describe ContentLocalization do
expect(ContentLocalization.show_translated_category?(category, scope)).to be true
end
- it "returns false when category locale does not match user locale but cookie set to show original" do
- SiteSetting.content_localization_enabled = true
- category.update!(locale: "ja")
- I18n.locale = "de"
- scope = create_scope(cookie: ContentLocalization::SHOW_ORIGINAL_COOKIE)
-
- expect(ContentLocalization.show_translated_category?(category, scope)).to be false
- end
-
it "returns false when category locale is nil" do
SiteSetting.content_localization_enabled = true
category.update!(locale: nil)
@@ -202,12 +193,6 @@ describe ContentLocalization do
expect(ContentLocalization.show_translated_tag?(tag, scope)).to be false
end
-
- it "returns false when show_original? is true" do
- scope = create_scope(cookie: ContentLocalization::SHOW_ORIGINAL_COOKIE)
-
- expect(ContentLocalization.show_translated_tag?(tag, scope)).to be false
- end
end
end
end