-
Notifications
You must be signed in to change notification settings - Fork 52
FEATURE: Experimental feature for viewing translated topics #205
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
Conversation
| const translatedCooked = helper.getModel().get("translated_cooked"); | ||
| if (translatedCooked) { | ||
| cookedElement.innerHTML = translatedCooked; | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more familiar with ruby so I genuinely am not sure, but in this case do we even want the else for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's just a note to indicate it's a missing feature. Should not cost much.
|
Thank you @jbrw. |
…slation values (#210) In #205, we returned translated values using existing JS apis. While this was convenient, it does not allow us to modify crawler views such as ... https://github.com/discourse/discourse/blob/main/app/views/topics/show.html.erb ... when we want to serve translated pages. This commit makes use of discourse/discourse#31261 to override the values.
Related: - discourse/discourse-translator#205 - discourse/discourse-translator#274 - discourse/discourse-translator#294 With this PR, we will start showing localized posts (if available) based on the user's locale. This work had been done in discourse-translator, but is now moving to core.
In #32618, the button was added to a place which does not show up on mobile. When the feature was still in discourse-translator (discourse/discourse-translator#205), it was added to the plugin outlet which would allow it to show up on both mobile and desktop. This commit moves the button to be a neighbour of the plugin outlet.
Related: - discourse/discourse-translator#205 - discourse/discourse-translator#274 - discourse/discourse-translator#294 With this PR, we will start showing localized posts (if available) based on the user's locale. This work had been done in discourse-translator, but is now moving to core.
In #32618, the button was added to a place which does not show up on mobile. When the feature was still in discourse-translator (discourse/discourse-translator#205), it was added to the plugin outlet which would allow it to show up on both mobile and desktop. This commit moves the button to be a neighbour of the plugin outlet.
This feature shows a fully translated topic in the user's language. For now, the topic needs to already have translations for the translated topic to show. If there are posts that have not been translated, the original content will be shown.
Topic fully translated to site locale:
Topic fully translated to lang param:
Show original content of topic
The
translated_titleis returned via theTopicViewSerializerand displayed via theapplyTransformationsAPI.The
translated_cookedis returned via thePostSerializerand displayed viadecorateCooked.This takes a different approach from the previous PR #199 which overrode the
fancy_titleandcookeddirectly.