Skip to content

FEATURE: Add post language on creating a new post #33001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 11, 2025

Conversation

keegangeorge
Copy link
Member

@keegangeorge keegangeorge commented May 30, 2025

🔍 Overview

Previously we added the ability to translate existing posts in different languages: #32564. In this update we add the ability to set a post language upon initially creating a post.

Internally, we also clean-up/improve a few things, like:

  • adding a PostLanguageSelector component
  • Adding a available_content_localization_locales onto SiteSetting so it's available in the service (without needing to parse the JSON to access it)
  • fix issues with the translation-editor not working due to some regressions from here: DEV: Post localization improvements #32869
  • ensure everything works for replies/drafts/edits

📷 Screenshots

Screenshot 2025-06-05 at 12 03 24

@keegangeorge keegangeorge changed the title WIP: Add post language on creating a new post FEATURE: Add post language on creating a new post Jun 5, 2025
@keegangeorge keegangeorge marked this pull request as ready for review June 5, 2025 19:07
@keegangeorge keegangeorge requested a review from nattsw June 5, 2025 19:07
no need to redefine default locale
@keegangeorge keegangeorge merged commit b55af38 into main Jun 11, 2025
16 checks passed
@keegangeorge keegangeorge deleted the post-translation-on-create branch June 11, 2025 14:29
keegangeorge added a commit that referenced this pull request Jun 11, 2025
keegangeorge added a commit that referenced this pull request Jun 11, 2025
This is a second attempt at:
#33001

We had to [revert the
commit](#33157) because it
was performing a site-setting check at boot time, which is prone to
issues and not allowed.

This PR:
- re-introduces the changes in the original PR
- a fix by not performing a site-setting check at boot time (verified
by: `SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB="nonexist" bin/rails runner
"puts 'booted'"` locally and should be caught by the new CI check
introduced here: #33158)
- adds a fix to the translation editor to not show the original post
locale in the dropdown, as well as adding an indicator of what the
original post locale is in a small badge in the header:
- ![Screenshot 2025-06-11 at 08 42
36](https://github.com/user-attachments/assets/5f0944c5-ec4d-40b3-b97f-25b1fcab8329)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants