Comments (7)
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.
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.
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.
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.
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.
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.
Seems to be working as expected. Thank you.
from pyramid_jinja2.
Related Issues (20)
- Bug in GETTEXT when loading templates dynamically HOT 2
- After including pyramid_jinja2, config.get_jinja2_environment() is still None HOT 1
- Templates not found in sub-directories (add_jinja2_search_path ) HOT 6
- [Resolved]Log warnings while sphinx generate documentation HOT 3
- jinja2 exceptions propages to top - not caught by debug toolbar HOT 11
- release 2.6 HOT 3
- add test coverage for python 3.5 and pypy3, remove 3.2 HOT 2
- Impossible to set `jinja2.i18n.gettext` via configuration file HOT 7
- switch to py.test and pip HOT 3
- Typo in the default template in trans tag causes i18n to fail HOT 8
- convert scaffold to cookiecutter HOT 14
- add_jinja2_renderer `name` only works for default search path HOT 1
- globals cannot be set to strings HOT 1
- Can't list templates HOT 1
- ModuleNotFoundError: No module named 'pyramid_Jinja2' HOT 1
- Support for continue / break statements HOT 2
- add support for lstrip_blocks HOT 4
- Fix pypy version on Travis HOT 5
- What's the best way to add the current request object to Jinja's globals? HOT 3
- Requires Jinja2 3.0, but doesn't declare so HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyramid_jinja2.