-
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?
Conversation
Hi @megwill4268, just wondering if there was a reason you closed this work? It seemed to be good work towards the associated ticket. Let me know. |
Hi @whikloj it was failing the travis ci tests so I retracted it. I'll re-open it. I haven't gotten a chance to see what in syntax wasn't passing the checks. |
@megwill4268 Looks like this may be a problem with the .travis.yml file and not your code. Are other pulls to islandora_ocr failing too? I know islandora_scholar is having this problem. |
@megwill4268 looks like you need a space as described here, normally this is because you have
and it wants
@bondjimbond due to Islandora/islandora#714 a lot of modules need a lot of love to fix outstanding issues now that we have updated code sniffer. That could be the issue with islandora_scholar as well. |
@whikloj looks like that fixed it :) |
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.
Works out of the box, but I ran into some issues when implementing the hook.
'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 comment
The 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
if (count($language_names) == 0) {
* 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 comment
The 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 hook_islandora_ocr_get_ocr_tesseract_languages()
. It is a mouthful, but I think it is required.
'jpn' => t('Japanese'), | ||
'ita' => t('Italian'), | ||
); | ||
$language_names = module_invoke_all('get_ocr_tesseract_languages'); |
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.
I'll also note that the if I implement this hook in modules example1 and example2. Where example1 always returns the word "example1" and example2 always returns "example2". The value of
So we might need to pull only the first returned value (First hook wins) or loop through implementers and overwrite existing values (Last hook wins). |
@megwill4268 are you able to move forward with this? |
@megwill4268 Are you able to make those requested changes? |
I have not had time to work on this. Also have wondered with Islandora 8 if
it was worth the effort anymore.
…On Thu, Jul 11, 2019 at 1:46 PM Don Richards ***@***.***> wrote:
@megwill4268 <https://github.com/megwill4268> Are you able to make those
requested changes?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#98?email_source=notifications&email_token=ADH7WBYUCRZEVWJ3NGUWLTLP655Y3A5CNFSM4G3H7QIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZXUCOY#issuecomment-510607675>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADH7WB2L4IDWVVSJVVUOUE3P655Y3ANCNFSM4G3H7QIA>
.
|
ISLANDORA-2395: https://jira.duraspace.org/browse/ISLANDORA-2395
A hook that allows the human readable language names to be overwritten so users can define their own needed languages.
Related to closed pull request #93
I do have a CLA on file:
https://github.com/Islandora/islandora/wiki/Contributor-License-Agreements