-
-
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
Make world_region translate on advanced search field #13212
Conversation
(Standard links)
|
// Merge params with defaults | ||
$params += array( | ||
'grouping' => FALSE, | ||
'localize' => FALSE, | ||
'localize' => $localizeDefault, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eileenmcnaughton can we directly use:
$params += array(
...
'localize' => (in_array($context, ['search'])),
);
as $localizeDefault isn't used anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - but I kinda wanted to put a bunch of comments with it as this feels a little risky so doing it first gave me a space to do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I see, no problem. It's a wise choice to get some comment space over reduce-variable-assignment.
CRM/Core/BAO/Address.php
Outdated
@@ -1349,7 +1349,7 @@ public static function buildOptions($fieldName, $context = NULL, $props = array( | |||
case 'world_region': | |||
case 'worldregion': | |||
case 'worldregion_id': | |||
return CRM_Core_PseudoConstant::worldRegion(); | |||
return CRM_Core_BAO_Country::buildOptions('region_id', $context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and this will eventually call
CRM_Core_PseudoConstant::get('CRM_Core_BAO_Country', $fieldName, 'region_id',[], $context);
@eileenmcnaughton can you pass the $props parameter too? i.e.
return CRM_Core_BAO_Country::buildOptions('region_id', $context, $props);
just in case :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
||
if (isset($fieldXML->localize_context)) { | ||
$field['localize_context'] = $fieldXML->localize_context; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
I agree with the patch, however, there are two minor changes needed in the PR, so I am tagging merge-ready. |
Agree with the final patch. Tagging MoP |
673c89f
to
37f0ce9
Compare
Jenkins re test this please |
@eileenmcnaughton looks like test failures relate All have the change of
|
37f0ce9
to
b06ca61
Compare
Jenkins re test this please |
Merging as per the tag |
Overview
Fixes lack of translation for world region on advanced search screen
Before
After
Technical Details
Per digging in #13127 - the getLabel function is being called with localizable = 0 even though
clearly specifies that localisation is by context and
The key line is here - the various buildOptions functions call this
In the case of world_region the translation is done by gettext - the reason this issue is less obvious apart from this field is that most fields rely on option value overrides.
The issue came up because digging here #13127 suggest that in some cases we fall back on gettext - seemingly in export we do this when locale-specific options are not defined too
Comments
Note that even after this search builder shows the untranslated fields - that would require ALSO changing for context 'get' which I left our of scope in this round
@mlutfy @mattwire @colemanw @samuelsov ....