1

If debugging is enabled, 'Unsupported locale specified to parseStreetAddress: en_GB' message appears in some situations (add/edit contact), which scares non-techy editors.

There are some ancient posts at civicrm forums, which describe clearly why this message appears, but I've not been able to find a recipe of how to stop this from popping up, apart from a general advice of "provide custom logic for parsing UK postal addresses".

Any hint about how to hide the message, please. Thanks!

  • do you have address parsing checkbox under Address Editing turned on here Admin > Localisation > Address Settings, ie civicrm/admin/setting/preferences/address?reset=1 – petednz - fuzion Mar 22 '16 at 1:20
  • Yes, I have; does it have any relationship to geo coding or it's just about slicing an address string to a fractions? – yurg Mar 22 '16 at 11:50
  • since your error had the word 'parseStreetAddress' it seemed a good guess. if so, and if this is a factor, then i will convert this to an answer – petednz - fuzion Mar 22 '16 at 18:31
  • Well, since it has nothing to do with geocoding [which we definitely do use] , guess your answer suits perfectly in situation, where one might want a simple solution (check box un-tick, boom, done). I'd like to accept your answer as well for those, who prefers solutions available via GUI. – yurg Mar 25 '16 at 9:58
1

If you switch off the checkbox for street parsing (as petednz suggests) the error will disappear. But if you really need the street parsing that will not help you. In that case you would need to add the en_GB to the array in CRM_Core_BAO_Address in an extension, like so:

  static function parseStreetAddress($streetAddress, $locale = NULL) {
$config = CRM_Core_Config::singleton();
/* locales supported include:
 *  en_US - http://pe.usps.com/cpim/ftp/pubs/pub28/pub28.pdf
 *  en_CA - http://www.canadapost.ca/tools/pg/manual/PGaddress-e.asp
 *  fr_CA - http://www.canadapost.ca/tools/pg/manual/PGaddress-f.asp
 *          NB: common use of comma after street number also supported
 *  default is en_US
 */
$supportedLocalesForParsing = array('en_US', 'en_CA', 'fr_CA', 'en_GB');

if (!$locale) {
  $locale = $config->lcMessages;
}

and this is a bit awkward :-)

  • ...and I will be loosing this change after each security update. – yurg Mar 22 '16 at 11:52
  • Not if you put it in an extension like you should :-) – ErikH - CiviCooP Mar 22 '16 at 12:46
  • If it's about this wiki.civicrm.org/confluence/display/CRMDOC/…, it's a bit too much overwhelming than (for my taste). But still, whole point is excellent, since file, where this function is located (CRM\Core\BAO\Address.php) could be moved to custom php directory. Thanks! – yurg Mar 22 '16 at 17:47
  • I can imagine it is a bit overwhelming to develop an extension but it is the way to go if you want to continue developing with and around CiviCRM :-). For the moment the custom php directory will offer you a solution, but if you get more customization go for the extension approach. There should be enough help around :-) – ErikH - CiviCooP Mar 22 '16 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.