Comments (4)
@robhudson Want to look into this? The relevant pieces are here:
https://github.com/willkg/puente/blob/master/puente/management/commands/extract.py#L54
and the add_context
/split_context
functions are here in Tower:
https://github.com/clouserw/tower/blob/master/tower/__init__.py#L59
There's some docs on msgctxt in the gnu manual:
https://www.gnu.org/software/gettext/manual/html_node/Contexts.html
What we want to know is if we're using pgettext from Django, whether those strings get extracted into the .pot file with context. If not, then we have to figure out why. It's possible that pgettext and friends aren't in the KEYWORDS list or something like that.
from puente.
There's a bug in how we do KEYWORDS where we're not getting the magic incantations from Babel on how the keywords get parsed. Totally my fault.
Anyhow, fixing that allows pgettext to work fine in Python files.
Jinja2 trans blocks don't support context currently, so we don't have to worry about them. I don't know about Jinja2 gettext tags, though. The docs don't talk about context at all. I think we'd have to look at the code.
from puente.
Pretty sure I fixed what's fixable in d87ee58.
The only outstanding thing is how you do context stuff with Jinja2 gettext. Is it possible? Do we need to fix it in Puente and and submit a fix upstream?
from puente.
I'm going to close this out and create a new issue for supporting context in Jinja2 templates.
from puente.
Related Issues (20)
- pgettext for templates
- ditch STANDALONE_DOMAINS HOT 2
- add tests for ngettext
- flesh out template usage docs HOT 1
- Add option to not create merge backup HOT 1
- Add width option to merge command HOT 5
- add django gettext keywords
- on readthedocs, star button is busted HOT 1
- specify patterns for extracting strings from installed dependencies HOT 3
- ./manage.py merge tries to merge LC_MESSAGES HOT 5
- Incompatible with Django 1.10 due to option_list being deprecated HOT 3
- coverage is described in `make help` but has no implementation HOT 2
- add support for django 2.0 HOT 1
- drop whitespace collapsing HOT 1
- Wiki changes HOT 1
- locale/compendia is unused by merge HOT 1
- CODE_OF_CONDUCT.md file missing
- Merge command leaves domain POT file open HOT 1
- Support jinja2 3.10+ HOT 2
- end-of-life 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 puente.