Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Website browsing in another language

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
languagewebsiteodoo17CE
2 Odpowiedzi
3654 Widoki
Awatar
HAMIDREZA HESARAKI

Hi Odoo developers, 


I need to set the default browsing language of the website to Arabic so that when someone browses the website for the first time sees the content in Arabic and the language selector shows Arabic as the default option, not English


I tried to set the default language of the website to Arabic but the result was not the same as I wanted.


Thanks in advance for your replies.

0
Awatar
Odrzuć
HAMIDREZA HESARAKI
Autor

Thanks for the reply,

Your solution seems interesting, but the get_response is not defined in the website module so I do not know where I need to intercept the request correctly

I will follow your lead 

Best regards

CodeWasher

ok, I did not test the code myself, but just try the idea, you may search in the odoo source code for where the method def get_response is defined and then inherit that model and try.

best wishes

Awatar
Ray Carnes (ray)
Najlepsza odpowiedź

HOW did you set the default language of your Website?

Did you follow the documentation?

https://www.odoo.com/documentation/17.0/applications/websites/website/configuration/translate.html


WHAT was the result?  It is hard to answer your question because we don't know what you tried and what you mean by "not the same as I wanted".


Something you should know about how Odoo sets the language on the Website:

1) First, Odoo checks the GeoIP of the user. Basically, what location in the world is the User accessing the database from. If the country code for that location has a default language that matches one from the Website, Odoo will use that first.

2) Second, Odoo checks the browser language set for the User's browser. Similarly to the approach above, if that language code matches one from the Website, Odoo will use that.

3) Last, Odoo will check the default language set on the Website and use that.


As you can see the default language on the website is only used if Odoo can't determine the language using the first two approaches.


2
Awatar
Odrzuć
HAMIDREZA HESARAKI
Autor

Thank you for the clear explanation

Yes I did change the default language from website settings but it always shows English first when browsing.

I am browsing from Kuwait and my browser lang is English but I expected that odoo ignore the detection from geo and the browser lang and show me the website from default language I selected.

Best regards

Ray Carnes (ray)

We are trying to be as helpful as we can to the visitor, since the browser is set to English in your case, but it may not be what you want in all cases.

JH

@Ray Carnes (ray)

Are you sure about point 1, that the odoo ecommerce checks the GeoIP of the user surfing to the site and changes language accordingly if the language is installed?

I cannot get it working.
Only point 2 where it checks the browser language.

I'd rather use GeoIP where odoo ecommerce checks the IP address.

Awatar
CodeWasher
Najlepsza odpowiedź

in your  custom module, you can try something like below 

from odoo import models, http

from odoo.http import request


class Website(models.Model):

    _inherit = 'website'


    def get_response(self, path, query_string, anchor, response=None):

        # Check if the user is visiting for the first time (no cookies set)

        if not request.httprequest.cookies.get('visited_before'):

            # Force Arabic language

            lang_code = 'ar'

            request.env['ir.http']._set_cookie_language(lang_code)

           

            # Redirect to Arabic version of the page

            url = request.httprequest.url.replace('/en/', f'/{lang_code}/')

            return request.redirect(url)

       

        # Set a cookie to indicate that the user has visited

        response = super(Website, self).get_response(path, query_string, anchor, response)

        response.set_cookie('visited_before', '1')

        return response


1
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Box multi language sur site web Rozwiązane
language website
Awatar
Awatar
Awatar
3
kwi 24
4255
Some parts don't translate in any languages in webpages
language website
Awatar
0
sty 23
2953
how to disable browser language detection for odoo website ?
language browser website
Awatar
Awatar
1
kwi 21
6026
Link translation
language translation website
Awatar
Awatar
2
lis 17
5102
Cómo deshabilitar la detección de idioma del navegador para el sitio web de Odoo?
language browser website_builder website
Awatar
0
wrz 24
1568
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now