Skip to content

Commit 7a7310d

Browse files
committed
Reference translations so posts load normally
1 parent 024fc67 commit 7a7310d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/discourse_translator/topic_view_serializer_extension.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ def posts
1010
# we will only load them if the user is using a different language that is supported by the site.
1111
if SiteSetting.experimental_inline_translation && !LocaleMatcher.user_locale_is_default? &&
1212
LocaleMatcher.user_locale_in_target_languages?
13+
locale = InlineTranslation.effective_locale.to_s.gsub("_", "-")
1314
posts_query =
14-
posts_query.includes(:translations).where(
15-
translations: {
16-
locale: InlineTranslation.effective_locale.to_s.gsub("_", "-"),
17-
},
18-
)
15+
posts_query
16+
.includes(:translations)
17+
.references(:translations)
18+
.where(translations: { locale: [nil, locale] })
1919
end
2020
object.instance_variable_set(:@posts, posts_query)
2121
end

0 commit comments

Comments
 (0)