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

Add firstname gender method to all Person provider #114

Merged
merged 1 commit into from
Apr 14, 2014

Conversation

csanquer
Copy link
Contributor

Hi,

This is a missing feature already implemented in some localized Person provider but useful to all Person Providers.

The refactoring is not completed and I need some help to separate male and female firstname.

Concerned files have this comment :

// TODO separate male and female firstname

Remaining localized Person classes which need male and female firstname separating :

  • bn_BD
  • bg_BG
  • cs_CZ
  • da_DK
  • de_AT
  • de_DE
  • el_GR
  • en_AU
  • en_CA
  • en_GB
  • en_PH
  • en_US
  • es_AR
  • es_ES
  • es_PE
  • fi_FI
  • fr_BE
  • fr_CA
  • fr_FR
  • hu_HU
  • hy_AM
  • is_IS
  • it_IT
  • ja_JP
  • nl_BE
  • nl_NL
  • me_ME
  • pl_PL
  • pt_BR
  • ro_MD
  • ro_RO
  • ru_RU
  • sk_SK
  • tr_TR
  • uk_UA

Some firstnames remain unknown

  • en_ZA
  • lv_LV
  • sr_Cyrl_RS
  • sr_Latn_RS
  • sr_RS
  • zh_CN

@Dynom
Copy link
Contributor

Dynom commented May 18, 2013

I've made some changes to the nl_NL provider. While it doesn't yet reflect your changes, it does add separation to Famale/Male first names. #135

@csanquer
Copy link
Contributor Author

Thanks dynom, i added your firstnames list into nl_NL Person.

@oliveiraev
Copy link
Contributor

When the PR is accepted, I'll take care of pt_BR.

@Dynom
Copy link
Contributor

Dynom commented May 20, 2013

Awesome @csanquer, thanks!

@EmmanuelVella
Copy link

Any news on this PR ?

@csanquer
Copy link
Contributor Author

I' m working on it again, and i'll update this PR with recent Master changes

@nineinchnick
Copy link
Contributor

I just made a PR #276 for pl_PL yesterday.

);

// TODO separate male and female title
protected static $titleMale = array('mgr','inż.', 'dr', 'doc.');
Copy link
Contributor

Choose a reason for hiding this comment

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

Those are academic degrees and they're unisex. Mr and Ms equivalents are:

  • Pan for male
  • Pani for female

I don't think they should be included in default patterns, why some names should have the Mr/Ms prefix and others don't? For academic degrees you either have some or any at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your explanation, I will update that.

@fzaninotto
Copy link
Owner

I ran php-cs-fixer and it seems this PR needs rebase...

@csanquer
Copy link
Contributor Author

ok I forgot to use php-cs-fixer but the PR is not yet ready, there are still 14 remaining locale provider to update and split firstnames

@nineinchnick
Copy link
Contributor

Maybe this could be split into more PRs? Seems like an awful lot of work and it already waits for quite long time.

@csanquer
Copy link
Contributor Author

I rebased and updated more i18n providers but I still need help for the remaining locales.

I used REST API like genderize.io or gender-api.com but even with these usefull web services, some firstname genders remain unknown.

@csanquer
Copy link
Contributor Author

I updated all person providers and splitted all firstnames, titles and name formats into male and female.

Some providers have commented unknown gender firstnames (en_ZA, lv_LV, sr_*, zh_CN).
These person providers could be updated later but they are usable now with limited male and female firstnames lists.

I rebased and squashed the PR. It's ready for merge.

titleMale // 'Mr.'
titleFemale // 'Ms.'
suffix // 'Jr.'
name($gender = null) // 'Dr. Zane Stroman' // false, 0, 'male', 'm', 'boy' ,'b', 'man' for male; true, 1, 'female', 'f', 'girl', 'g', 'w', 'woman' for female; null or other value for any male or female firstname
Copy link
Owner

Choose a reason for hiding this comment

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

