Skip to content

Commit

Permalink
Update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
ArrayIterator committed Oct 15, 2023
1 parent 2283e5f commit 99f6d1e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
36 changes: 35 additions & 1 deletion Languages/media-module.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: TrayDigita Media Module 1.0.0\n"
"POT-Creation-Date: 2023-10-16 00:01+0700\n"
"POT-Creation-Date: 2023-10-16 01:39+0700\n"
"PO-Revision-Date: 2023-09-24 19:00+0700\n"
"Last-Translator: ArrayAccess\n"
"Language-Team: ArrayAccess\n"
Expand All @@ -25,3 +25,37 @@ msgstr ""
"X-Poedit-SearchPathExcluded-0: *.css\n"
"X-Poedit-SearchPathExcluded-1: *.html\n"
"X-Poedit-SearchPathExcluded-2: *.json\n"

#: Media.php:45
msgctxt "module"
msgid "Media Manager"
msgstr ""

#: Media.php:54
msgctxt "module"
msgid ""
"Module to make application support media & file "
"attachments"
msgstr ""

#: Uploader/Abstracts/AbstractUploader.php:126
msgctxt "module"
msgid "File does not have file name"
msgstr ""

#: Uploader/Abstracts/AbstractUploader.php:141
#, php-format
msgctxt "module"
msgid "Could not determine file type from mimetype %s"
msgstr ""

#: Uploader/Abstracts/AbstractUploader.php:221
msgctxt "module"
msgid "Could not save uploaded file"
msgstr ""

#: Uploader/Abstracts/AbstractUploader.php:233
msgctxt "module"
msgid ""
"Could not save uploaded file & determine target file."
msgstr ""
26 changes: 21 additions & 5 deletions Uploader/Abstracts/AbstractUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function getMedia(): Media

/**
* @throws Throwable
* @noinspection PhpUnused
*/
public function uploadAvatar(
ServerRequestInterface $request,
Expand All @@ -74,6 +75,7 @@ public function uploadAvatar(

/**
* @throws Throwable
* @noinspection PhpUnused
*/
public function uploadData(
ServerRequestInterface $request,
Expand Down Expand Up @@ -120,7 +122,11 @@ public function uploadAttachment(
};
if (!$uploadedFile->getClientFilename()) {
throw new UploadedFileNameException(
$this->translate('File does not have file name')
$this->translateContext(
'File does not have file name',
'module',
'media-module'
)
);
}
$extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION);
Expand All @@ -131,7 +137,11 @@ public function uploadAttachment(
if (!$extension) {
throw new UploadedFileExtensionException(
sprintf(
$this->translate('Could not determine file type from mimetype %s'),
$this->translateContext(
'Could not determine file type from mimetype %s',
'module',
'media-module'
),
$uploadedFile->getClientMediaType()
)
);
Expand Down Expand Up @@ -207,16 +217,22 @@ function_exists('mime_content_type')
if (!$fullPath) {
$progress->deletePartial();
throw new RuntimeException(
$this->translate('Could not save uploaded file')
$this->translateContext(
'Could not save uploaded file',
'module',
'media-module'
)
);
}

$basePath = $this->media->getAttachmentFileToBasePath($fullPath);
if (!$basePath) {
Consolidation::callbackReduceError(fn () => unlink($fullPath));
throw new RuntimeException(
$this->translate(
'Could not save uploaded file & determine target file.'
$this->translateContext(
'Could not save uploaded file & determine target file.',
'module',
'media-module'
)
);
}
Expand Down

0 comments on commit 99f6d1e

Please sign in to comment.