Giter Site home page Giter Site logo

i18n not working at all about pyramid_jinja2 HOT 7 CLOSED

pylons avatar pylons commented on June 12, 2024
i18n not working at all

from pyramid_jinja2.

Comments (7)

rockyburt avatar rockyburt commented on June 12, 2024

Well there's still some context missing, like are you using the same message domain in both raw code and the jinja2, etc. But regardless, I just committed a demo app that shows how to use i18n:
https://github.com/Pylons/pyramid_jinja2/tree/master/pyramid_jinja2/demo

To run the demo locally simply type:

python -m pyramid_jinja2.demo.__init__

The resulting web page will demonstrate translating english to french.

from pyramid_jinja2.

packardb avatar packardb commented on June 12, 2024

I want to use the same message domain for both raw code and jinja2 (casting). Also, i use render_to_response() in my view to render the template however this doesn't seem to be the problem.

from pyramid_jinja2.

rockyburt avatar rockyburt commented on June 12, 2024

As of pyramid_jinja2 0.6.2 the only domain checked during jinja2 rendering is "messages". So the real issue here is that you want to use a domain other than "messages" ?

from pyramid_jinja2.

packardb avatar packardb commented on June 12, 2024

This is bad, it's the only test i haven't done yet (using messages instead of my app's name as domain). I don't really mind using messages, but it would be nice if pyramid_jinja2 would somewhat "inherit" the domain from somewhere ... Until then, i'll use messages. It really sucks because setup.cfg is created with appname as message domain

from pyramid_jinja2.

rockyburt avatar rockyburt commented on June 12, 2024

Ok so I just made some more commits for this stuff... it's now possible to override the default domain with the 'jinja2.i18n.domain'.
config = Configurator(settings={'jinja2.i18n.domain': 'myappname'})

I've also updated the paster template that comes with pyramid_jinja2 to setup the default domain to be the name of the app for use with jinja2 templates. Can you try latest git clone to see if it works for you?

from pyramid_jinja2.

rockyburt avatar rockyburt commented on June 12, 2024

As soon as we close this issue I will be releasing a new version of pyramid_jinja2 so please confirm if the changes I made help you do what you need.

from pyramid_jinja2.

packardb avatar packardb commented on June 12, 2024

Seems to be working as expected. Thank you.

from pyramid_jinja2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.