Download & Extend

Change the label for administrative area (a.k.a. state) to local term

Project:Address Field
Version:7.x-1.0-beta3
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

The label for the administrative area field needs to have the local term that is used in the country.

I already took a stab at it:

// Set the title to match the country term for their administrative area
    $administrative_area_terms = array(
      'AR' => 'Province',
      'AU' => 'State',
      'BR' => 'State',
      'BS' => 'District',
      'BY' => 'Province',
      'BZ' => 'District',
      'CA' => 'Province',
      'CN' => 'Province',
      'DO' => 'Province',
      'EG' => 'Governorate',
      'ES' => 'Autonomous Community',
      'FJ' => 'Division',
      'FM' => 'State',
      'GB' => 'Region',
      'HN' => 'Department',
      'ID' => 'Province',
      'IE' => 'County',
      'IN' => 'State',
      'IT' => 'Region',
      'JO' => 'Governorate',
      'JP' => 'Prefecture',
      'KI' => 'District',
      'KN' => 'Province',
      'KR' => 'Province',
      'KW' => 'Governorate',
      // 'KY' => '', // Cayman Islands is part of the U.K.?
      'KZ' => 'Province',
      'MX' => 'State',
      'MY' => 'State',
      'MZ' => 'Province',
      'NG' => 'State',
      'NI' => 'Department',
      'NR' => 'District',
      'NZ' => 'Region',
      'OM' => 'Region',
      'PA' => 'Province',
      // 'PF' => '', // French Polynesia is part of France?
      'PG' => 'Region',
      'PH' => 'Region',
      // 'PR' => '', // Puerto Rico is a territory of the U.S.?
      'PW' => 'State',
      'RU' => 'Federal Subject',
      // 'SM' => '', // San Marino has cities, does this make sense?
      'SO' => 'Region',
      'SR' => 'District',
      'SV' => 'Department',
      'TH' => 'Region',
      'TW' => 'Special municipality', // TAIWAN
      'UA' => 'Province',
      'US' => 'State',
      'UY' => 'Department',
      'VE' => 'State',
      // 'VI' => '', // Virgin Islands (U.S.) is a territory of the U.S.
      'VN' => 'Province',
      // 'YU' => '', // Unsure
      'ZA' => 'Province',
    );
   
    if(!empty($administrative_area_terms[$address['country']])) {
    $format['locality_block']['administrative_area']['#title'] = t($administrative_area_terms[$address['country']]);
    }

Comments

#1

Adding patch.

AttachmentSize
administrative_area_label-1396768.patch 12.82 KB

#2

Version:7.x-1.0-beta2» 7.x-1.0-beta3

This is a great idea.

I've just applied the patch to 7.x-1.0-beta3, and it applied with white space errors.

It functions as described. Could it be committed?

#3

Status:active» needs review

Patch has been attached for seven months. Marking as needs review in the hope this will be progressed.

#4

// 'PF' => '', // French Polynesia is part of France?

Yes it is ! :)
Even if it is not part of the french area we name "metropolitan France", it is part of France, it's an overseas territory...
(source: I'm French)