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

index 94e7c1188ae801cef514de83594ed93695b13450..730d43987fdcf760b716754189a0354905ad283d 100644 (file)
@@ -1887,7 +1887,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;
+                    }
                   }
                 }