Merge pull request #12984 from MrPetovan/bug/12983-dropzone-translation

[frio] Add Dropzone dictionary strings to l10n
This commit is contained in:
Philipp 2023-04-09 15:34:36 +02:00 committed by GitHub
commit a74bb57298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 165 additions and 69 deletions

View File

@ -243,22 +243,40 @@ class Page implements ArrayAccess
* being first
*/
$this->page['htmlhead'] = Renderer::replaceMacros($tpl, [
'$l10n' => [
'delitem' => $l10n->t('Delete this item?'),
'blockAuthor' => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
'ignoreAuthor' => $l10n->t('Ignore this author? You won\'t be able to see their posts and their notifications.'),
'likeError' => $l10n->t('Like not successful'),
'dislikeError' => $l10n->t('Dislike not successful'),
'announceError' => $l10n->t('Sharing not successful'),
'attendError' => $l10n->t('Attendance unsuccessful'),
'srvError' => $l10n->t('Backend error'),
'netError' => $l10n->t('Network error'),
// Dropzone
'dictDefaultMessage' => $l10n->t('Drop files here to upload'),
'dictFallbackMessage' => $l10n->t("Your browser does not support drag and drop file uploads."),
'dictFallbackText' => $l10n->t('Please use the fallback form below to upload your files like in the olden days.'),
'dictFileTooBig' => $l10n->t('File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.'),
'dictInvalidFileType' => $l10n->t("You can't upload files of this type."),
'dictResponseError' => $l10n->t('Server responded with {{statusCode}} code.'),
'dictCancelUpload' => $l10n->t('Cancel upload'),
'dictUploadCanceled' => $l10n->t('Upload canceled.'),
'dictCancelUploadConfirmation' => $l10n->t('Are you sure you want to cancel this upload?'),
'dictRemoveFile' => $l10n->t('Remove file'),
'dictMaxFilesExceeded' => $l10n->t("You can't upload any more files."),
],
'$local_user' => $localUID,
'$generator' => 'Friendica' . ' ' . App::VERSION,
'$delitem' => $l10n->t('Delete this item?'),
'$blockAuthor' => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
'$ignoreAuthor' => $l10n->t('Ignore this author? You won\'t be able to see their posts and their notifications.'),
'$update_interval' => $interval,
'$shortcut_icon' => $shortcut_icon,
'$touch_icon' => $touch_icon,
'$block_public' => intval($config->get('system', 'block_public')),
'$stylesheets' => $this->stylesheets,
'$likeError' => $l10n->t('Like not successful'),
'$dislikeError' => $l10n->t('Dislike not successful'),
'$announceError' => $l10n->t('Sharing not successful'),
'$attendError' => $l10n->t('Attendance unsuccessful'),
'$srvError' => $l10n->t('Backend error'),
'$netError' => $l10n->t('Network error'),
// Dropzone
'$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand($config->get('system', 'maximagesize')) / 1000000, 1),

View File

@ -1,4 +1,5 @@
var DzFactory = function () {
Dropzone.autoDiscover = false;
var DzFactory = function (max_imagesize) {
this.createDropzone = function(dropSelector, textareaElementId) {
return new Dropzone(dropSelector, {
paramName: 'userfile', // The name that will be used to transfer the file
@ -6,6 +7,17 @@ var DzFactory = function () {
url: '/media/photo/upload?album=',
acceptedFiles: 'image/*',
clickable: true,
dictDefaultMessage: dzStrings.dictDefaultMessage,
dictFallbackMessage: dzStrings.dictFallbackMessage,
dictFallbackText: dzStrings.dictFallbackText,
dictFileTooBig: dzStrings.dictFileTooBig,
dictInvalidFileType: dzStrings.dictInvalidFileType,
dictResponseError: dzStrings.dictResponseError,
dictCancelUpload: dzStrings.dictCancelUpload,
dictUploadCanceled: dzStrings.dictUploadCanceled,
dictCancelUploadConfirmation: dzStrings.dictCancelUploadConfirmation,
dictRemoveFile: dzStrings.dictRemoveFile,
dictMaxFilesExceeded: dzStrings.dictMaxFilesExceeded,
accept: function(file, done) {
done();
},
@ -54,9 +66,10 @@ var DzFactory = function () {
};
this.setupDropzone = function(dropSelector, textareaElementId) {
const self = this;
var dropzone = this.createDropzone(dropSelector, textareaElementId);
$(dropSelector).on('paste', function(event) {
dzFactory.copyPaste(event, dropzone);
self.copyPaste(event, dropzone);
})
};
}

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2023.03-rc\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-02 09:34+0000\n"
"POT-Creation-Date: 2023-04-09 08:27-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -657,47 +657,93 @@ msgstr ""
msgid "Apologies but the website is unavailable at the moment."
msgstr ""
#: src/App/Page.php:248
#: src/App/Page.php:247
msgid "Delete this item?"
msgstr ""
#: src/App/Page.php:249
#: src/App/Page.php:248
msgid ""
"Block this author? They won't be able to follow you nor see your public "
"posts, and you won't be able to see their posts and their notifications."
msgstr ""
#: src/App/Page.php:250
#: src/App/Page.php:249
msgid ""
"Ignore this author? You won't be able to see their posts and their "
"notifications."
msgstr ""
#: src/App/Page.php:256
#: src/App/Page.php:251
msgid "Like not successful"
msgstr ""
#: src/App/Page.php:257
#: src/App/Page.php:252
msgid "Dislike not successful"
msgstr ""
#: src/App/Page.php:258
#: src/App/Page.php:253
msgid "Sharing not successful"
msgstr ""
#: src/App/Page.php:259
#: src/App/Page.php:254
msgid "Attendance unsuccessful"
msgstr ""
#: src/App/Page.php:260
#: src/App/Page.php:255
msgid "Backend error"
msgstr ""
#: src/App/Page.php:261
#: src/App/Page.php:256
msgid "Network error"
msgstr ""
#: src/App/Page.php:329
#: src/App/Page.php:259
msgid "Drop files here to upload"
msgstr ""
#: src/App/Page.php:260
msgid "Your browser does not support drag and drop file uploads."
msgstr ""
#: src/App/Page.php:261
msgid ""
"Please use the fallback form below to upload your files like in the olden "
"days."
msgstr ""
#: src/App/Page.php:262
msgid "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB."
msgstr ""
#: src/App/Page.php:263
msgid "You can't upload files of this type."
msgstr ""
#: src/App/Page.php:264
msgid "Server responded with {{statusCode}} code."
msgstr ""
#: src/App/Page.php:265
msgid "Cancel upload"
msgstr ""
#: src/App/Page.php:266
msgid "Upload canceled."
msgstr ""
#: src/App/Page.php:267
msgid "Are you sure you want to cancel this upload?"
msgstr ""
#: src/App/Page.php:268
msgid "Remove file"
msgstr ""
#: src/App/Page.php:269
msgid "You can't upload any more files."
msgstr ""
#: src/App/Page.php:347
msgid "toggle mobile"
msgstr ""
@ -1550,7 +1596,7 @@ msgstr ""
msgid "show more"
msgstr ""
#: src/Content/Item.php:326 src/Model/Item.php:2906
#: src/Content/Item.php:326 src/Model/Item.php:2913
msgid "event"
msgstr ""
@ -1558,7 +1604,7 @@ msgstr ""
msgid "status"
msgstr ""
#: src/Content/Item.php:335 src/Model/Item.php:2908
#: src/Content/Item.php:335 src/Model/Item.php:2915
#: src/Module/Post/Tag/Add.php:123
msgid "photo"
msgstr ""
@ -1953,39 +1999,39 @@ msgstr ""
msgid "last"
msgstr ""
#: src/Content/Text/BBCode.php:712 src/Content/Text/BBCode.php:1596
#: src/Content/Text/BBCode.php:1597
#: src/Content/Text/BBCode.php:713 src/Content/Text/BBCode.php:1599
#: src/Content/Text/BBCode.php:1600
msgid "Image/photo"
msgstr ""
#: src/Content/Text/BBCode.php:930
#: src/Content/Text/BBCode.php:931
#, php-format
msgid ""
"<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
msgstr ""
#: src/Content/Text/BBCode.php:955 src/Model/Item.php:3587
#: src/Model/Item.php:3593 src/Model/Item.php:3594
#: src/Content/Text/BBCode.php:956 src/Model/Item.php:3598
#: src/Model/Item.php:3604 src/Model/Item.php:3605
msgid "Link to source"
msgstr ""
#: src/Content/Text/BBCode.php:1503 src/Content/Text/HTML.php:902
#: src/Content/Text/BBCode.php:1506 src/Content/Text/HTML.php:902
msgid "Click to open/close"
msgstr ""
#: src/Content/Text/BBCode.php:1536
#: src/Content/Text/BBCode.php:1539
msgid "$1 wrote:"
msgstr ""
#: src/Content/Text/BBCode.php:1601 src/Content/Text/BBCode.php:1602
#: src/Content/Text/BBCode.php:1604 src/Content/Text/BBCode.php:1605
msgid "Encrypted content"
msgstr ""
#: src/Content/Text/BBCode.php:1867
#: src/Content/Text/BBCode.php:1881
msgid "Invalid source protocol"
msgstr ""
#: src/Content/Text/BBCode.php:1886
#: src/Content/Text/BBCode.php:1900
msgid "Invalid link protocol"
msgstr ""
@ -3134,81 +3180,81 @@ msgstr ""
msgid "Edit groups"
msgstr ""
#: src/Model/Item.php:2007
#: src/Model/Item.php:2014
#, php-format
msgid "Detected languages in this post:\\n%s"
msgstr ""
#: src/Model/Item.php:2910
#: src/Model/Item.php:2917
msgid "activity"
msgstr ""
#: src/Model/Item.php:2912
#: src/Model/Item.php:2919
msgid "comment"
msgstr ""
#: src/Model/Item.php:2915 src/Module/Post/Tag/Add.php:123
#: src/Model/Item.php:2922 src/Module/Post/Tag/Add.php:123
msgid "post"
msgstr ""
#: src/Model/Item.php:3073
#: src/Model/Item.php:3084
#, php-format
msgid "%s is blocked"
msgstr ""
#: src/Model/Item.php:3075
#: src/Model/Item.php:3086
#, php-format
msgid "%s is ignored"
msgstr ""
#: src/Model/Item.php:3077
#: src/Model/Item.php:3088
#, php-format
msgid "Content from %s is collapsed"
msgstr ""
#: src/Model/Item.php:3081
#: src/Model/Item.php:3092
#, php-format
msgid "Content warning: %s"
msgstr ""
#: src/Model/Item.php:3499
#: src/Model/Item.php:3510
msgid "bytes"
msgstr ""
#: src/Model/Item.php:3530
#: src/Model/Item.php:3541
#, php-format
msgid "%2$s (%3$d%%, %1$d vote)"
msgid_plural "%2$s (%3$d%%, %1$d votes)"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3532
#: src/Model/Item.php:3543
#, php-format
msgid "%2$s (%1$d vote)"
msgid_plural "%2$s (%1$d votes)"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3537
#: src/Model/Item.php:3548
#, php-format
msgid "%d voter. Poll end: %s"
msgid_plural "%d voters. Poll end: %s"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3539
#: src/Model/Item.php:3550
#, php-format
msgid "%d voter."
msgid_plural "%d voters."
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3541
#: src/Model/Item.php:3552
#, php-format
msgid "Poll end: %s"
msgstr ""
#: src/Model/Item.php:3575 src/Model/Item.php:3576
#: src/Model/Item.php:3586 src/Model/Item.php:3587
msgid "View on separate page"
msgstr ""

View File

@ -44,7 +44,12 @@
<script type="text/javascript" src="view/asset/imagesloaded/imagesloaded.pkgd.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript" src="view/asset/base64/base64.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript" src="view/asset/dompurify/dist/purify.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript">
const updateInterval = {{$update_interval}};
const localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
</script>
<script type="text/javascript" src="view/js/main.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script>
// Lifted from https://css-tricks.com/snippets/jquery/move-cursor-to-end-of-textarea-or-input/

View File

@ -103,6 +103,10 @@
<script type="text/javascript" src="view/asset/base64/base64.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript" src="view/asset/dompurify/dist/purify.min.js?v={{$smarty.const.FRIENDICA_VERSION}}">
</script>
<script type="text/javascript">
const updateInterval = {{$update_interval}};
const localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
</script>
<script type="text/javascript" src="view/js/main.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript"
@ -139,7 +143,7 @@
<script type="text/javascript" src="view/theme/frio/js/textedit.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript" src="vendor/enyo/dropzone/dist/min/dropzone.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript" src="view/js/dropzone-factory.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript"> max_imagesize = {{$max_imagesize}}; var dzFactory = new DzFactory(); Dropzone.autoDiscover = false; </script>
<script type="text/javascript"> const dzFactory = new DzFactory({{$max_imagesize}});</script>
{{* Include the strings which are needed for some js functions (e.g. translation)
They are loaded into the html <head> so that js functions can use them *}}

View File

@ -2,24 +2,34 @@
{{* Strings which are needed for some js functions (e.g. translation or the interval for page update)
They are loaded into the html <head> so that js functions can use them *}}
<script type="text/javascript">
var updateInterval = {{$update_interval}};
var localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
var aStr = {
'delitem' : "{{$delitem|escape:'javascript' nofilter}}",
'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}",
'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}",
const aStr = {
delitem : "{{$l10n.delitem|escape:'javascript' nofilter}}",
blockAuthor : "{{$l10n.blockAuthor|escape:'javascript' nofilter}}",
ignoreAuthor : "{{$l10n.ignoreAuthor|escape:'javascript' nofilter}}",
};
const aActErr = {
like : "{{$l10n.likeError|escape:'javascript' nofilter}}",
dislike : "{{$l10n.dislikeError|escape:'javascript' nofilter}}",
announce : "{{$l10n.announceError|escape:'javascript' nofilter}}",
attendyes : "{{$l10n.attendError|escape:'javascript' nofilter}}",
attendno : "{{$l10n.attendError|escape:'javascript' nofilter}}",
attendmaybe: "{{$l10n.attendError|escape:'javascript' nofilter}}",
};
const aErrType = {
srvErr: "{{$l10n.srvError|escape:'javascript' nofilter}}",
netErr: "{{$l10n.netError|escape:'javascript' nofilter}}",
};
const dzStrings = {
dictDefaultMessage : "{{$l10n.dictDefaultMessage|escape:'javascript' nofilter}}",
dictFallbackMessage : "{{$l10n.dictFallbackMessage|escape:'javascript' nofilter}}",
dictFallbackText : "{{$l10n.dictFallbackText|escape:'javascript' nofilter}}",
dictFileTooBig : "{{$l10n.dictFileTooBig|escape:'javascript' nofilter}}",
dictInvalidFileType : "{{$l10n.dictInvalidFileType|escape:'javascript' nofilter}}",
dictResponseError : "{{$l10n.dictResponseError|escape:'javascript' nofilter}}",
dictCancelUpload : "{{$l10n.dictCancelUpload|escape:'javascript' nofilter}}",
dictUploadCanceled : "{{$l10n.dictUploadCanceled|escape:'javascript' nofilter}}",
dictCancelUploadConfirmation: "{{$l10n.dictCancelUploadConfirmation|escape:'javascript' nofilter}}",
dictRemoveFile : "{{$l10n.dictRemoveFile|escape:'javascript' nofilter}}",
dictMaxFilesExceeded : "{{$l10n.dictMaxFilesExceeded|escape:'javascript' nofilter}}",
};
var aActErr = {
'like' : "{{$likeError}}",
'dislike' : "{{$dislikeError}}",
'announce' : "{{$announceError}}",
'attendyes' : "{{$attendError}}",
'attendno' : "{{$attendError}}",
'attendmaybe' : "{{$attendError}}",
};
var aErrType = {
'srvErr' : "{{$srvError}}",
'netErr' : "{{$netError}}",
};
</script>