Skip to content

Commit

Permalink
TASK: Localizes exception messages thrown by the package backend
Browse files Browse the repository at this point in the history
  • Loading branch information
markusguenther committed Oct 28, 2024
1 parent f400da8 commit 84b3c95
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { onError } from '@apollo/client/link/error';
import {onError} from '@apollo/client/link/error';

Check failure on line 1 in Resources/Private/JavaScript/media-module/src/core/CreateErrorHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `onError` with `·onError·`

const createErrorHandler = (notify: NeosNotification) => {
const translate = (id, value = null, args = {}, packageKey = 'Flowpack.Media.Ui', source = 'Main') => {
return window.NeosCMS.I18n.translate(id, value, packageKey, source, args);
};

return onError(({ graphQLErrors, networkError }) => {
return onError(({graphQLErrors, networkError}) => {

Check failure on line 8 in Resources/Private/JavaScript/media-module/src/core/CreateErrorHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `graphQLErrors,·networkError` with `·graphQLErrors,·networkError·`
if (graphQLErrors) {
graphQLErrors.map((data) => {
const isInternalError = data.extensions.category === 'internal';
let errorTitleLabel = isInternalError ? 'errors.internal.title' : 'errors.graphql.title';
const defaultErrorTitle = isInternalError ? translate('errors.internal.title', 'Internal server error') : translate('errors.graphql.title', 'Communication error');

Check failure on line 12 in Resources/Private/JavaScript/media-module/src/core/CreateErrorHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `·?·translate('errors.internal.title',·'Internal·server·error')` with `⏎····················?·translate('errors.internal.title',·'Internal·server·error')⏎···················`
let errorMessageLabel = '';
let errorTitleLabel = '';
if (data.extensions.errorCode) {
errorTitleLabel = `errors.${data.extensions.errorCode}.title`;
errorMessageLabel = `errors.${data.extensions.errorCode}.message`;
}

notify.error(
translate(errorTitleLabel),
translate(errorTitleLabel, defaultErrorTitle),
errorMessageLabel.length ? translate(errorMessageLabel) : data.message
);
});
Expand Down
174 changes: 174 additions & 0 deletions Resources/Private/Translations/de/Main.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,180 @@
<target>Gehe zu nächster Seite</target>
</trans-unit>

<!-- error handling -->

<trans-unit id="errors.internal.title" xml:space="preserve" approved="yes">
<source>Internal server error</source>
<target>Interner Serverfehler</target>
</trans-unit>
<trans-unit id="errors.graphql.title" xml:space="preserve" approved="yes">
<source>Communication error</source>
<target>Kommunikationsfehler</target>
</trans-unit>
<trans-unit id="errors.1603921233w.title" xml:space="preserve" approved="yes">
<source>Failed to create tag</source>
<target>Tag-Erstellung fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1603921233.message" xml:space="preserve" approved="yes">
<source>This tag is already exists. Please choose a different one.</source>
<target>Dieser Tag existiert bereits. Bitte wählen Sie einen anderen aus.</target>
</trans-unit>
<trans-unit id="errors.1509632861.message" xml:space="preserve" approved="yes">
<source>The specified asset was not found.</source>
<target>Das angegebene Asset wurde nicht gefunden.</target>
</trans-unit>
<trans-unit id="errors.1678330583.message" xml:space="preserve" approved="yes">
<source>Parent must be an AssetCollection</source>
<target>Übergeordnetes Element muss eine Asset-Sammlung sein</target>
</trans-unit>
<trans-unit id="errors.1678085489.message" xml:space="preserve" approved="yes">
<source>Invalid metadata definition</source>
<target>Ungültige Metadaten-Definition</target>
</trans-unit>
<trans-unit id="errors.1591537315.message" xml:space="preserve" approved="yes">
<source>Failed to delete asset</source>
<target>Asset-Löschung fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1590659044.message" xml:space="preserve" approved="yes">
<source>Cannot update asset that was never imported</source>
<target>Asset kann nicht aktualisiert werden, da es nie importiert wurde</target>
</trans-unit>
<trans-unit id="errors.1590659063.message" xml:space="preserve" approved="yes">
<source>Failed to update asset</source>
<target>Asset-Aktualisierung fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1591561758.message" xml:space="preserve" approved="yes">
<source>Cannot tag asset that was never imported</source>
<target>Asset kann nicht getaggt werden, da es nie importiert wurde</target>
</trans-unit>
<trans-unit id="errors.1619081662.message" xml:space="preserve" approved="yes">
<source>Asset type does not support tagging</source>
<target>Asset-Typ unterstützt keine Tags</target>
</trans-unit>
<trans-unit id="errors.1591561845.message" xml:space="preserve" approved="yes">
<source>Cannot tag asset with tag that does not exist</source>
<target>Asset kann nicht mit einem nicht existierenden Tag versehen werden</target>
</trans-unit>
<trans-unit id="errors.1591561868.message" xml:space="preserve" approved="yes">
<source>Failed to update asset</source>
<target>Asset-Aktualisierung fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1594621322.message" xml:space="preserve" approved="yes">
<source>Cannot tag asset that was never imported</source>
<target>Asset kann nicht getaggt werden, da es nie importiert wurde</target>
</trans-unit>
<trans-unit id="errors.1619081714.message" xml:space="preserve" approved="yes">
<source>Asset type does not support tagging</source>
<target>Asset-Typ unterstützt keine Tags</target>
</trans-unit>
<trans-unit id="errors.1594621318.message" xml:space="preserve" approved="yes">
<source>Cannot tag asset with tag that does not exist</source>
<target>Asset kann nicht mit einem nicht existierenden Tag versehen werden</target>
</trans-unit>
<trans-unit id="errors.1594621296.message" xml:space="preserve" approved="yes">
<source>Failed to set asset tags</source>
<target>Setzen der Asset-Tags fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1594621322.message" xml:space="preserve" approved="yes">
<source>Cannot assign collections to asset that was never imported</source>
<target>Sammlungen können nicht zu einem Asset zugewiesen werden, das nie importiert wurde</target>
</trans-unit>
<trans-unit id="errors.1619081722.message" xml:space="preserve" approved="yes">
<source>Asset type does not support collections</source>
<target>Asset-Typ unterstützt keine Sammlungen</target>
</trans-unit>
<trans-unit id="errors.1594621318.message" xml:space="preserve" approved="yes">
<source>Cannot assign non existing assign collection to asset</source>
<target>Nicht existierende Sammlung kann nicht zugewiesen werden</target>
</trans-unit>
<trans-unit id="errors.1594621296.message" xml:space="preserve" approved="yes">
<source>Failed to assign asset collections</source>
<target>Zuweisung der Asset-Sammlungen fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1591561930.message" xml:space="preserve" approved="yes">
<source>Cannot untag asset that was never imported</source>
<target>Asset kann nicht ungetaggt werden, da es nie importiert wurde</target>
</trans-unit>
<trans-unit id="errors.1619081740.message" xml:space="preserve" approved="yes">
<source>Asset type does not support tagging</source>
<target>Asset-Typ unterstützt keine Tags</target>
</trans-unit>
<trans-unit id="errors.1591561934.message" xml:space="preserve" approved="yes">
<source>Cannot untag asset from tag that does not exist</source>
<target>Asset kann nicht von einem nicht existierenden Tag entfernt werden</target>
</trans-unit>
<trans-unit id="errors.1591561938.message" xml:space="preserve" approved="yes">
<source>Failed to update asset</source>
<target>Asset-Aktualisierung fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1678113903.message" xml:space="preserve" approved="yes">
<source>No proxy found for asset</source>
<target>Kein Proxy für Asset gefunden</target>
</trans-unit>
<trans-unit id="errors.1648046173.message" xml:space="preserve" approved="yes">
<source>Cannot replace asset that was never imported</source>
<target>Asset kann nicht ersetzt werden, da es nie importiert wurde</target>
</trans-unit>
<trans-unit id="errors.1648046186.message" xml:space="preserve" approved="yes">
<source>Asset type does not support replacing</source>
<target>Asset-Typ unterstützt kein Ersetzen</target>
</trans-unit>
<trans-unit id="errors.1678156902.message" xml:space="preserve" approved="yes">
<source>Filename was empty</source>
<target>Dateiname war leer</target>
</trans-unit>
<trans-unit id="errors.1678113903.message" xml:space="preserve" approved="yes">
<source>No proxy found for asset</source>
<target>Kein Proxy für Asset gefunden</target>
</trans-unit>
<trans-unit id="errors.1678155884.message" xml:space="preserve" approved="yes">
<source>Cannot rename asset that was never imported</source>
<target>Asset kann nicht umbenannt werden, da es nie importiert wurde</target>
</trans-unit>
<trans-unit id="errors.1678155887.message" xml:space="preserve" approved="yes">
<source>Asset type does not support renaming</source>
<target>Asset-Typ unterstützt kein Umbenennen</target>
</trans-unit>
<trans-unit id="errors.1591972264.message" xml:space="preserve" approved="yes">
<source>Could not import asset</source>
<target>Asset konnte nicht importiert werden</target>
</trans-unit>
<trans-unit id="errors.1591972269.message" xml:space="preserve" approved="yes">
<source>Asset collection not found</source>
<target>Asset-Collection nicht gefunden</target>
</trans-unit>
<trans-unit id="errors.1590659045.message" xml:space="preserve" approved="yes">
<source>Asset collection not found</source>
<target>Asset-Collection nicht gefunden</target>
</trans-unit>
<trans-unit id="errors.1594621319.message" xml:space="preserve" approved="yes">
<source>Cannot tag asset collection with tag that does not exist</source>
<target>Asset-Collection kann nicht mit einem nicht existierenden Tag versehen werden</target>
</trans-unit>
<trans-unit id="errors.1681999816.message" xml:space="preserve" approved="yes">
<source>Asset collection not found</source>
<target>Asset-Collection nicht gefunden</target>
</trans-unit>
<trans-unit id="errors.1681999836.message" xml:space="preserve" approved="yes">
<source>Parent asset collection not found</source>
<target>Übergeordnete Asset-Collection nicht gefunden</target>
</trans-unit>
<trans-unit id="errors.1590659046.message" xml:space="preserve" approved="yes">
<source>Tag not found</source>
<target>Tag nicht gefunden</target>
</trans-unit>
<trans-unit id="errors.1591553709.message" xml:space="preserve" approved="yes">
<source>Tag not found</source>
<target>Tag nicht gefunden</target>
</trans-unit>
<trans-unit id="errors.1669221347.message" xml:space="preserve" approved="yes">
<source>Not supported: AssetProxyQueryInterface::setLimit does not accept `null`.</source>
<target>Nicht unterstützt: AssetProxyQueryInterface::setLimit akzeptiert kein `null`.</target>
</trans-unit>
<trans-unit id="errors.1619178077.message" xml:space="preserve" approved="yes">
<source>This method requires "flowpack/entity-usage-databasestorage" to be installed.'</source>
<target>Diese Methode erfordert die Installation von "flowpack/entity-usage-databasestorage".</target>
</trans-unit>
</body>
</file>
</xliff>
Loading

0 comments on commit 84b3c95

Please sign in to comment.