[saem-devel] [PATCH saem_ref V2] Force language to french in http-negociation mode

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Feb 22 08:12:37 CET 2017


applied


Le 21/02/2017 à 18:15, Philippe Pepiot a écrit :
> # HG changeset patch
> # User Philippe Pepiot <philippe.pepiot at logilab.fr>
> # Date 1487693269 -3600
> #      Tue Feb 21 17:07:49 2017 +0100
> # Node ID 5cea7d490d797156b648d02e3c87afeaead4193a
> # Parent  ce2a74e6ac634a14e58c61205d0386db904853c6
> # Available At https://hg.logilab.org/review/cubes/saem_ref
> #              hg pull https://hg.logilab.org/review/cubes/saem_ref -r 5cea7d490d79
> Force language to french in http-negociation mode
>
> diff --git a/cubicweb_saem_ref/site_cubicweb.py b/cubicweb_saem_ref/site_cubicweb.py
> --- a/cubicweb_saem_ref/site_cubicweb.py
> +++ b/cubicweb_saem_ref/site_cubicweb.py
> @@ -25,6 +25,7 @@ from cubicweb import cwvreg, _
>  from cubicweb.cwconfig import register_persistent_options
>  from cubicweb.uilib import PRINTERS
>  from cubicweb.entity import Entity
> +from cubicweb.web import request
>  
>  from cubes.skos import rdfio
>  from cubes.skos.ccplugin import ImportSkosData
> @@ -204,3 +205,11 @@ def is_hook_category_activated(self, cat
>      if self._hooks_mode is session.HOOKS_DENY_ALL:
>          return category in self._hooks_categories
>      return category not in self._hooks_categories
> +
> +
> + at monkeypatch(request._CubicWebRequestBase)
> +def negotiated_language(self):
> +    # Force language to fr since in http-negociation mode there is no way to
> +    # force french language with a browser configured in english.
> +    # This is currently the easiest way to force the language of an instance.
> +    return 'fr'
> _______________________________________________
> saem-devel mailing list
> saem-devel at lists.cubicweb.org
> http://lists.cubicweb.org/mailman/listinfo/saem-devel

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org



More information about the saem-devel mailing list