discourse/spec/serializers
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
..
concerns UX: Split hide_profile_and_presence user option (#29632) 2024-11-12 22:22:58 -03:00
about_serializer_spec.rb DEV: More targeted cleanup in plugin registry specs (#31333) 2025-02-14 10:28:29 -05:00
admin_detailed_user_serializer_spec.rb FIX: Admin can edit the name even if enable_names is disabled (#33170) 2025-06-16 09:24:17 +08:00
admin_plugin_serializer_spec.rb FIX: Plugin JS failing to load would break admin interface (#29139) 2024-10-11 09:26:10 +10:00
admin_user_action_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
admin_user_list_serializer_spec.rb FEATURE: Add bulk destroy to admin users list (#29744) 2024-11-25 11:13:35 +03:00
basic_group_serializer_spec.rb DEV: Remove full group refreshes from tests (#25414) 2024-01-25 14:28:26 +08:00
basic_group_user_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
basic_post_serializer_spec.rb DEV: Remove 'experimental' prefix from settings (#33233) 2025-06-19 12:23:42 +08:00
basic_reviewable_flagged_post_serializer_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
basic_reviewable_queued_post_serializer_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
basic_reviewable_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
basic_reviewable_user_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
basic_topic_serializer_spec.rb DEV: Remove 'experimental' prefix from settings (#33233) 2025-06-19 12:23:42 +08:00
basic_user_serializer_spec.rb DEV: Update rubocop-discourse to latest version 2024-03-04 15:08:35 +01:00
category_detailed_serializer_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
category_serializer_spec.rb FEATURE: Support designating multiple groups as mods on category (#28655) 2024-09-04 04:38:46 +03:00
category_upload_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
component_index_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
current_user_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
detailed_user_badge_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
directory_item_serializer_spec.rb FEATURE: Add links to searchable user fields in users directory and user profile (#29338) 2024-11-06 13:35:30 -04:00
emoji_serializer_spec.rb FEATURE - Add username column to custom emoji table (#29522) 2024-11-01 10:32:59 -05:00
flag_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
found_user_serializer_spec.rb DEV: Update rubocop-discourse to latest version 2024-03-04 15:08:35 +01:00
group_show_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
group_user_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
group_user_with_custom_fields_serializer_spec.rb FEATURE: Hide user status when user is hiding public profile and presence (#24300) 2024-02-26 17:40:48 +04:00
invite_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
listable_topic_serializer_spec.rb DEV: Remove 'experimental' prefix from settings (#33233) 2025-06-19 12:23:42 +08:00
new_post_result_serializer_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
notification_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
pending_post_serializer_spec.rb FIX: Attribute pending post to author in PendingPostSerialier (#23369) 2023-09-03 22:14:51 +00:00
post_action_type_serializer_spec.rb FIX: Return properly interpolated translations for flag types 2024-07-30 18:30:57 +02:00
post_localization_serializer_spec.rb FEATURE: Add translations to posts (#32564) 2025-05-08 10:40:36 -07:00
post_revision_serializer_spec.rb FEATURE: Localize language names (#33790) 2025-07-29 11:48:45 +08:00
post_serializer_spec.rb FEATURE: Localize language names (#33790) 2025-07-29 11:48:45 +08:00
poster_serializer_spec.rb FIX: Include group flair in homepage category topic lists (#21268) 2023-04-27 10:18:16 +08:00
remote_theme_serializer_spec.rb FIX: Hide broken theme about/license URLs (#29930) 2024-11-26 13:53:10 +10:00
reviewable_claimed_topic_serializer_spec.rb FEATURE: Sync Reviewable Status (#31901) 2025-03-24 14:27:18 +11:00
reviewable_flagged_post_serializer_spec.rb DEV: Convert min_trust_to_flag_posts setting to groups (#24864) 2023-12-13 17:18:42 +08:00
reviewable_note_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
reviewable_queued_post_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
reviewable_score_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
reviewable_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
reviewable_user_serializer_spec.rb FEATURE: Allow rejected user details to be scrubbed (#31987) 2025-03-31 12:40:35 +11:00
single_sign_on_record_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
site_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
suggested_topic_serializer_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
tag_group_serializer_spec.rb FIX: ensure GroupChooser works with localized group names (#30593) 2025-01-13 11:29:04 +01:00
tag_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
theme_index_serializer_spec.rb PERF: Improve performance of the new themes listing page (#32641) 2025-05-08 19:18:07 +03:00
theme_objects_setting_metadata_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
theme_serializer_spec.rb DEV: Use themeable site settings for Horizon (#33645) 2025-07-24 12:20:34 +10:00
theme_settings_serializer_spec.rb DEV: Remove experimental_objects_type_for_theme_settings site setting (#26507) 2024-04-04 12:01:31 +08:00
topic_link_serializer_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_list_item_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
topic_list_serializer_spec.rb DEV: Set topic list filter name in serializer for children (#29291) 2024-10-18 17:24:47 -03:00
topic_tracking_state_item_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_tracking_state_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_view_details_serializer_spec.rb DEV: Don't allow context-free system post destruction (#32523) 2025-05-05 09:58:29 +08:00
topic_view_posts_serializer_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_view_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
upload_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
user_auth_token_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
user_badge_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_bookmark_list_serializer_spec.rb DEV: More targeted cleanup in plugin registry specs (#31333) 2025-02-14 10:28:29 -05:00
user_card_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
user_export_serializer_spec.rb FIX: User profile not loading with an empty export (#31290) 2025-02-11 16:18:06 -07:00
user_notification_total_serializer_spec.rb DEV: Dedicated route for current user notification counts (#26106) 2024-03-15 12:08:37 -04:00
user_post_bookmark_serializer_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
user_serializer_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
user_status_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
user_summary_serializer_spec.rb FEATURE: allow disabling user activity tab for non admin users (#25540) 2024-02-05 14:30:36 +05:30
user_with_custom_fields_serializer_spec.rb FEATURE: Hide user status when user is hiding public profile and presence (#24300) 2024-02-26 17:40:48 +04:00
web_hook_post_serializer_spec.rb DEV: Post localization improvements (#32869) 2025-05-27 08:49:53 -07:00
web_hook_topic_view_serializer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
web_hook_user_serializer_spec.rb DEV: use new 'ignore allowed groups' site settings (#27670) 2024-07-04 19:27:26 +02:00
wizard_serializer_spec.rb DEV: Wizard step tweaks (#32304) 2025-04-15 13:53:01 +08:00