CRM-13713: localize the display of the country/province name for custom fields.
authorMathieu Lutfy <mathieu@bidon.ca>
Wed, 6 Nov 2013 16:23:58 +0000 (11:23 -0500)
committerMathieu Lutfy <mathieu@bidon.ca>
Wed, 6 Nov 2013 16:23:58 +0000 (11:23 -0500)
CRM/Core/BAO/CustomGroup.php

index 1922e6656d7051edd90cef0ee5e5eb6fb230a3f2..a8325dc39ac629bd3171cfe283709e58fff4f17b 100644 (file)
@@ -1992,7 +1992,17 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
 
                 if (is_object($coDAO)) {
                   while ($coDAO->fetch()) {
-                    $options[$coDAO->value] = $coDAO->label;
+                    if ($dataType == 'Country') {
+                      // NB: using ts() on a variable here is OK, since the value is pre-determined, not variable
+                      // and already extracted to .pot files.
+                      $options[$coDAO->value] = ts($coDAO->label, array('context' => 'country'));
+                    }
+                    elseif ($dataType == 'StateProvince') {
+                      $options[$coDAO->value] = ts($coDAO->label, array('context' => 'province'));
+                    }
+                    else {
+                      $options[$coDAO->value] = $coDAO->label;
+                    }
                   }
                 }