You should "hide" all the possible choices in the $gender value - they make the doc more complex to read. It's ok to leave all those details in the PHPDoc, but here in the README, you should only show $gender = 'male|female'

@fzaninotto
Copy link
Owner

Please revert work on locales where you have undefined gender - this reduces the randomness of data.

@csanquer
Copy link
Contributor Author

I followed your advices and improved the implementation and restore undefined gender firstnames into male and female firstnames list

@miguelgonz
Copy link

Thanks @csanquer hopefully this gets merged soon.

}

/**
* @example 'Doe'
*/
public static function lastName()
public function lastName()
Copy link
Owner

Choose a reason for hiding this comment

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

why not static anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because in some I18N Person providers like bg_BG , I need to use $this->generator->parse otherwise some tests failed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and I follow your advice to refactore using more formats

@csanquer
Copy link
Contributor Author

Is there anything that prevents merging this PR ?

@ktzar
Copy link

ktzar commented Apr 11, 2014

👍 There's a lot of people waiting for this PR to get merged. Lot of work in it.

@csanquer
Copy link
Contributor Author

Yes I know, maybe @fzaninotto is very busy these days. He was at the symfony live in Paris this week.

@fzaninotto
Copy link
Owner

Needs rebase

);

/**
* @link http://sr.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%B0%D0%BA_%D1%81%D1%80%D0%BF%D1%81%D0%BA%D0%B8%D1%85_%D0%B8%D0%BC%D0%B5%D0%BD%D0%B0
Copy link
Owner

Choose a reason for hiding this comment

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

Why did you remove the source? It's necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops !! Maybe, a rebase conflict not correctly resolved.

add FirstNameMale and FirstNameFemale method to all Person classes

add gender parameter to some localized lastname and prefix method

update README

add missing prefix method for bg_BG Person provider

set male and female firstnames for netherland locales

refactore is_IS firstname providers

add more values for gender parameter

rename person prefix methods to title and refactore them

separate male and female en_US firstname

update all Person Providers

add some unit tests for man, woman firstname and title

replace male and female title by academic degrees only for pl_PL

add polish names source comment

update male and female firstname for fr_FR, fr_CA and fr_BE

update male and female firstnames for es_AR, es_ES and es_PE

update male and female firstnames for pt_BR

update male and female firstnames and titles for it_IT

change title behavior for cs_CZ

update male and female firstnames for da_DK

change title behavior for nl_NL

update male and female firstnames for hu_HU

fix PSR2 coding style

fix PSR2 coding style

update male and female bengali titles

fix firstnames unit tests for me_ME

update male and female firstnames and titles for en_ZA and fi_FI (some names stay with gender unkown)

update male and female firstnames for lv_LV

update male and female firstnames for tr_TR

update male and female firstnames for zh_CN

update male and female firstnames for ja_JP

update male and female firstnames for fi_FI

update male and female firstnames for bn_BD

update male and female firstnames for ru_RU

fix title method for sk_SK

update partially male and female firstnames for sr_*

update README

remove deprecated comments

update male and female firstnames and title for hy_AM

update male and female firstnames for uk_UA

add gender option to name formatter

fix PSR2 coding style

make gender option more simple and improve implementation

restore unknown gender firstnames into male and female firstnames list

update es_ES firstnames list

restore source link for sr_RS Person firstname provider

simplify Person name unit test
@csanquer
Copy link
Contributor Author

i have fixed the lines you comment and rebase and squash the PR

@fzaninotto
Copy link
Owner

Let's get this rolling

fzaninotto added a commit that referenced this pull request Apr 14, 2014
Add firstname gender method to all Person provider
@fzaninotto fzaninotto merged commit 7a1cd40 into fzaninotto:master Apr 14, 2014
@fzaninotto
Copy link
Owner

Thanks a lot for all your work on this PR, @csanquer! This is much appreciated.

@csanquer
Copy link
Contributor Author

I hope just someone can update the last providers which I can't split firstnames.

@ulrikjohansson ulrikjohansson mentioned this pull request May 7, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants