Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Indian states added to en_IN locale #1131

Merged
merged 3 commits into from
Jan 5, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/Faker/Provider/en_IN/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class Address extends \Faker\Provider\Address
{

protected static $city = array(
'Agra','Ahmedabad','Ajmer','Alwar',
'Bengaluru','Bhubhaneshwar','Bhopal','Bikaner',
Expand All @@ -28,6 +27,14 @@ class Address extends \Faker\Provider\Address
'Warangal',
);

protected static $state = array(
'Andhra Pradesh', 'Arunachal Pradesh', 'Assam', 'Bihar', 'Chhattisgarh', 'Goa', 'Gujarat', 'Haryana', 'Himachal Pradesh', 'Jammu and Kashmir', 'Jharkhand', 'Karnataka', 'Kerala', 'Madhya Pradesh', 'Maharashtra', 'Manipur', 'Meghalaya', 'Mizoram', 'Nagaland', 'Odisha', 'Punjab', 'Rajasthan', 'Sikkim', 'Tamil Nadu', 'Telangana', 'Tripura', 'Uttar Pradesh', 'Uttarakhand', 'West Bengal', 'Andaman and Nicobar Islands', 'Chandigarh', 'Dadra and Nagar Haveli', 'Daman and Diu', 'Delhi', 'Lakshadweep', 'Puducherry'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please split the line by capital letter, and order alphabetically

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The administrative region equivalent of "states" in India consists of "states" plus "union territories", therefore the list is arranged alphabetically in two batches where the last 7 entries are union territories (form of states but governed by the central government, with exception of Delhi, i.e. the the capital as well as union territory, also has separate government). So this was the correct way of doing this in my opinion.

Also, please give an example of what do you mean by splitting the line by capital letter. Is is like the following?

'Andhra
Pradesh', ...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. For the line splitting, it's more like

'Andhra Pradesh', 'Arunachal Pradesh', 'Assam',
'Bihar',
'Chhattisgarh',
'Goa', 'Gujarat',
...

);

protected static $stateAbbr = array(
'AP', 'AR', 'AS', 'BR', 'CG', 'GA', 'GJ', 'HR', 'HP', 'JK', 'JH', 'KA', 'KL', 'MP', 'MH', 'MN', 'ML', 'MZ', 'NL', 'OD', 'PB', 'RJ', 'SK', 'TN', 'TS', 'TR', 'UP', 'UK', 'WB', 'AN', 'CH', 'DN', 'DD', 'DL', 'LD', 'PY'
);

protected static $country = array(
'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica (the territory South of 60 deg S)', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan',
'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island (Bouvetoya)', 'Brazil', 'British Indian Ocean Territory (Chagos Archipelago)', 'British Virgin Islands', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi',
Expand Down Expand Up @@ -131,4 +138,20 @@ public function areaSuffix()
{
return static::randomElement(static::$areaSuffix);
}

/**
* @example 'Delhi'
*/
public static function state()
{
return static::randomElement(static::$state);
}

/**
* @example 'DL'
*/
public static function stateAbbr()
{
return static::randomElement(static::$stateAbbr);
}
}