Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
gintko2441183dCan you describe your use case? Maybe its possible to solve it in another way? Such hacks usually mean that you doing sth wrong
bashleigh2201183dUse 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
Sorry 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/...
gintko2441181d@Wack do you really need to use tag then?
What about, if you create twig extension that will pass global variable to translation function? So you have lets say |t filter instead of |trans.
Even |trans has domain argument, so you can make macro which will pass correct domain automatically.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job