mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-09 04:41:30 +08:00
Related: - https://github.com/discourse/discourse-translator/pull/205 - https://github.com/discourse/discourse-translator/pull/274 - https://github.com/discourse/discourse-translator/pull/294 With this PR, we will start showing localized posts (if available) based on the user's locale. This work had been done in discourse-translator, but is now moving to core.
16 lines
425 B
Ruby
16 lines
425 B
Ruby
# frozen_string_literal: true
|
|
|
|
# The most basic attributes of a topic that we need to create a link for it.
|
|
class BasicTopicSerializer < ApplicationSerializer
|
|
attributes :id, :title, :fancy_title, :slug, :posts_count
|
|
|
|
def fancy_title
|
|
f = object.fancy_title
|
|
|
|
if (ContentLocalization.show_translated_topic?(object, scope))
|
|
object.get_localization&.fancy_title.presence || f
|
|
else
|
|
f
|
|
end
|
|
end
|
|
end
|