Skip to content

First version of Dutch Lang#6

Open
micschk wants to merge 1 commit into
theiconic:masterfrom
restruct:master
Open

First version of Dutch Lang#6
micschk wants to merge 1 commit into
theiconic:masterfrom
restruct:master

Conversation

@micschk

@micschk micschk commented Jun 18, 2018

Copy link
Copy Markdown

I've created a Dutch version, it's just not totally clear to me what's the purpose & specific requirements to the keys of the language arrays. I figured they're just references but they may have something to do with 'normalizing'(?) Not sure, hope they're OK like this.

@wyrfel wyrfel self-assigned this Jun 18, 2018

@wyrfel wyrfel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wow, that is some comprehensive work. Thank you. Can you please add a unit test for this class and look at the inline comments i made? Thank you.

Comment thread src/Language/Dutch.php

public function getSuffixes(): array
{
return self::SUFFIXES;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since you are not doing any transformations in here, the mappers would try to match the suffixes by the keys provided in the array above (see https://github.com/theiconic/name-parser/blob/master/src/Mapper/SuffixMapper.php#L42). This means the input would have to contain e.g. bacc.alaureus for the suffix to be recognised and it would then be normalised to 'bacc.'. I'm pretty sure that's not what you'd want and a solution like the array_combine below, with provision of properly normalised array values could be a solution.

Comment thread src/Language/Dutch.php
public function getLastnamePrefixes(): array
{
$prefixMap = [];
foreach(self::LASTNAME_PREFIXES as $prefix){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add spaces before and after the parenthesis to keep a consistent code style.

Comment thread src/Language/Dutch.php
$prefixMap[$key] = $prefix;

// add version with ' instead of ’
if(strpos($prefix, '’') !== false){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add a space after if to keep consistent code style.

Comment thread src/Language/Dutch.php
foreach(self::LASTNAME_PREFIXES as $prefix){
$key = strtolower($prefix);
// $key = str_replace(' ', '-', $key);
// $key = str_replace('’', '', $key);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you decide these aren't needed, please drop these two lines.

Comment thread src/Language/Dutch.php
// $key = str_replace('’', '', $key);
$prefixMap[$key] = $prefix;

// add version with ' instead of ’

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We prefer to let the code speak for itself unless a comment is required to explain the background/reasoning of the implementation. I would suggest to drop this comment.

@rvanlaak

rvanlaak commented Nov 5, 2019

Copy link
Copy Markdown

@micschk are you ok if we finish your PR in order to get it merged?

@micschk

micschk commented Nov 5, 2019

Copy link
Copy Markdown
Author

@rvanlaak That'd be great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants