[GH-ISSUE #445] [FEATURE] Allow set Accept-Language #293

Closed
opened 2026-02-25 20:35:21 +03:00 by kerem · 1 comment
Owner

Originally created by @jackyzy823 on GitHub (Sep 29, 2021).
Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/445

Originally assigned to: @vacom13 on GitHub.

Describe the feature you'd like to see added
Allow set Accept-Language in headers in Request.send

I encounter similar issue like https://github.com/benbusby/whoogle-search/issues/186#issuecomment-787468941

Then I use WHOOGLE_CONFIG_LANGUAGE to set page's language to lang_en . However the date format is still Arabic like this 21 Safar 1443 AH (the same as September 29 2021) .

so modified like this and it works.

diff --git a/app/request.py b/app/request.py
index 68e30d8..0a9a3e8 100644
--- a/app/request.py
+++ b/app/request.py
@@ -157,6 +157,7 @@ class Request:
         self.language = (
             config.lang_search if config.lang_search else ''
         )
+        self.lang_interface = config.lang_interface
         self.mobile = bool(normal_ua) and ('Android' in normal_ua
                                            or 'iPhone' in normal_ua)
         self.modified_user_agent = gen_user_agent(self.mobile)
@@ -243,6 +244,9 @@ class Request:
             'User-Agent': modified_user_agent
         }

+        if self.lang_interface:
+            headers.update({'Accept-Language': self.lang_interface.replace('lang_', '') + ';q=1.0'})
+
         # FIXME: Should investigate this further to ensure the consent
         # view is suppressed correctly
         now = datetime.now()

so could there be some configs to let user choose if set "Accept-language" or not.

Originally created by @jackyzy823 on GitHub (Sep 29, 2021). Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/445 Originally assigned to: @vacom13 on GitHub. <!-- DO NOT REQUEST UI/THEME/GUI/APPEARANCE IMPROVEMENTS HERE THESE SHOULD GO IN ISSUE #60 REQUESTING A NEW FEATURE SHOULD BE STRICTLY RELATED TO NEW FUNCTIONALITY --> **Describe the feature you'd like to see added** Allow set `Accept-Language` in headers in `Request.send` I encounter similar issue like https://github.com/benbusby/whoogle-search/issues/186#issuecomment-787468941 Then I use `WHOOGLE_CONFIG_LANGUAGE` to set page's language to `lang_en` . However the date format is still Arabic like this ` 21 Safar 1443 AH` (the same as September 29 2021) . so modified like this and it works. ```diff diff --git a/app/request.py b/app/request.py index 68e30d8..0a9a3e8 100644 --- a/app/request.py +++ b/app/request.py @@ -157,6 +157,7 @@ class Request: self.language = ( config.lang_search if config.lang_search else '' ) + self.lang_interface = config.lang_interface self.mobile = bool(normal_ua) and ('Android' in normal_ua or 'iPhone' in normal_ua) self.modified_user_agent = gen_user_agent(self.mobile) @@ -243,6 +244,9 @@ class Request: 'User-Agent': modified_user_agent } + if self.lang_interface: + headers.update({'Accept-Language': self.lang_interface.replace('lang_', '') + ';q=1.0'}) + # FIXME: Should investigate this further to ensure the consent # view is suppressed correctly now = datetime.now() ``` so could there be some configs to let user choose if set "Accept-language" or not.
kerem 2026-02-25 20:35:21 +03:00
Author
Owner

@vacom13 commented on GitHub (Oct 20, 2021):

@benbusby I would like to work on this.

<!-- gh-comment-id:947936690 --> @vacom13 commented on GitHub (Oct 20, 2021): @benbusby I would like to work on this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/whoogle-search#293
No description provided.