2023-05-07 02:27:49 +02:00
|
|
|
<?PHP
|
|
|
|
/**
|
|
|
|
* Constains lists for grouping languages.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
*/
|
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides lists for categorizing spelled out languages.
|
|
|
|
*/
|
2023-05-14 12:11:23 +02:00
|
|
|
final class MDConcLanguages implements MDImporterConcordanceListInterface {
|
2023-05-07 02:27:49 +02:00
|
|
|
|
2023-05-14 12:11:23 +02:00
|
|
|
private const LANGUAGES_LIST = [
|
2023-07-25 22:35:10 +02:00
|
|
|
# English
|
|
|
|
'English' => 'en',
|
|
|
|
'eng' => 'en',
|
|
|
|
|
|
|
|
# German
|
2023-05-07 02:27:49 +02:00
|
|
|
'Deutsch' => 'de',
|
|
|
|
'German' => 'de',
|
2023-07-25 22:35:10 +02:00
|
|
|
'deu' => 'de',
|
|
|
|
|
|
|
|
# Hungarian
|
|
|
|
'Hungarian' => 'hu',
|
|
|
|
'Magyar' => 'hu',
|
2023-05-07 02:27:49 +02:00
|
|
|
];
|
|
|
|
|
2023-05-14 12:11:23 +02:00
|
|
|
/**
|
|
|
|
* Require a function for getting the concordance target.
|
|
|
|
*
|
|
|
|
* @param string $input Input string.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function getConcordanceTarget(string $input):string {
|
|
|
|
|
|
|
|
if (!isset(self::LANGUAGES_LIST[$input])) {
|
|
|
|
throw new MDImporterMissingConcordance("Unknown language type: " . $input);
|
|
|
|
}
|
|
|
|
|
|
|
|
return self::LANGUAGES_LIST[$input];
|
|
|
|
|
|
|
|
}
|
2023-05-07 02:27:49 +02:00
|
|
|
}
|