Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Use th3 process class. (Think that's what it's called) it's for executing commands. I've seen it used to call a node script before
-
Wack61957ySorry I only find time to reply now.
@bashleigh I'm not trying to call an external (node js) scrips but to parse nodes in a parse tree.
@gintko so we've got a symfony app deployed, let's say it's currently at foo.baz
We've been asked to put a second one up at bar.baz that is almost a clone. (Different logo, different text, some functionality deactivated, but others should be there, just minor things. Even 99% of the things in the db have to be synced).
We've therefore decided to use the same codebase and db.
In the `app/config/parameters.yml` file we added an entry `page` which either holds the value `'foo'` or `'bar'`. This value is then passed to twig as a global variable for some if ... else ... In the frontend.
The trouble however is with the translations.
What we'd like to have would be `messages_foo.<lang>.xliff` and `messages_bar.<lang>.xliff`.
To achieve this we've both tried to set the `default_translation_domain` in a if else, which didn't work. It only generated one even when changing the parameter and clearing the cache it still only generated the same one.
Since it's not possible to set a default translation domain, as far as I know the only way would be to have a modified twig parser injecting nodes if there's no default translation node in a template. That would have to run before the extraction command, so at compile level.
Afaik a twig visitor wouldn't work here as it's executed to late (correct me if I'm wrong).
Our current (suboptimal) setup:
Develop in branch feature_x, pullrequest master <- feature_x, then two pull requests foo <- master and bar <- master. Adjust translations on foo.com and bar.com, commit the translations to their branches. (Improvements to this procedure very welcome!)
Edit: some more information: https://github.com/symfony/symfony/... -
Wack61957y@gintko would be an option. Damn. Why haven't I thought about that? Do you know if I can extend the current trans filter and tags? Or do I need to have a new one?
Related Rants
Any Symfony expert here? I've got quite a tricky question, that I'd love to disqus with another dev.
It's about twig within symfony. I'd like to add a custom node parser, but not for an own tag, but to set some value on each template if it's not set (which can't be done with globals in this case!). I've thought about using a visitor, but from my understanding it gets executed to late, as it requires (probably) to modify the twig AST at compile/parse time.
question
stuck
symfony
ast
php
twig