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 * being first
*/ */
$this->page['htmlhead'] = Renderer::replaceMacros($tpl, [ $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, '$local_user' => $localUID,
'$generator' => 'Friendica' . ' ' . App::VERSION, '$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, '$update_interval' => $interval,
'$shortcut_icon' => $shortcut_icon, '$shortcut_icon' => $shortcut_icon,
'$touch_icon' => $touch_icon, '$touch_icon' => $touch_icon,
'$block_public' => intval($config->get('system', 'block_public')), '$block_public' => intval($config->get('system', 'block_public')),
'$stylesheets' => $this->stylesheets, '$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 // Dropzone
'$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand($config->get('system', 'maximagesize')) / 1000000, 1), '$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) { this.createDropzone = function(dropSelector, textareaElementId) {
return new Dropzone(dropSelector, { return new Dropzone(dropSelector, {
paramName: 'userfile', // The name that will be used to transfer the file paramName: 'userfile', // The name that will be used to transfer the file
@ -6,6 +7,17 @@ var DzFactory = function () {
url: '/media/photo/upload?album=', url: '/media/photo/upload?album=',
acceptedFiles: 'image/*', acceptedFiles: 'image/*',
clickable: true, 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) { accept: function(file, done) {
done(); done();
}, },
@ -54,9 +66,10 @@ var DzFactory = function () {
}; };
this.setupDropzone = function(dropSelector, textareaElementId) { this.setupDropzone = function(dropSelector, textareaElementId) {
const self = this;
var dropzone = this.createDropzone(dropSelector, textareaElementId); var dropzone = this.createDropzone(dropSelector, textareaElementId);
$(dropSelector).on('paste', function(event) { $(dropSelector).on('paste', function(event) {
dzFactory.copyPaste(event, dropzone); self.copyPaste(event, dropzone);
}) })
}; };
} }

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2023.03-rc\n" "Project-Id-Version: 2023.03-rc\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -657,47 +657,93 @@ msgstr ""
msgid "Apologies but the website is unavailable at the moment." msgid "Apologies but the website is unavailable at the moment."
msgstr "" msgstr ""
#: src/App/Page.php:248 #: src/App/Page.php:247
msgid "Delete this item?" msgid "Delete this item?"
msgstr "" msgstr ""
#: src/App/Page.php:249 #: src/App/Page.php:248
msgid "" msgid ""
"Block this author? They won't be able to follow you nor see your public " "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." "posts, and you won't be able to see their posts and their notifications."
msgstr "" msgstr ""
#: src/App/Page.php:250 #: src/App/Page.php:249
msgid "" msgid ""
"Ignore this author? You won't be able to see their posts and their " "Ignore this author? You won't be able to see their posts and their "
"notifications." "notifications."
msgstr "" msgstr ""
#: src/App/Page.php:256 #: src/App/Page.php:251
msgid "Like not successful" msgid "Like not successful"
msgstr "" msgstr ""
#: src/App/Page.php:257 #: src/App/Page.php:252
msgid "Dislike not successful" msgid "Dislike not successful"
msgstr "" msgstr ""
#: src/App/Page.php:258 #: src/App/Page.php:253
msgid "Sharing not successful" msgid "Sharing not successful"
msgstr "" msgstr ""
#: src/App/Page.php:259 #: src/App/Page.php:254
msgid "Attendance unsuccessful" msgid "Attendance unsuccessful"
msgstr "" msgstr ""
#: src/App/Page.php:260 #: src/App/Page.php:255
msgid "Backend error" msgid "Backend error"
msgstr "" msgstr ""
#: src/App/Page.php:261 #: src/App/Page.php:256
msgid "Network error" msgid "Network error"
msgstr "" 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" msgid "toggle mobile"
msgstr "" msgstr ""
@ -1550,7 +1596,7 @@ msgstr ""
msgid "show more" msgid "show more"
msgstr "" msgstr ""
#: src/Content/Item.php:326 src/Model/Item.php:2906 #: src/Content/Item.php:326 src/Model/Item.php:2913
msgid "event" msgid "event"
msgstr "" msgstr ""
@ -1558,7 +1604,7 @@ msgstr ""
msgid "status" msgid "status"
msgstr "" 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 #: src/Module/Post/Tag/Add.php:123
msgid "photo" msgid "photo"
msgstr "" msgstr ""
@ -1953,39 +1999,39 @@ msgstr ""
msgid "last" msgid "last"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:712 src/Content/Text/BBCode.php:1596 #: src/Content/Text/BBCode.php:713 src/Content/Text/BBCode.php:1599
#: src/Content/Text/BBCode.php:1597 #: src/Content/Text/BBCode.php:1600
msgid "Image/photo" msgid "Image/photo"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:930 #: src/Content/Text/BBCode.php:931
#, php-format #, php-format
msgid "" msgid ""
"<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s" "<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:955 src/Model/Item.php:3587 #: src/Content/Text/BBCode.php:956 src/Model/Item.php:3598
#: src/Model/Item.php:3593 src/Model/Item.php:3594 #: src/Model/Item.php:3604 src/Model/Item.php:3605
msgid "Link to source" msgid "Link to source"
msgstr "" 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" msgid "Click to open/close"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1536 #: src/Content/Text/BBCode.php:1539
msgid "$1 wrote:" msgid "$1 wrote:"
msgstr "" 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" msgid "Encrypted content"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1867 #: src/Content/Text/BBCode.php:1881
msgid "Invalid source protocol" msgid "Invalid source protocol"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1886 #: src/Content/Text/BBCode.php:1900
msgid "Invalid link protocol" msgid "Invalid link protocol"
msgstr "" msgstr ""
@ -3134,81 +3180,81 @@ msgstr ""
msgid "Edit groups" msgid "Edit groups"
msgstr "" msgstr ""
#: src/Model/Item.php:2007 #: src/Model/Item.php:2014
#, php-format #, php-format
msgid "Detected languages in this post:\\n%s" msgid "Detected languages in this post:\\n%s"
msgstr "" msgstr ""
#: src/Model/Item.php:2910 #: src/Model/Item.php:2917
msgid "activity" msgid "activity"
msgstr "" msgstr ""
#: src/Model/Item.php:2912 #: src/Model/Item.php:2919
msgid "comment" msgid "comment"
msgstr "" 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" msgid "post"
msgstr "" msgstr ""
#: src/Model/Item.php:3073 #: src/Model/Item.php:3084
#, php-format #, php-format
msgid "%s is blocked" msgid "%s is blocked"
msgstr "" msgstr ""
#: src/Model/Item.php:3075 #: src/Model/Item.php:3086
#, php-format #, php-format
msgid "%s is ignored" msgid "%s is ignored"
msgstr "" msgstr ""
#: src/Model/Item.php:3077 #: src/Model/Item.php:3088
#, php-format #, php-format
msgid "Content from %s is collapsed" msgid "Content from %s is collapsed"
msgstr "" msgstr ""
#: src/Model/Item.php:3081 #: src/Model/Item.php:3092
#, php-format #, php-format
msgid "Content warning: %s" msgid "Content warning: %s"
msgstr "" msgstr ""
#: src/Model/Item.php:3499 #: src/Model/Item.php:3510
msgid "bytes" msgid "bytes"
msgstr "" msgstr ""
#: src/Model/Item.php:3530 #: src/Model/Item.php:3541
#, php-format #, php-format
msgid "%2$s (%3$d%%, %1$d vote)" msgid "%2$s (%3$d%%, %1$d vote)"
msgid_plural "%2$s (%3$d%%, %1$d votes)" msgid_plural "%2$s (%3$d%%, %1$d votes)"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3532 #: src/Model/Item.php:3543
#, php-format #, php-format
msgid "%2$s (%1$d vote)" msgid "%2$s (%1$d vote)"
msgid_plural "%2$s (%1$d votes)" msgid_plural "%2$s (%1$d votes)"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3537 #: src/Model/Item.php:3548
#, php-format #, php-format
msgid "%d voter. Poll end: %s" msgid "%d voter. Poll end: %s"
msgid_plural "%d voters. Poll end: %s" msgid_plural "%d voters. Poll end: %s"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3539 #: src/Model/Item.php:3550
#, php-format #, php-format
msgid "%d voter." msgid "%d voter."
msgid_plural "%d voters." msgid_plural "%d voters."
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3541 #: src/Model/Item.php:3552
#, php-format #, php-format
msgid "Poll end: %s" msgid "Poll end: %s"
msgstr "" 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" msgid "View on separate page"
msgstr "" 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/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/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" 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" src="view/js/main.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script> <script>
// Lifted from https://css-tricks.com/snippets/jquery/move-cursor-to-end-of-textarea-or-input/ // 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/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 type="text/javascript" src="view/asset/dompurify/dist/purify.min.js?v={{$smarty.const.FRIENDICA_VERSION}}">
</script> </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" src="view/js/main.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
<script type="text/javascript" <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="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="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" 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) {{* 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 *}} 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) {{* 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 *}} They are loaded into the html <head> so that js functions can use them *}}
<script type="text/javascript"> <script type="text/javascript">
var updateInterval = {{$update_interval}}; const aStr = {
delitem : "{{$l10n.delitem|escape:'javascript' nofilter}}",
var localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}}; blockAuthor : "{{$l10n.blockAuthor|escape:'javascript' nofilter}}",
var aStr = { ignoreAuthor : "{{$l10n.ignoreAuthor|escape:'javascript' nofilter}}",
'delitem' : "{{$delitem|escape:'javascript' nofilter}}", };
'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}", const aActErr = {
'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}", 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> </script>