elk-zone / elk

A nimble Mastodon web client
https://elk.zone
MIT License
5.52k stars 566 forks source link

Translation missing from some posts but not others #1607

Open dalekcoffee opened 1 year ago

dalekcoffee commented 1 year ago

Hello!,

My primary language is English, but I follow many Japanese accounts on Mastodon.

One of my favorite features on elk.zone is the translate feature.

It appears that sometime this afternoon, translations are not appearing on posts, or not as often. If I scroll back to an earlier point in my feed I can see posts with translation available, but newer posts do not.

This appears to be true both on a desktop web browser, as well as a mobile web browser.

Specifically using Brave browser on both. Shields disabled.

I have gone ahead and cleared both cookies and cached data, it did not help the issue

Also tried vanilla chrome for windows, also not working.

App version [v0.7.1]

stackblitz[bot] commented 1 year ago

Solve in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

niklaswolf commented 1 year ago

This can happen, when the post which seems to be japanese has set the language to english. Then Elk's translation feature will not trigger, because the author tells explicitely that this is an english post. This can explain why you see the translation on some posts but not on others. Maybe you can provide a link to a post where you don't see a translation to confirm this theory :)

edimitchel commented 1 year ago

That's for sure the source of this issue. What we could probably do is detecting the language automatically. But your issue will still an issue for other web client which won't follow that feature (if implemented).

Servelan commented 1 year ago

If I use Norwegian, Spanish, German and French to try to test this with 'this is a test to see if translation's working', if the language of the post is set to English, no translation.

If I set the language of the post to Russian, translation link is provided. Logically, setting a post's default language to anything other than English will trigger translation.

Looks like the default for any post is English. Yes, it's a commonly used language, but there oughta be some way to alert users to set their post language to something other than English to trigger translation. That's not exactly a bug, but it is a feature that needs a serious tweak.

niklaswolf commented 1 year ago

@Servelan did you provide the languages you speak/understand in the language settings of elk? You can choose all languages you speak and for all posts that have set one of those languages, the translation is provided. The target translation language is determined by your user-interface language setting (also see in the language section of the settings). So all translations will translate to that language (if available in the translation service, the fallback is English).

Lastly, I provided a PR to set the default posting language to the one configured in the mastodon profile. Right now, the default for that was also the configured user-interface language

Servelan commented 1 year ago

I am a default English speaker, so I left it at the default. It is not a matter of what things translate to. Is is the fact that translation does not occur if the default language of a post is English. I have no idea what a 'PR' is but what you did will make no difference if the user's language default is English.

niklaswolf commented 1 year ago

@Servelan sorry for assuming that you're familiar with developer-terms, my bad. I tested this in my feed:

Bildschirmfoto 2023-07-29 um 18 18 57

Also I tried the other way round:

Maybe you can provide a link to a post where this is not working for you?

alrcatraz commented 7 months ago

The translate function seems not work all the time... My language setting is Chinese, but when I tried viewing posts via Elk, all posts shows in their original language. Screenshot 2024-04-17 224320