-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from theiconic/feature/languages
add multi-language support
- Loading branch information
Showing
31 changed files
with
668 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/vendor/ | ||
/tests/coverage | ||
phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace TheIconic\NameParser\Language; | ||
|
||
use TheIconic\NameParser\LanguageInterface; | ||
|
||
class English implements LanguageInterface | ||
{ | ||
const SUFFIXES = [ | ||
'1st' => '1st', | ||
'2nd' => '2nd', | ||
'3rd' => '3rd', | ||
'4th' => '4th', | ||
'5th' => '5th', | ||
'i' => 'I', | ||
'ii' => 'II', | ||
'iii' => 'III', | ||
'iv' => 'IV', | ||
'v' => 'V', | ||
'apr' => 'APR', | ||
'cme' => 'CME', | ||
'dmd' => 'DMD', | ||
'jr' => 'Jr', | ||
'junior' => 'Junior', | ||
'ma' => 'MA', | ||
'md' => 'MD', | ||
'pe' => 'PE', | ||
'phd' => 'PhD', | ||
'rph' => 'RPh', | ||
'senior' => 'Senior', | ||
'sr' => 'Sr', | ||
]; | ||
|
||
const SALUTATIONS = [ | ||
'dr' => 'Dr.', | ||
'fr' => 'Fr.', | ||
'madam' => 'Madam', | ||
'master' => 'Mr.', | ||
'miss' => 'Miss', | ||
'mister' => 'Mr.', | ||
'mr' => 'Mr.', | ||
'mrs' => 'Mrs.', | ||
'ms' => 'Ms.', | ||
'mx' => 'Mx.', | ||
'rev' => 'Rev.', | ||
'sir' => 'Sir', | ||
]; | ||
|
||
const LASTNAME_PREFIXES = [ | ||
'da' => 'da', | ||
'de' => 'de', | ||
'del' => 'del', | ||
'della' => 'della', | ||
'der' => 'der', | ||
'di' => 'di', | ||
'du' => 'du', | ||
'la' => 'la', | ||
'pietro' => 'pietro', | ||
'st' => 'st.', | ||
'ter' => 'ter', | ||
'van' => 'van', | ||
'vanden' => 'vanden', | ||
'vere' => 'vere', | ||
'von' => 'von', | ||
]; | ||
|
||
public function getSuffixes(): array | ||
{ | ||
return self::SUFFIXES; | ||
} | ||
|
||
public function getSalutations(): array | ||
{ | ||
return self::SALUTATIONS; | ||
} | ||
|
||
public function getLastnamePrefixes(): array | ||
{ | ||
return self::LASTNAME_PREFIXES; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace TheIconic\NameParser\Language; | ||
|
||
use TheIconic\NameParser\LanguageInterface; | ||
|
||
class German implements LanguageInterface | ||
{ | ||
const SUFFIXES = [ | ||
'1.' => '1.', | ||
'2.' => '2.', | ||
'3.' => '3.', | ||
'4.' => '4.', | ||
'5.' => '5.', | ||
'i' => 'I', | ||
'ii' => 'II', | ||
'iii' => 'III', | ||
'iv' => 'IV', | ||
'v' => 'V', | ||
]; | ||
|
||
const SALUTATIONS = [ | ||
'herr' => 'Herr', | ||
'hr' => 'Herr', | ||
'frau' => 'Frau', | ||
'fr' => 'Frau' | ||
]; | ||
|
||
const LASTNAME_PREFIXES = [ | ||
'der' => 'der', | ||
'von' => 'von', | ||
]; | ||
|
||
public function getSuffixes(): array | ||
{ | ||
return self::SUFFIXES; | ||
} | ||
|
||
public function getSalutations(): array | ||
{ | ||
return self::SALUTATIONS; | ||
} | ||
|
||
public function getLastnamePrefixes(): array | ||
{ | ||
return self::LASTNAME_PREFIXES; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace TheIconic\NameParser; | ||
|
||
interface LanguageInterface | ||
{ | ||
public function getSuffixes(): array; | ||
|
||
public function getLastnamePrefixes(): array; | ||
|
||
public function getSalutations(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.