pangeachat / client

Learn a language while texting your friends
https://krille-chan.github.io/fluffychat/
GNU Affero General Public License v3.0
1 stars 2 forks source link

Unexpected translation - discuss an implementation #430

Closed wcjord closed 1 week ago

wcjord commented 1 week ago
Screenshot 2024-07-02 at 6 10 18 PM

This implementation is leading to some unexpected results.

Screenshot 2024-07-02 at 6 10 10 PM

I expect this to be translated to my L1, English.

Why'd we want this logic here?

ggurdin commented 1 week ago

This logic was to manage weird inconsistencies when we were using immersion mode for frequently. The logic goes:

  1. If immersion mode is on, then show the l1 representation (because at that point, the overlay messages were always pangea representations in the l2)
  2. Otherwise, if immersion mode is not on (which would mean that the user is not seeing the pangea rich text l1 representation in the overlay message, they are just seeing the message as sent), it checks if the original message has a lang code attached to it. If that lang code is the user's l1, then show the translation in the l2. If that lang code is null, assume that the user wrote the message in their base language and show the l2 translation (I think that's what happened here).
  3. Finally, if the original sent lang code is not null, and it's not the user's l1, the show the l1 rep.

Put in the shorter way - It tries to determine what language the user is seeing in the overlay message, and it tries to show the 'best' translation for that given context (so, if they're seeing l1, show l2, and if they're seeing l2, show l1). But it's not always possible to determine what language they're seeing.