0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-14 13:58:53 +08:00
discourse/spec/system/page_objects/pages/admin_about_config_area.rb
Natalie Tay af11f8992c
FEATURE: Localizable /about page fields via its settings page (#41123)
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"
/>
2026-06-26 20:41:08 +08:00

60 lines
1.7 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class AdminAboutConfigArea < PageObjects::Pages::Base
def visit
page.visit("/admin/config/about")
end
def select_locale(locale)
find(
".admin-config-area-about__locale-selector-dropdown option[value='#{locale}']",
).select_option
end
def general_settings_section
PageObjects::Components::AdminAboutConfigAreaGeneralSettingsCard.new
end
def contact_information_section
PageObjects::Components::AdminAboutConfigAreaContactInformationCard.new
end
def your_organization_section
PageObjects::Components::AdminAboutConfigAreaYourOrganizationCard.new
end
def group_listing_section
PageObjects::Components::AdminAboutConfigAreaGroupListingCard.new
end
def has_no_group_listing_section?
has_no_css?(".admin-config-area-about__extra-groups-section")
end
def has_no_contact_information_section?
has_no_css?(".admin-config-area-about__contact-information-section")
end
def has_no_your_organization_section?
has_no_css?(".admin-config-area-about__your-organization-section")
end
def has_language_toolbar?
has_css?(".admin-config-area__primary-content > .admin-config-area-about__language-toolbar")
end
def has_no_language_toolbar?
has_no_css?(".admin-config-area-about__language-toolbar")
end
def has_locale_description?
has_css?(
".admin-config-area-about__locale-selector .form-kit__container-help-text",
text: "Only translatable About page fields are shown.",
)
end
end
end
end