Skip to content
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

Feature/adf 1789/side by side authoring #4119

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public function getByRequest(ServerRequestInterface $request): ResourceCollectio
throw new ResourceTranslationException('Resource id is required');
}

return $this->resourceTranslationRepository->find(new ResourceTranslationQuery([$id], $languageUri));
if (!is_array($id)) {
$id = explode(',', $id);
}
return $this->resourceTranslationRepository->find(new ResourceTranslationQuery($id, $languageUri));
}
}
20 changes: 16 additions & 4 deletions views/js/services/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,25 @@ define(['i18n', 'core/request', 'util/url'], function (__, request, urlUtil) {

/**
* Queries the list of translations for a resource.
* @param {string} id - The URI of the resource.
* @param {function} [filter] - A filter function for the translations.
* @param {string|string[]} id - The URI of the resource. It may also be a list of URIs, but in this case the languageUri must also be provided.
* @param {string|function} [languageUri] - The URI of the language to filter the translations. It may also be a filter function.
* @param {function} [filter] - A filter function for the translations. When not provided through the languageUri parameter.
* @returns {Promise<ResourceList>}
*/
getTranslations(id, filter) {
getTranslations(id, languageUri, filter) {
if (Array.isArray(id)) {
id = id.join(',');
}
const params = { id };
if (languageUri) {
if ('function' === typeof languageUri) {
filter = languageUri;
} else {
params.languageUri = languageUri;
}
}
return request({
url: urlUtil.route('translations', 'Translation', 'tao', { id }),
url: urlUtil.route('translations', 'Translation', 'tao', params),
method: 'GET',
noToken: true
})
Expand Down