Permalink
Browse files

Merge pull request #1131 from jiveshsg/indian_locale

Indian states added to en_IN locale
  • Loading branch information...
2 parents 82ad708 + e0d21e8 commit 03eb255d66bf1c11fccb4b4d1ed62fee70e3b6f4 @fzaninotto committed on GitHub Jan 5, 2017
Showing with 50 additions and 2 deletions.
  1. +50 −2 src/Faker/Provider/en_IN/Address.php
@@ -4,7 +4,6 @@
class Address extends \Faker\Provider\Address
{
-
protected static $city = array(
'Agra','Ahmedabad','Ajmer','Alwar',
'Bengaluru','Bhubhaneshwar','Bhopal','Bikaner',
@@ -28,6 +27,39 @@ class Address extends \Faker\Provider\Address
'Warangal',
);
+ protected static $state = array(
+
+ // States
+ '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',
+
+ // Union Territories
+ 'Andaman and Nicobar Islands',
+ 'Chandigarh',
+ 'Dadra and Nagar Haveli', 'Daman and Diu', 'Delhi',
+ 'Lakshadweep',
+ 'Puducherry'
+ );
+
+ 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',
@@ -74,7 +106,7 @@ class Address extends \Faker\Provider\Address
protected static $postcode = array(
'1#####','2#####','3#####','4#####','5#####',
);
- protected static $localityFormats = array (
+ protected static $localityFormats = array(
'{{firstName}}{{areaSuffix}}',
'{{localityName}}'
);
@@ -131,4 +163,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);
+ }
}

0 comments on commit 03eb255

Please sign in to comment.