discourse/app/models/concerns/locale_matchable.rb
Natalie Tay f4e08421ae
DEV: Use localizable concerns across post, topic, categories (#34137)
This is the first in the series and helps prepare us for crawler_view.
Existing tests should cover the use of these concerns.

/t/160415
2025-08-07 22:12:01 +08:00

13 lines
298 B
Ruby
Vendored

# frozen_string_literal: true
module LocaleMatchable
extend ActiveSupport::Concern
included do
scope :matching_locale,
->(locale) do
regionless_locale = locale.to_s.split("_").first
where("locale LIKE ?", "#{regionless_locale}%")
end
end
end