Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Website browsing in another language

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
languagewebsiteodoo17CE
2 Respuestas
3658 Vistas
Avatar
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
Avatar
Descartar
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

Avatar
Ray Carnes (ray)
Mejor respuesta

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
Avatar
Descartar
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.

Avatar
CodeWasher
Mejor respuesta

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
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Box multi language sur site web Resuelto
language website
Avatar
Avatar
Avatar
3
abr 24
4255
Some parts don't translate in any languages in webpages
language website
Avatar
0
ene 23
2953
how to disable browser language detection for odoo website ?
language browser website
Avatar
Avatar
1
abr 21
6027
Link translation
language translation website
Avatar
Avatar
2
nov 17
5102
Cómo deshabilitar la detección de idioma del navegador para el sitio web de Odoo?
language browser website_builder website
Avatar
0
sept 24
1569
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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