-
Notifications
You must be signed in to change notification settings - Fork 917
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
Submission and metadata languages separated from UI and form languages #4040
Conversation
Hey @asmecher, I have PRs ready for review of the code... PKP: pkp/pkp-lib#9309 |
I will take/am taking a look... It will take some time because I would also like to test it locally... |
@jyhein, could we not user the journal primary locale for |
And maybe one more question right away, for me to understand it better when looking into the code:
EDIT: |
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.
Thanks a lot, great work @jyhein!
classes/install/Upgrade.php
Outdated
// supportedFormLocales, supportedLocales, supportedSubmissionLocales | ||
$settingNames = "('supportedFormLocales', 'supportedLocales', 'supportedSubmissionLocales')"; | ||
// supportedFormLocales, supportedLocales, supportedAddedSubmissionLocales, supportedSubmissionLocales, supportedDefaultSubmissionLocale, supportedSubmissionMetadataLocales | ||
$settingNames = "('supportedFormLocales', 'supportedLocales', 'supportedAddedSubmissionLocales', 'supportedSubmissionLocales', 'supportedDefaultSubmissionLocale', 'supportedSubmissionMetadataLocales')"; |
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.
This upgrade function will only be executed for journals using version 3.1. Thus they will not have those settings, so I think this should not be considered here.
classes/publication/Repository.php
Outdated
$primaryLocale = $submission->getLocale(); | ||
$primaryLocale = $submission->getData('locale'); | ||
$allowedLocales = $context->getSupportedSubmissionMetadataLocales(); | ||
in_array($primaryLocale, $allowedLocales) || array_push($allowedLocales, $primaryLocale); |
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.
It is more readable to use if
statement:
if (!in_array($primaryLocale, $allowedLocales) ) { array_push($allowedLocales, $primaryLocale); }
Here and everywhere else in the code.
pages/workflow/WorkflowHandler.php
Outdated
@@ -85,8 +85,9 @@ public function setupIndex($request) | |||
$submissionContext = Services::get('context')->get($submission->getContextId()); | |||
} | |||
|
|||
$locales = $submissionContext->getSupportedSubmissionLocaleNames(); | |||
$locales = $submissionContext->getSupportedSubmissionMetadataLocaleNames() + [$submission->getData('locale') => (new \PKP\i18n\LocaleMetadata($submission->getData('locale')))->getDisplayName(null, false)]; |
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.
Use:
use PKP\i18n\LocaleMetadata;
at the beginning of the file.
Hey @bozana, |
695c29c
to
24ead38
Compare
classes/publication/Repository.php
Outdated
$allowedLocales = $context->getSupportedSubmissionLocales(); | ||
$primaryLocale = $submission->getLocale(); | ||
$primaryLocale = $submission->getData('locale'); | ||
$allowedLocales = array_values(array_unique(array_merge($context->getSupportedSubmissionMetadataLocales(), $publication?->getLanguages() ?? [$primaryLocale]))); |
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.
This is already considered in the parent::validate() or?
@@ -62,17 +62,15 @@ public function __construct($request, $submission, $publication, $articleGalley | |||
$this->addCheck(new \PKP\form\validation\FormValidatorCSRF($this)); | |||
|
|||
// Ensure a locale is provided and valid | |||
$journal = $request->getJournal(); | |||
$locales = $request->getJournal()->getSupportedSubmissionMetadataLocaleNames() + $publication->getLanguageNames(); |
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 galley's locale, that has been removed, is not considered here, and maybe somewhere else too.
For example, this scenario:
EN, DE and FR are selected as submission locales.
Author submits an article in EN, with EN metadata.
Editor creates later a galley in DE, without entering DE metadata.
DE is removed as metadata locale (that means also as submission locale).
The galley in DE can not be edited correctly, its earlier locale is not considered.
I.e. galleys are connected with allowed submission locales -- a galley can be created in any enabled submission locale. It could happen -- probably rarely, but it could happen -- that there is only galley (and no metadata) in a different language than the submission primary language.
(The galleys locales tell us in which language a submission exists -- relevant to the removal of the DC language metadata field).
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.
Should I add galleys/ publication formats (omp) locales to PKPPublication getLanguages-function then they would always be included ?
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.
Hmmm... Now that I think about it...
I think galley locale can only be one of supportedSubmissionLocales, and not getSupportedSubmissionMetadataLocales. In order to consider the removed locales, the galley forms need to consider galleys locales too.
I like the idea of having everything at one place, in that function getLanguages(), also the galleys locales. The function however is then only relevant for metadata and not for galleys forms, I think... 🤔
3988aaa
to
2bd33bd
Compare
162366e
to
2994581
Compare
38dfc02
to
29aec7b
Compare
$this->addCheck( | ||
new \PKP\form\validation\FormValidator( | ||
$this, | ||
'locale', | ||
'required', | ||
'editor.issues.galleyLocaleRequired' | ||
), | ||
function ($locale) use ($journal) { |
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.
I think this is not correct: addCheck only accepts one parameter, so I think this would need to be FormValidatorCustom, that will then have this function as parameter.
Could you please change it?
51ef640
to
10aecc6
Compare
…m website language settings
In Website Settings > Setup > Languages and in Administration > Hosted Journals > Settings Wizard > Journal Settings > Languages, separate Website Languages and Submission Languages settings. In the website languages are UI and Forms, and in the submission languages are submission and metadata.
Submission metadata can be edited even if metadata isn't checked in that language in the settings.