-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Islandora 2395: Hook for Overwriting Human Readable Language Names #98
base: 7.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,16 +98,21 @@ function islandora_ocr_get_tesseract_installed_languages($tesseract = NULL) { | |
* otherwise the abbreviation is returned unaltered. | ||
*/ | ||
function islandora_ocr_tesseract_language_name($language) { | ||
$language_names = array( | ||
'eng' => t('English'), | ||
'fra' => t('French'), | ||
'deu-frak' => t('German'), | ||
'por' => t('Portugese'), | ||
'spa' => t('Spanish'), | ||
'hin' => t('Hindi'), | ||
'jpn' => t('Japanese'), | ||
'ita' => t('Italian'), | ||
); | ||
$language_names = module_invoke_all('get_ocr_tesseract_languages'); | ||
if (is_null($language_names)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. module_invoke_all is going to return an array and in the default case an empty one. So you should probably do something like
|
||
$language_names = array( | ||
'eng' => t('English'), | ||
'fra' => t('French'), | ||
'deu-frak' => t('German - Fraktur'), | ||
'por' => t('Portuguese'), | ||
'spa' => t('Spanish'), | ||
'hin' => t('Hindi'), | ||
'jpn' => t('Japanese'), | ||
'ita' => t('Italian'), | ||
'lat' => t('Latin'), | ||
'deu' => t('German') | ||
); | ||
} | ||
return isset($language_names[$language]) ? $language_names[$language] : $language; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Hooks for islandora_ocr module | ||
*/ | ||
|
||
|
||
/** | ||
* | ||
* This hooks allows modules to define their own list of human readable names for the given tesseract abbreviation | ||
* | ||
*/ | ||
function hook_get_ocr_tesseract_languages() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hook name should have the module name in it, so I would change this to |
||
|
||
// https://github.com/tesseract-ocr/tesseract/wiki/Data-Files | ||
return array( | ||
'swa' => t('Swahili'), | ||
'swe' => t('Swedish'), | ||
'syr' => t('Syriac'), | ||
'tam' => t('Tamil'), | ||
'tel' => t('Telugu'), | ||
'tgk' => t('Tajik'), | ||
'tgl' => t('Tagalog'), | ||
'tha' => t('Thai'), | ||
'tir' => t('Tigrinya'), | ||
'tur' => t('Turkish'), | ||
'uig' => t('Uighur; Uyghur'), | ||
'ukr' => t('Ukrainian'), | ||
'urd' => t('Urdu'), | ||
'uzb' => t('Uzbek'), | ||
'uzb_cyrl' => t('Uzbek - Cyrillic'), | ||
'vie' => t('Vietnamese'), | ||
'yid' => t('Yiddish'), | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the comment I left in the
api.php
document, you'll also need to change the name of the hook here.