Skip to content

Conversation

@blackg820
Copy link

use lang of the user

use lang of the user
Copy link
Owner

@jacklul jacklul left a comment

Choose a reason for hiding this comment

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

This can be simplified:

    public function processUpdate(Update $update): ServerResponse
    {
-       Language::set(Language::getDefaultLanguage()); // Set default language before handling each update
+       $lang_code = null;
+       $content = $update->getUpdateContent();
+
+       if ($content && ($from = $content->getFrom())) {
+           $lang_code = $from->getLanguageCode();
+       }
+
+       if (empty($lang_code)) {
+           $lang_code = Language::getDefaultLanguage();
+       }
+
+       Language::set($lang_code);
        
        return parent::processUpdate($update);
    }

Just keep in mind that currently there are no translations other than English.

@jacklul jacklul changed the base branch from master to develop September 23, 2025 15:32
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