Skip to content

Translate post option.#161

Merged
jwr1 merged 8 commits into
mainfrom
option_translate_post
Apr 23, 2025
Merged

Translate post option.#161
jwr1 merged 8 commits into
mainfrom
option_translate_post

Conversation

@olorin99

@olorin99 olorin99 commented Apr 22, 2025

Copy link
Copy Markdown
Contributor

Add an option in the content menu to translate a selected post.
Also add an option in behaviour settings to auto translate posts in feed.
Translations are shown under the original body with the source and target languages.

@jwr1 jwr1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! It's a pretty cool idea to have post/comment translating built right into the app. Do you know if any other Lemmy apps have this feature? It honestly seems like such a big deal that we could potentially add it to the main feature list on our landing page.

A few things to note:

  • I like the way auto translate works. I just think the setting toggle label should make it clear auto translate works for both posts and comments.
  • Manual translate (through the overflow menu), opens up a dialog that has the source code of the original text on the top with the source code of the translated text on the bottom. It seems like making it work more like auto translate does would make it more useful, like instead of the dialog with the source code displaying, maybe close the overflow menu altogether so the post is visible again, and then display the rendered translation below the post like it does for auto translate. Presumable, if you run it multiple times (or after it was auto translated), it would just replace the current translation with the new one.

Comment thread lib/l10n/app_en.arb Outdated
@jwr1

jwr1 commented Apr 23, 2025

Copy link
Copy Markdown
Member

Will this work if a post/comment does not provide a language? I just realized that only while using Mbin (not Lemmy or PieFed) will posts/comments have a non-null lang.

Comment thread lib/src/widgets/content_item/content_item.dart
@olorin99

olorin99 commented Apr 23, 2025

Copy link
Copy Markdown
Contributor Author

Moved the translation itself out of content_menu into a callback from which the results are passed down into content_item so translations are always shown in the post/comment body and looks much better.

Yeah the auto translation requires the post/comment language to be correct. For example I've noticed most (if not all) posts from misskey are marked as english even though they're japanese. The translation api can auto detect the source language so manually triggering the translation will work.

@olorin99

Copy link
Copy Markdown
Contributor Author

And I haven't seen this feature mentioned for any other apps so would probably be good to advertise it.

@olorin99 olorin99 requested a review from jwr1 April 23, 2025 01:27
@jwr1 jwr1 merged commit 08bbf21 into main Apr 23, 2025
@jwr1 jwr1 deleted the option_translate_post branch April 23, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants