Expected behavior when "Content languages" is unset

I’m curious to understand the expected behavior in the case when a user has not chosen a content language (in their Preferences > Interface > Content languages setting). I ask because the behavior that I am seeing is that when I do not have a content language chosen, my Discourse instance (with Multilingual installed and the multilingual content languages topic filtering enabled setting at true) does not include topics that do not have a language tag in the list of latest topics. If I give such a topic any language tag, then it shows up in the list of latest topics for the category. I find this confusing: I would expect that without any content language chosen, then (all else being equal) I would see all topics.

Also, it looks like the order of operations on this filtering is particularly confusing. It seems that the logic is something like: request a list of n topics from Discourse, then filter those topics according to content language filtering logic. But that could lead to an empty list of latest topics, when there are in fact latest topics to show that would meet the content language criteria.

If this is a bug, I’m happy to resubmit this information in the form of a bug report, but I thought I would start with a less formal conversation about this.

This is somewhat related: would it make sense to have a setting (maybe call it consider topics with no language tag to have this language tag) that would impose the idea of a default language tag that would apply to topics without a language tag set? I could also submit this as a feature request if others think this is a good idea.

2 Likes

This is indeed a known functional issue. It’s not a bug, the plugin was just designed with a different goal in mind. I’ve looked into this before and if I remember correctly this would be quite easy to change, so I’m tagging this with feature-request and as soon as this plugin is getting some TLC we’re going to consider building it.

1 Like

I’ve actually had a goal for a little while now of getting involved in Discourse and Pavilion plugin development, and I could imagine working on this enhancement if someone still had some mentoring energy available for me.

2 Likes

I would absolutely welcome that! :+1:

I will start by sharing my notes, it’s this line that determines what happens

      if content_languages.present? && content_languages.any?
        result = result.joins(:tags).where("tags.name in (?)", content_languages)
      end

I can imagine that changing that middle line into something like

result = result.left_joins(:tags).where("(tags.name not in (?) OR tags.name IS NULL)", Multilingual::ContentTag.all - content_languages)

would do the job.

Of course this should be behind some kind of setting like ‘always show topics without a language tag’

1 Like

Yeah, I was guessing it was an implementation resembling the code you’ve shown. I’d have to do some work to get up to speed on the whole development workflow around Discourse plugins, including its testing framework, and that’s where I could really benefit from some mentoring.

1 Like

Every PR is welcome and we’re here to help you getting there!

2 Likes

We’d love to support you in this. You might like to apply to join as a Pavilion Member - either a reserve member, a quarter member, or a full member. More details here:

1 Like