Skip to content
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

translations via mastodon api #3228

Closed
wants to merge 11 commits into from

Conversation

Joshix-1
Copy link

Me trying to fix #134

I'm trying, I won't guarantee anything. This is just to show you guys, what I'm doing. If you don't see any activity for more than two days you can assume I lost interest or gave up. If someone who knows what they are doing wants to overtake, please feel free.

@Joshix-1
Copy link
Author

Joshix-1 commented Jan 28, 2023

It kind of works :)))

translation-tusky.mp4

Even on own toots:

translation-tusky-own-toot.mp4

@connyduck
Copy link
Collaborator

Thanks for taking a shot at this.

I'd make the interface similar to Twitter where translation is only available on posts in detail view, but one can see the original and translation side by side:

@Joshix-1
Copy link
Author

Joshix-1 commented Jan 29, 2023

I like the Mastodon UI more.

image

image

I'd make the interface similar to Twitter where translation is only available on posts in detail view

Why this limitation? I find that annoying, it is a few extra clicks

but one can see the original and translation side by side

I don't think that is really necessary. It takes up too much space for too little information. What if the toot is long?
On Twitter posts are guaranteed to be of a certain length. On Mastodon toots can be really long

@Joshix-1
Copy link
Author

As a side note: As far I know to detect whether or not the instance supports translation Tusky needs to support the /api/v2/instance endpoint (#3153)

timelineCases.translate(status.actionableId).await()
} catch (t: Exception) {
ifExpected(t) {
Log.d(TAG, "Failed to reblog status " + status.actionableId, t)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Log.d(TAG, "Failed to reblog status " + status.actionableId, t)
Log.d(TAG, "Failed to translate status " + status.actionableId, t)

@nikclayton
Copy link
Contributor

I like this, @Joshix-1 .

What's the rationale for caching the translation result locally? I suspect this isn't necessary, as I would expect that the vast majority of translations would be a one-time thing as the user is scrolling through their timeline. Am I missing something?

@sl1txdvd
Copy link

sl1txdvd commented Mar 10, 2023

I'm trying this. So far I could only get some DE to EN translation results. Other languages don't seem to do anything. Translating EN says it translated to EN (does not change anything). Translating ES does not seem to do anything, however I can see on the server that libretranslate is sending something.

Edit: Now that I ran ADB locat to see what is happening, it did translate ES to EN. Maybe it was a slow server thing.

Edit 2: When nothing is happening in Tusky, internally it's a 200 from libretranslate, but a 503 from Mastodon. Maybe a timeout on Mastodon server side?

If you don't see any activity for more than two days you can assume I lost interest or gave up.

So this is abandoned then? That's a pity, it was a great start.

@Joshix-1
Copy link
Author

Joshix-1 commented Mar 12, 2023

So this is abandoned then?

For now sadly yes, I currently have neither time nor motivation, sorry

@timnolte
Copy link

What were the blockers for implementing this change? It seemed as though things were working from what I say in the sample videos.

After recent issues with the beta crashing Tusky I gave the Megalodon client a try, which is a fork of the official client and it has the translation support that my instance is providing, I'm finding it hard to justify going back to Tusky and losing the translation capability.

@timnolte
Copy link

This would also fix #2823

@timnolte
Copy link

This would also fix #2188

@Joshix-1 Joshix-1 force-pushed the native-mastodon-translation branch from 59bd00d to eee64ae Compare September 21, 2023 18:40
@Tak
Copy link
Collaborator

Tak commented Sep 22, 2023

imo this looks pretty good already.
I would agree that caching the translation is unnecessary (and contributes a lot of the complexity of the change!).

@Joshix-1
Copy link
Author

Joshix-1 commented Sep 22, 2023

I don't really know the Tusky code-base so I don't know. I just looked at the implementation for boosting and did the same for translations.

I'm currently running the changes and they mostly work, but there are some annoying bugs. Sometimes Tusky just crashes, I can't translate in the notification view.
And the ui is bad. the feature, shouldn't be in the 3-dot-menu, it should only show if the post isn't already in the language of the users. The text after the translation informing users about it being translated should look better.

tldr: i have no clue & this is in a barely good enough state for me

@connyduck
Copy link
Collaborator

As a side note: As far I know to detect whether or not the instance supports translation Tusky needs to support the /api/v2/instance endpoint (#3153)

Yes. I don't think we should add translation without detecting if the feature is supported by the instance. Not all bigger instances have it and users will be very confused if there is a button but it doesn't work.

I'd make the interface similar to Twitter where translation is only available on posts in detail view

Why this limitation? I find that annoying, it is a few extra clicks

To keep the implementation simpler. Putting the translations into the database is overkill for this feature imho, and the overflow menu already pretty overloaded.

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.

[Feature Request] translation feature
6 participants