-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorkflowMessage - Allow more dynamic-localized data. Unify language field. #26618
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…essage-template content While rejuggling the order of operations in `renderTemplateRaw()`, this helped some tests (like `testRenderDefaultTemplate()`) pass.
There's no particular sense to this, except that it should help the next refactoring steps.
To r-run this, I used the following procedure: * Take an arbitrary `Contribution` from example DB (eg id=100) * Update in SQL (`SET is_test=1 WHERE id=100`) * Send mailing with `cv api Contribution.sendconfirmation id=100` * Check email log
(Standard links)
|
totten
changed the title
(WIP) DGWDIWT
WorkflowMessage - Unify handling of locale/language property
Jun 23, 2023
totten
changed the title
WorkflowMessage - Unify handling of locale/language property
WorkflowMessage - Allow more dynamic-localized data. Unify language field.
Jun 23, 2023
In my testing this didn't work entirely as I expected - in that
I'm not too sure what I think of that but it means it is at least possible to get the locale consistent, even if it does require some diligent remembering I'm merging this as a clear improvement |
eileenmcnaughton
added a commit
to eileenmcnaughton/civicrm-core
that referenced
this pull request
Jun 25, 2023
eileenmcnaughton
added a commit
to eileenmcnaughton/civicrm-core
that referenced
this pull request
Jun 25, 2023
totten
added a commit
that referenced
this pull request
Jun 26, 2023
Follow up to #26618 - set locale consistently when exporting model
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Make it possible for bespoke methods in
WorkflowMessage
s to generate localized content.Before
There is a schism in how
MessageTemplate::renderTemplate()
handles languages -- there are:$params['tokenContext']['locale']
(re: token-rendering), and$params['language']
(re: template-selection).At the time that the
WorkflowMessage
is evaluated ($params=exportAll(importall($params))
), the[tokenContext][locale]
is available to theWorkflowMessage
, but the final version oflanguage
) is not available (because the template hasn't been loaded yet).After
The same locale variable is used more consistently. The two properties are aliases. The template-selection is done while
WorkflowMessage
is being evaluated.Technical Details
There is a trade-off here - that
alterMailParams
will no longer influence the loading the template. But it should mean thatWorkflowMessage
classes get better to the effective locale. Eileen says she searcheduniverse
and didn't think anyone would be affected.There were lots of other little bits needed along the way. I don't know if all of this is a good idea, but it's probably not terrible.