From e51664302452f2b7c39157aeeb1947a3e4d98021 Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Sun, 23 Apr 2023 16:53:57 +0700 Subject: [PATCH 1/4] feat(locale) - add en_HK locale --- docs/guide/localization.md | 1 + src/locale/en_HK.ts | 13 +++ src/locale/index.ts | 3 + src/locales/en_HK/company/index.ts | 12 ++ src/locales/en_HK/company/suffix.ts | 1 + src/locales/en_HK/index.ts | 22 ++++ src/locales/en_HK/internet/domain_suffix.ts | 1 + src/locales/en_HK/internet/index.ts | 12 ++ src/locales/en_HK/location/building_number.ts | 1 + src/locales/en_HK/location/city.ts | 106 ++++++++++++++++++ src/locales/en_HK/location/default_country.ts | 1 + src/locales/en_HK/location/index.ts | 32 ++++++ src/locales/en_HK/location/postcode.ts | 2 + src/locales/en_HK/location/state.ts | 1 + src/locales/en_HK/location/state_abbr.ts | 1 + .../en_HK/location/street_cantonese_part.ts | 80 +++++++++++++ .../en_HK/location/street_english_part.ts | 56 +++++++++ src/locales/en_HK/location/street_pattern.ts | 8 ++ src/locales/en_HK/location/street_prefix.ts | 1 + src/locales/en_HK/location/street_suffix.ts | 11 ++ src/locales/en_HK/metadata.ts | 13 +++ src/locales/en_HK/person/index.ts | 16 +++ src/locales/en_HK/person/last_name.ts | 99 ++++++++++++++++ .../en_HK/person/last_name_patterns.ts | 1 + src/locales/en_HK/person/name.ts | 3 + src/locales/en_HK/phone_number/formats.ts | 9 ++ src/locales/en_HK/phone_number/index.ts | 12 ++ src/locales/index.ts | 1 + test/all_functional.spec.ts | 3 + 29 files changed, 522 insertions(+) create mode 100644 src/locale/en_HK.ts create mode 100644 src/locales/en_HK/company/index.ts create mode 100644 src/locales/en_HK/company/suffix.ts create mode 100644 src/locales/en_HK/index.ts create mode 100644 src/locales/en_HK/internet/domain_suffix.ts create mode 100644 src/locales/en_HK/internet/index.ts create mode 100644 src/locales/en_HK/location/building_number.ts create mode 100644 src/locales/en_HK/location/city.ts create mode 100644 src/locales/en_HK/location/default_country.ts create mode 100644 src/locales/en_HK/location/index.ts create mode 100644 src/locales/en_HK/location/postcode.ts create mode 100644 src/locales/en_HK/location/state.ts create mode 100644 src/locales/en_HK/location/state_abbr.ts create mode 100644 src/locales/en_HK/location/street_cantonese_part.ts create mode 100644 src/locales/en_HK/location/street_english_part.ts create mode 100644 src/locales/en_HK/location/street_pattern.ts create mode 100644 src/locales/en_HK/location/street_prefix.ts create mode 100644 src/locales/en_HK/location/street_suffix.ts create mode 100644 src/locales/en_HK/metadata.ts create mode 100644 src/locales/en_HK/person/index.ts create mode 100644 src/locales/en_HK/person/last_name.ts create mode 100644 src/locales/en_HK/person/last_name_patterns.ts create mode 100644 src/locales/en_HK/person/name.ts create mode 100644 src/locales/en_HK/phone_number/formats.ts create mode 100644 src/locales/en_HK/phone_number/index.ts diff --git a/docs/guide/localization.md b/docs/guide/localization.md index 407d411fe27..3c90df20b00 100644 --- a/docs/guide/localization.md +++ b/docs/guide/localization.md @@ -91,6 +91,7 @@ In this example there are 5 locales. Each of these is checked in order, and the | `en_CA` | English (Canada) | `fakerEN_CA` | | `en_GB` | English (Great Britain) | `fakerEN_GB` | | `en_GH` | English (Ghana) | `fakerEN_GH` | +| `en_HK` | English (Hong Kong) | `fakerEN_HK` | | `en_IE` | English (Ireland) | `fakerEN_IE` | | `en_IN` | English (India) | `fakerEN_IN` | | `en_NG` | English (Nigeria) | `fakerEN_NG` | diff --git a/src/locale/en_HK.ts b/src/locale/en_HK.ts new file mode 100644 index 00000000000..a1d9494780a --- /dev/null +++ b/src/locale/en_HK.ts @@ -0,0 +1,13 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ + +import { Faker } from '../faker'; +import base from '../locales/base'; +import en from '../locales/en'; +import en_HK from '../locales/en_HK'; + +export const faker = new Faker({ + locale: [en_HK, en, base], +}); diff --git a/src/locale/index.ts b/src/locale/index.ts index 8772dca61b1..6b52d54e0b1 100644 --- a/src/locale/index.ts +++ b/src/locale/index.ts @@ -20,6 +20,7 @@ import { faker as fakerEN_BORK } from './en_BORK'; import { faker as fakerEN_CA } from './en_CA'; import { faker as fakerEN_GB } from './en_GB'; import { faker as fakerEN_GH } from './en_GH'; +import { faker as fakerEN_HK } from './en_HK'; import { faker as fakerEN_IE } from './en_IE'; import { faker as fakerEN_IN } from './en_IN'; import { faker as fakerEN_NG } from './en_NG'; @@ -84,6 +85,7 @@ export { fakerEN_CA, fakerEN_GB, fakerEN_GH, + fakerEN_HK, fakerEN_IE, fakerEN_IN, fakerEN_NG, @@ -149,6 +151,7 @@ export const allFakers = { en_CA: fakerEN_CA, en_GB: fakerEN_GB, en_GH: fakerEN_GH, + en_HK: fakerEN_HK, en_IE: fakerEN_IE, en_IN: fakerEN_IN, en_NG: fakerEN_NG, diff --git a/src/locales/en_HK/company/index.ts b/src/locales/en_HK/company/index.ts new file mode 100644 index 00000000000..a7c20c6c039 --- /dev/null +++ b/src/locales/en_HK/company/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { CompanyDefinitions } from '../../..'; +import suffix from './suffix'; + +const company: CompanyDefinitions = { + suffix, +}; + +export default company; diff --git a/src/locales/en_HK/company/suffix.ts b/src/locales/en_HK/company/suffix.ts new file mode 100644 index 00000000000..88602e407a6 --- /dev/null +++ b/src/locales/en_HK/company/suffix.ts @@ -0,0 +1 @@ +export default ['Ltd.', 'Co. Ltd.']; diff --git a/src/locales/en_HK/index.ts b/src/locales/en_HK/index.ts new file mode 100644 index 00000000000..cbbfed81797 --- /dev/null +++ b/src/locales/en_HK/index.ts @@ -0,0 +1,22 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { LocaleDefinition } from '../..'; +import company from './company'; +import internet from './internet'; +import location from './location'; +import metadata from './metadata'; +import person from './person'; +import phone_number from './phone_number'; + +const en_HK: LocaleDefinition = { + company, + internet, + location, + metadata, + person, + phone_number, +}; + +export default en_HK; diff --git a/src/locales/en_HK/internet/domain_suffix.ts b/src/locales/en_HK/internet/domain_suffix.ts new file mode 100644 index 00000000000..54279038014 --- /dev/null +++ b/src/locales/en_HK/internet/domain_suffix.ts @@ -0,0 +1 @@ +export default ['com', 'hk', 'com.hk', 'org.hk']; diff --git a/src/locales/en_HK/internet/index.ts b/src/locales/en_HK/internet/index.ts new file mode 100644 index 00000000000..5726872bcb7 --- /dev/null +++ b/src/locales/en_HK/internet/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { InternetDefinitions } from '../../..'; +import domain_suffix from './domain_suffix'; + +const internet: InternetDefinitions = { + domain_suffix, +}; + +export default internet; diff --git a/src/locales/en_HK/location/building_number.ts b/src/locales/en_HK/location/building_number.ts new file mode 100644 index 00000000000..20cefab6b18 --- /dev/null +++ b/src/locales/en_HK/location/building_number.ts @@ -0,0 +1 @@ +export default ['###', '##', '#']; diff --git a/src/locales/en_HK/location/city.ts b/src/locales/en_HK/location/city.ts new file mode 100644 index 00000000000..da0fa5f320f --- /dev/null +++ b/src/locales/en_HK/location/city.ts @@ -0,0 +1,106 @@ +export default [ + 'Aberdeen', + 'Ap Lei Chau', + 'Causeway Bay', + 'Chai Wan', + 'Cheung Chau', + 'Cheung Fat', + 'Cheung Sha Wan', + 'Choi Hung Chuen', + 'Choi Ming', + 'Chuk Yuen', + 'Cyberport', + 'Discovery Bay', + 'Fairview Park', + 'Fanling', + 'Fo Tan', + 'Fu Shan', + 'Fu Shin', + 'Fu Tai', + 'Happy Valley', + 'Heng Fa Chuen', + 'Heng On', + 'Hin Keng', + 'Ho Man Tin', + 'Hung Hom Bay', + 'Kam Tai', + 'Kam Tin', + 'Kennedy Town', + 'Kowloon', + 'Kowloon Bay', + 'Kowloon Central', + 'Kowloon City', + 'Kowloon East', + 'Kwai Chung', + 'Kwai Fong', + 'Kwai Shing', + 'Kwong Yuen', + 'Kwun Tong', + 'Lai King', + 'Lai Kok', + 'Lam Tin', + 'Lamma', + 'Lee On', + 'Lei Muk Shue', + 'Lei Tung', + 'Leung King', + 'Lok Fu', + 'Ma On Shan', + 'Mei Foo Sun Chuen', + 'Mei Lam', + 'Mong Kok', + 'Mui Wo', + 'Ngau Chi Wan', + 'Ngau Tau Kok', + 'Oi Man', + 'Peak', + 'Peng Chau', + 'Po Lam', + 'Pok Fu Lam', + 'Repulse Bay', + 'Sai Kung', + 'Sai Ying Pun', + 'San Tin', + 'Sau Mau Ping', + 'Sha Kok', + 'Sha Tau Kok', + 'Sha Tin', + 'Sham Shui Po', + 'Shau Kei Wan', + 'Shek Kip Mei', + 'Shek Lei', + 'Shek Wai Kok', + 'Shek Wu Hui', + 'Sheung Tak', + 'Sheung Wan', + 'Shun Lee', + 'Siu Sai Wan', + 'So Uk', + 'Stanley', + 'Sun Chui', + 'Tai Hing', + 'Tai Kok Tsui', + 'Tai Koo Shing', + 'Tai O', + 'Tai Po', + 'Tin Yiu', + 'Tin Yuet', + 'To Kwa Wan', + 'Tsat Tsz Mui', + 'Tseung Kwan O', + 'Tsim Sha Tsui', + 'Tsing Yi', + 'Tsuen Wan', + 'Tsz Wan Shan', + 'Tuen Mun', + 'Tung Chung', + 'Wah Fu', + 'Wah Ming', + 'Wan Chai', + 'Wan Tau Tong', + 'Wo Che', + 'Wong Tai Sin', + 'Yau Tong', + 'Yau Yat Tsuen', + 'Yuen Long', +]; diff --git a/src/locales/en_HK/location/default_country.ts b/src/locales/en_HK/location/default_country.ts new file mode 100644 index 00000000000..1689f8f4302 --- /dev/null +++ b/src/locales/en_HK/location/default_country.ts @@ -0,0 +1 @@ +export default ['Hong Kong']; diff --git a/src/locales/en_HK/location/index.ts b/src/locales/en_HK/location/index.ts new file mode 100644 index 00000000000..3e733971b69 --- /dev/null +++ b/src/locales/en_HK/location/index.ts @@ -0,0 +1,32 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { LocationDefinitions } from '../../..'; +import building_number from './building_number'; +import city from './city'; +import default_country from './default_country'; +import postcode from './postcode'; +import state from './state'; +import state_abbr from './state_abbr'; +import street_cantonese_part from './street_cantonese_part'; +import street_english_part from './street_english_part'; +import street_pattern from './street_pattern'; +import street_prefix from './street_prefix'; +import street_suffix from './street_suffix'; + +const location: LocationDefinitions = { + building_number, + city, + default_country, + postcode, + state, + state_abbr, + street_cantonese_part, + street_english_part, + street_pattern, + street_prefix, + street_suffix, +}; + +export default location; diff --git a/src/locales/en_HK/location/postcode.ts b/src/locales/en_HK/location/postcode.ts new file mode 100644 index 00000000000..50d9982a247 --- /dev/null +++ b/src/locales/en_HK/location/postcode.ts @@ -0,0 +1,2 @@ +// https://www.hongkongpost.hk/en/about_us/tips/postcode/index.html +export default []; diff --git a/src/locales/en_HK/location/state.ts b/src/locales/en_HK/location/state.ts new file mode 100644 index 00000000000..c31f6b013f2 --- /dev/null +++ b/src/locales/en_HK/location/state.ts @@ -0,0 +1 @@ +export default ['Hong Kong Island', 'Kowloon', 'New Territories']; diff --git a/src/locales/en_HK/location/state_abbr.ts b/src/locales/en_HK/location/state_abbr.ts new file mode 100644 index 00000000000..53239368802 --- /dev/null +++ b/src/locales/en_HK/location/state_abbr.ts @@ -0,0 +1 @@ +export default ['HK', 'KLN', 'NT']; diff --git a/src/locales/en_HK/location/street_cantonese_part.ts b/src/locales/en_HK/location/street_cantonese_part.ts new file mode 100644 index 00000000000..cbd67960c8a --- /dev/null +++ b/src/locales/en_HK/location/street_cantonese_part.ts @@ -0,0 +1,80 @@ +export default [ + 'Wan', + 'On', + 'Tai', + 'Man', + 'Fung', + 'Cheung', + 'Tung', + 'Hing', + 'Po', + 'Wah', + 'Tak', + 'Shing', + 'Lung', + 'Yuen', + 'Wing', + 'Hong', + 'Yip', + 'King', + 'Kwong', + 'Hoi', + 'Ming', + 'Wa', + 'Lok', + 'Yan', + 'Wai', + 'Chi', + 'Fuk', + 'Lai', + 'Lee', + 'Fu', + 'Tin', + 'Kai', + 'Sai', + 'Shun', + 'Ping', + 'Yee', + 'Wo', + 'Chung', + 'Hang', + 'Ning', + 'Wong', + 'Yue', + 'Choi', + 'Wang', + 'Ching', + 'Sau', + 'Shan', + 'Tsui', + 'Tau', + 'Sheung', + 'Lam', + 'Fat', + 'Hung', + 'Chuk', + 'Shek', + 'Kok', + 'Cheong', + 'Fong', + 'Nam', + 'Lei', + 'Yu', + 'Mei', + 'Pak', + 'Fai', + 'Kwai', + 'Sing', + 'Kung', + 'Chau', + 'Tong', + 'San', + 'Chiu', + 'Chun', + 'Yin', + 'Yuk', + 'Ting', + 'Kam', + 'Lun', + 'Oi', +]; diff --git a/src/locales/en_HK/location/street_english_part.ts b/src/locales/en_HK/location/street_english_part.ts new file mode 100644 index 00000000000..d9e8ebf576a --- /dev/null +++ b/src/locales/en_HK/location/street_english_part.ts @@ -0,0 +1,56 @@ +export default [ + 'Aldrich', + 'Arran', + 'Austin', + 'Baker', + 'Battery', + 'Bel-Air', + 'Bonham', + 'Boundary', + 'Bowen', + 'Breezy', + 'Caine', + 'Cameron', + 'Canal', + 'Cape', + 'Chatham', + 'Church', + 'College', + 'Comet', + 'Connaught', + 'Cornwall', + "Cox's", + 'Cross', + 'Douglas', + 'Dragon', + 'Eastern', + 'Electric', + 'Expo', + 'Findlay', + 'First', + 'Garden', + 'Gillies', + 'Greig', + 'Hospital', + "Jardine's", + 'Jordan', + 'Kennedy', + 'Kimberley', + 'Leighton', + 'Maidstone', + 'Maple', + 'Marsh', + 'Monmouth', + 'Oaklands', + 'Peel', + 'Poplar', + 'Rose', + 'Second', + 'Seymour', + 'Stewart', + 'Third', + 'Village', + 'Water', + 'Waterloo', + 'Wylie', +]; diff --git a/src/locales/en_HK/location/street_pattern.ts b/src/locales/en_HK/location/street_pattern.ts new file mode 100644 index 00000000000..7482e4a23ab --- /dev/null +++ b/src/locales/en_HK/location/street_pattern.ts @@ -0,0 +1,8 @@ +// Hong Kong has a mix of street names +// Some are English, for example "Argyle Street" +// Some are Cantonese, usually with two syllables and an English suffix, e.g. "Choi Wan Road" +// Real life examples: https://geographic.org/streetview/hong_kong/index.html +export default [ + '{{location.street_english_part}} {{location.street_suffix}}', + '{{location.street_cantonese_part}} {{location.street_cantonese_part}} {{location.street_suffix}}', +]; diff --git a/src/locales/en_HK/location/street_prefix.ts b/src/locales/en_HK/location/street_prefix.ts new file mode 100644 index 00000000000..d6d1738de67 --- /dev/null +++ b/src/locales/en_HK/location/street_prefix.ts @@ -0,0 +1 @@ +export default []; diff --git a/src/locales/en_HK/location/street_suffix.ts b/src/locales/en_HK/location/street_suffix.ts new file mode 100644 index 00000000000..f33f2d1c1eb --- /dev/null +++ b/src/locales/en_HK/location/street_suffix.ts @@ -0,0 +1,11 @@ +export default [ + 'Street', + 'Road', + 'Lane', + 'Path', + 'Terrace', + 'Avenue', + 'Drive', + 'Crescent', + 'Court', +]; diff --git a/src/locales/en_HK/metadata.ts b/src/locales/en_HK/metadata.ts new file mode 100644 index 00000000000..f61fd2a3cb5 --- /dev/null +++ b/src/locales/en_HK/metadata.ts @@ -0,0 +1,13 @@ +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; + +const metadata: PreBuiltMetadataDefinitionsForCountry = { + title: 'English (Hong Kong)', + code: 'en_HK', + country: 'HK', + language: 'en', + endonym: 'English (Hong Kong)', + dir: 'ltr', + script: 'Latn', +}; + +export default metadata; diff --git a/src/locales/en_HK/person/index.ts b/src/locales/en_HK/person/index.ts new file mode 100644 index 00000000000..fe538ef9573 --- /dev/null +++ b/src/locales/en_HK/person/index.ts @@ -0,0 +1,16 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { PersonDefinitions } from '../../..'; +import last_name from './last_name'; +import last_name_patterns from './last_name_patterns'; +import name_ from './name'; + +const person: PersonDefinitions = { + last_name, + last_name_patterns, + name: name_, +}; + +export default person; diff --git a/src/locales/en_HK/person/last_name.ts b/src/locales/en_HK/person/last_name.ts new file mode 100644 index 00000000000..7202f3822d5 --- /dev/null +++ b/src/locales/en_HK/person/last_name.ts @@ -0,0 +1,99 @@ +export default [ + 'Au', + 'Chan', + 'Chang', + 'Chen', + 'Cheng', + 'Cheuk', + 'Cheung', + 'Chiu', + 'Cho', + 'Choi', + 'Chong', + 'Chow', + 'Choy', + 'Chu', + 'Chui', + 'Chung', + 'Fan', + 'Fok', + 'Fu', + 'Fung', + 'He', + 'Ho', + 'Hong', + 'Hu', + 'Huang', + 'Hui', + 'Ip', + 'Kan', + 'Keung', + 'Ko', + 'Kong', + 'Kwan', + 'Kwok', + 'Kwong', + 'Lai', + 'Lam', + 'Lau', + 'Law', + 'Lee', + 'Leung', + 'Li', + 'Liang', + 'Lin', + 'Ling', + 'Liu', + 'Lu', + 'Lui', + 'Luk', + 'Lung', + 'Ma', + 'Mak', + 'Man', + 'Mok', + 'Ng', + 'Ngai', + 'Pang', + 'Poon', + 'Pun', + 'Shiu', + 'Shum', + 'Sin', + 'Siu', + 'So', + 'Suen', + 'Sun', + 'Sze', + 'Szeto', + 'Tai', + 'Tam', + 'Tan', + 'Tang', + 'Tong', + 'Tsang', + 'Tse', + 'Tsoi', + 'Tsui', + 'Wan', + 'Wang', + 'Wong', + 'Wu', + 'Xu', + 'Yan', + 'Yang', + 'Yeung', + 'Yim', + 'Yin', + 'Yip', + 'Yiu', + 'Yu', + 'Yue', + 'Yuen', + 'Yung', + 'Zhang', + 'Zhao', + 'Zheng', + 'Zhou', + 'Zhu', +]; diff --git a/src/locales/en_HK/person/last_name_patterns.ts b/src/locales/en_HK/person/last_name_patterns.ts new file mode 100644 index 00000000000..c66a770f4e3 --- /dev/null +++ b/src/locales/en_HK/person/last_name_patterns.ts @@ -0,0 +1 @@ +export default [{ value: '{{person.last_name}}', weight: 1 }]; diff --git a/src/locales/en_HK/person/name.ts b/src/locales/en_HK/person/name.ts new file mode 100644 index 00000000000..3ed8a80c86e --- /dev/null +++ b/src/locales/en_HK/person/name.ts @@ -0,0 +1,3 @@ +export default [ + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, +]; diff --git a/src/locales/en_HK/phone_number/formats.ts b/src/locales/en_HK/phone_number/formats.ts new file mode 100644 index 00000000000..3707487d739 --- /dev/null +++ b/src/locales/en_HK/phone_number/formats.ts @@ -0,0 +1,9 @@ +export default [ + '2### ####', + '3### ####', + '4### ####', + '5### ####', + '6### ####', + '7### ####', + '9### ####', +]; diff --git a/src/locales/en_HK/phone_number/index.ts b/src/locales/en_HK/phone_number/index.ts new file mode 100644 index 00000000000..bf48a8b5d05 --- /dev/null +++ b/src/locales/en_HK/phone_number/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { PhoneNumberDefinitions } from '../../..'; +import formats from './formats'; + +const phone_number: PhoneNumberDefinitions = { + formats, +}; + +export default phone_number; diff --git a/src/locales/index.ts b/src/locales/index.ts index b0f87395451..22054501f02 100644 --- a/src/locales/index.ts +++ b/src/locales/index.ts @@ -20,6 +20,7 @@ export { default as en_BORK } from './en_BORK'; export { default as en_CA } from './en_CA'; export { default as en_GB } from './en_GB'; export { default as en_GH } from './en_GH'; +export { default as en_HK } from './en_HK'; export { default as en_IE } from './en_IE'; export { default as en_IN } from './en_IN'; export { default as en_NG } from './en_NG'; diff --git a/test/all_functional.spec.ts b/test/all_functional.spec.ts index b55012901a2..fff3315008c 100644 --- a/test/all_functional.spec.ts +++ b/test/all_functional.spec.ts @@ -41,6 +41,7 @@ const BROKEN_LOCALE_METHODS = { 'en_CA', 'en_GB', 'en_GH', + 'en_HK', 'en_IE', 'en_IN', 'en_NG', @@ -71,6 +72,8 @@ const BROKEN_LOCALE_METHODS = { 'zh_TW', 'zu_ZA', ], + zipCode: ['en_HK'], + zipCodeByState: ['en_HK'], }, random: { locale: '*', // locale() has been pseudo removed From e7fbe906626539b7221ff1ddaa7b7835f949c51c Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Sun, 23 Apr 2023 17:31:51 +0700 Subject: [PATCH 2/4] export default null --- src/locales/en_HK/location/postcode.ts | 2 +- src/locales/en_HK/location/street_prefix.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/en_HK/location/postcode.ts b/src/locales/en_HK/location/postcode.ts index 50d9982a247..5384027f605 100644 --- a/src/locales/en_HK/location/postcode.ts +++ b/src/locales/en_HK/location/postcode.ts @@ -1,2 +1,2 @@ // https://www.hongkongpost.hk/en/about_us/tips/postcode/index.html -export default []; +export default null; diff --git a/src/locales/en_HK/location/street_prefix.ts b/src/locales/en_HK/location/street_prefix.ts index d6d1738de67..7646bbd17d0 100644 --- a/src/locales/en_HK/location/street_prefix.ts +++ b/src/locales/en_HK/location/street_prefix.ts @@ -1 +1 @@ -export default []; +export default null; From 444a23131e416d73020dfdfa42869cec29af289c Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Mon, 24 Apr 2023 11:37:33 +0700 Subject: [PATCH 3/4] add postcode_by_state --- src/locales/en_HK/location/index.ts | 2 ++ src/locales/en_HK/location/postcode_by_state.ts | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 src/locales/en_HK/location/postcode_by_state.ts diff --git a/src/locales/en_HK/location/index.ts b/src/locales/en_HK/location/index.ts index 3e733971b69..b7eb3b3157e 100644 --- a/src/locales/en_HK/location/index.ts +++ b/src/locales/en_HK/location/index.ts @@ -7,6 +7,7 @@ import building_number from './building_number'; import city from './city'; import default_country from './default_country'; import postcode from './postcode'; +import postcode_by_state from './postcode_by_state'; import state from './state'; import state_abbr from './state_abbr'; import street_cantonese_part from './street_cantonese_part'; @@ -20,6 +21,7 @@ const location: LocationDefinitions = { city, default_country, postcode, + postcode_by_state, state, state_abbr, street_cantonese_part, diff --git a/src/locales/en_HK/location/postcode_by_state.ts b/src/locales/en_HK/location/postcode_by_state.ts new file mode 100644 index 00000000000..5384027f605 --- /dev/null +++ b/src/locales/en_HK/location/postcode_by_state.ts @@ -0,0 +1,2 @@ +// https://www.hongkongpost.hk/en/about_us/tips/postcode/index.html +export default null; From 9aedcd6b6d379efa5eb1c56c2bf277a0ca216cb9 Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Mon, 24 Apr 2023 11:42:01 +0700 Subject: [PATCH 4/4] update docs --- docs/guide/upgrading.md | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md index 0572f5f1149..a4bf7da15df 100644 --- a/docs/guide/upgrading.md +++ b/docs/guide/upgrading.md @@ -123,20 +123,12 @@ fakerES.music.songName(); // 'I Want to Hold Your Hand' (fallback from en) fakerES_noFallbacks.music.songName(); // throws a FakerError ``` -This also has an impact on data that aren't applicable to a locale, for example Chinese doesn't use prefixes in names. +This also has an impact on data that aren't applicable to a locale, for example Hong Kong (`en_HK`) doesn't use ZIP codes/postcodes. ```ts -import { faker, fakerZH_CN, zh_CN } from '@faker-js/faker'; - -const fakerZH_CN_noFallbacks = new Faker({ - locale: [zh_CN], -}); - -faker.name.prefix(); // 'Mr' -// Previously: -//fakerZH_CN_noFallbacks.person.prefix(); // undefined -// Now: -fakerZH_CN.person.prefix(); // throws a FakerError +import { fakerEN_US, fakerEN_HK } from '@faker-js/faker'; +fakerEN_US.location.zipCode(); // 90210 +fakerEN_HK.location.zipCode(); // throws a FakerError ``` ### `faker.mersenne` and `faker.helpers.repeatString` removed