discourse/lib/site_settings
Natalie Tay 235c673fe8
FEATURE: Localize language names (#33790)
This PR adds localized language names to settings. The language names
are localized in the frontend, not the backend, due to setting
initialization complexity.

This change affects these areas:
- `SiteSetting.available_locales` 
- this "setting" is a lookup table to get language names. use
`languageNameLookup` service to get the name for a locale
- it returns an object that looks like the following, then gets
re-hydrated with client localized values when initializing the
`siteSettingService` in the frontend.
  ```
  [
{"native_name":"اللغة العربية","value":"ar","name":"languages.ar.name"},
    ...
  ]  
  ```

- `SiteSetting.default_locale` 
- this is a single-value `enum` setting that has always been hardcoded.
This caused quite an issue as it is not initialized the same way as
other site settings in the yml file. It has always relied on reading
directly from a `names.yml` file to load native language names, thus
bypassing the need for I18n to be initialized from the backend. A new
locale_enum type has been introduced for this setting, and any future
settings.
  
- `SiteSetting.content_localization_supported_locales` - this is a
`enum_list` setting,
  - enum_list is introduced, leveraging both `list` and `enum`
  
- theme translations

- site texts

- Wizard's default_locale choices 
- it was set up from the backend using `LocaleSiteSetting.value`. This
proved problematic, as a Japanese user would be getting the locales in
English because the values are initialized using English even without
memoization
- therefore we're now initializing the choices in the frontend using
`available_locales` as defined above
  
- content localization meta data
- post language in the composer, localization composer, post history
modal, post language tooltip, language switcher



/t/151409
2025-07-29 11:48:45 +08:00
..
db_provider.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
defaults_provider.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
deprecated_settings.rb FEATURE: Themeable site settings (#32233) 2025-07-16 11:00:21 +10:00
hidden_provider.rb DEV: support un-hiding site settings programmatically (#32824) 2025-05-20 21:44:56 +02:00
label_formatter.rb DEV: Add "UI" as a humanizable acronym (#33322) 2025-06-24 15:42:35 +10:00
local_process_provider.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
type_supervisor.rb FEATURE: Localize language names (#33790) 2025-07-29 11:48:45 +08:00
validations.rb DEV: Add setting to tag s3 objects enabling tag based access control policies (#32988) 2025-06-16 13:26:18 +08:00
yaml_loader.rb DEV: Remove older ruby version logic (#19971) 2023-01-24 10:42:56 +00:00