mirror of
https://github.com/discourse/discourse.git
synced 2026-08-07 13:19:19 +08:00
The /about page (unlike /guidelines or /tos) is not backed by a topic, but instead via a bunch of site settings. If it were backed by a topic, localization would be easy as it can just use TopicLocalizations. We also can't swap it out to use a topic, since there are so many fields on the about page that can't be safely contained in a topic. ---------- This PR adds SiteSettingLocalization, allowing new attributes in site settings config for localization. For now this is wired into the About page settings flow: - admins can select a non-default locale on /admin/config/about - only translatable About fields are shown for that locale - localized About values are used on /about and /about.json - company_url can be set manually per locale, but is excluded from automatic translation - ~~AI backfill can translate eligible site setting localizations~~ no backfill (added in https://github.com/discourse/discourse/pull/41123/commits/386c655d2f44aca54440c069bd06ea8007793d84, removed in https://github.com/discourse/discourse/pull/41123/commits/6f8ec9cc43dca4195bda638b1ce980eb68a59941. about page has very non automa-ble fields This intentionally keeps the scope narrow. It does not make every site setting localizable, and any other setting can be localized by adding to that allowlist. Some screenshots |page | 📸 | |--|--| | eng setting | <img width="1278" height="871" alt="Screenshot 2026-06-23 at 11 00 34 PM" src="https://github.com/user-attachments/assets/59431464-fb05-41d9-8c4f-fd9aae7fb45f" /> | ja setting | <img width="1278" height="871" alt="Screenshot 2026-06-23 at 11 01 20 PM" src="https://github.com/user-attachments/assets/73cd2878-f59a-4dc4-a76d-2f46b74a6eed" /> | ja anon about page | <img width="1278" height="871" alt="Screenshot 2026-06-23 at 11 01 48 PM" src="https://github.com/user-attachments/assets/02464a5f-9ca0-4519-9521-be41498c1967" />
110 lines
3 KiB
Ruby
Vendored
110 lines
3 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class About < PageObjects::Pages::Base
|
|
def visit(locale: nil)
|
|
path = "/about"
|
|
path += "?#{Discourse::LOCALE_PARAM}=#{locale}" if locale
|
|
page.visit(path)
|
|
end
|
|
|
|
def has_header_title?(title)
|
|
has_css?(".about__header h1", text: title)
|
|
end
|
|
|
|
def has_short_description?(content)
|
|
has_css?(".about__header .short-description", text: content)
|
|
end
|
|
|
|
def has_extended_description?(content)
|
|
has_css?(".about__left-side", text: content)
|
|
end
|
|
|
|
def has_banner_image?(upload)
|
|
has_css?("img.about__banner-img[src=\"#{GlobalPath.full_cdn_url(upload.url)}\"]")
|
|
end
|
|
|
|
def has_no_banner_image?
|
|
has_no_css?("img.about__banner-img")
|
|
end
|
|
|
|
def has_members_count?(count, formatted_number)
|
|
element = find(".about__stats-item.members span")
|
|
element.has_text?(I18n.t("js.about.member_count", count:, formatted_number:))
|
|
end
|
|
|
|
def has_admins_count?(count, formatted_number)
|
|
element = find(".about__stats-item.admins span")
|
|
element.has_text?(I18n.t("js.about.admin_count", count:, formatted_number:))
|
|
end
|
|
|
|
def has_moderators_count?(count, formatted_number)
|
|
element = find(".about__stats-item.moderators span")
|
|
element.has_text?(I18n.t("js.about.moderator_count", count:, formatted_number:))
|
|
end
|
|
|
|
def has_group_with_name?(name)
|
|
has_css?(".about__#{name.downcase} h3", text: name)
|
|
end
|
|
|
|
def has_no_group_with_name?(name)
|
|
has_no_css?(".about__#{name.downcase} h3", text: name)
|
|
end
|
|
|
|
def has_no_extra_groups?
|
|
has_no_css?("--custom-group")
|
|
end
|
|
|
|
def has_site_created_less_than_1_month_ago?
|
|
site_age_stat_element.has_text?(I18n.t("js.about.site_age.less_than_one_month"))
|
|
end
|
|
|
|
def has_site_created_in_months_ago?(months)
|
|
site_age_stat_element.has_text?(I18n.t("js.about.site_age.month", count: months))
|
|
end
|
|
|
|
def has_site_created_in_years_ago?(years)
|
|
site_age_stat_element.has_text?(I18n.t("js.about.site_age.year", count: years))
|
|
end
|
|
|
|
def edit_link
|
|
find(".edit-about-page")
|
|
end
|
|
|
|
def has_edit_link?
|
|
has_css?(".edit-about-page")
|
|
end
|
|
|
|
def has_no_edit_link?
|
|
has_no_css?(".edit-about-page")
|
|
end
|
|
|
|
def has_traffic_info_footer?
|
|
has_css?(".traffic-info-footer")
|
|
end
|
|
|
|
def has_no_traffic_info_footer?
|
|
has_no_css?(".traffic-info-footer")
|
|
end
|
|
|
|
def site_activities
|
|
PageObjects::Components::AboutPageSiteActivity.new(find(".about__activities"))
|
|
end
|
|
|
|
def admins_list
|
|
PageObjects::Components::AboutPageUsersList.new(find(".about__admins"))
|
|
end
|
|
|
|
def moderators_list
|
|
PageObjects::Components::AboutPageUsersList.new(find(".about__moderators"))
|
|
end
|
|
|
|
private
|
|
|
|
def site_age_stat_element
|
|
find(".about__stats-item.site-creation-date span")
|
|
end
|
|
end
|
|
end
|
|
end
|