Skip to content

Conversation

@yafred
Copy link
Contributor

@yafred yafred commented Mar 5, 2025

Follow up on #17074

Feedback is displayed (translated in the user's language) in the chatroom and in the modal dialog (if the user is the offender)

@yafred yafred marked this pull request as ready for review March 5, 2025 19:18
def abort(pov: Pov): Unit = tell(pov, s"i18n.${trans.playbanFeedbackAbort} {user}")

def noStart(pov: Pov): Unit = tell(pov, s"Warning, {user}. Failing to start games $tempBan")
def noStart(pov: Pov): Unit = tell(pov, s"i18n.${trans.playbanFeedbackNoStart} {user}")
Copy link
Collaborator

@ornicar ornicar Mar 7, 2025

Choose a reason for hiding this comment

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

suddenly we're sending i18n keys to the chat, where before there only was human-readable text.

this means that all clients displaying chats must now support these i18n keys.

the 2 mobile apps currently don't, and will instead show i18n.playbanFeedbackNoStart to the end user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted.

As we can't translate on the fly, it seems that there are only 2 options left:

  1. Keep Lichess messages in English in the chat
  2. Send the translated text (2 messages if the 2 players speak different languages)

private onMessage = (line: Line): void => {
if (line.u === 'lichess' && line.t.startsWith('i18n.')) {
this.translateLichessFeedback(line);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we only convert i18n messages when received from the WS, they'll remain untranslated when (re)loading the page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I saw the Lichess messages disappear from the chat when reloading ... I have to check

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes this particular message is not stored, but other potentially translatable messages are.

@ornicar
Copy link
Collaborator

ornicar commented Mar 7, 2025

So, this adds the concept of storing i18n keys in the chat database, and sending i18n keys as chat messages to clients, where before it only was human text.

This needs to be implemented in every client, of which we support 3: the website, the old app, and the new app.

When the app implements translatable chat messages, then it will become nearly impossible to change the format. So it's important to get it right the first time.

This is not right. It only works for translations that have one argument, which is the username. It's incredibly specific and won't generalize to other translatable chat messages.

@ornicar ornicar force-pushed the i18n-playban-feedback branch from e92640d to 79b35f3 Compare March 7, 2025 10:22
@yafred
Copy link
Contributor Author

yafred commented Mar 7, 2025

I agree ...
I got carried away trying to find a quick solution for the playban story.
However, without speaking of implementation, I found it difficult to picture the notion of translations in a chat room ...

I'll concentrate on the modal dialog first ....

EDIT: actually I can't (concentrate on the modal dialog first). It seems to be generated listening to the chat events

@yafred yafred marked this pull request as draft March 7, 2025 10:58
@yafred yafred closed this Mar 26, 2025
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