Skip to content
Permalink
Browse files

Merge pull request #14 from ezsystems/ezee-1065-implement-translations

EZEE-1065: As a developer, I should be able to customize the messages as well as error messages displayed to the end user
  • Loading branch information...
sunpietro committed Mar 30, 2017
2 parents 394d45c + d1388d4 commit 7e44fb6889824e6e153ad30d411cf0b815f68044
@@ -12,8 +12,9 @@
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
use Symfony\Component\Yaml\Yaml;
use EzSystems\PlatformUIBundle\DependencyInjection\PlatformUIExtension;
class EzSystemsMultiFileUploadExtension extends ConfigurableExtension implements PrependExtensionInterface
class EzSystemsMultiFileUploadExtension extends ConfigurableExtension implements PrependExtensionInterface, PlatformUIExtension
{
/** These keys are used to overwrite parameters */
const CONFIGURATION_PARAMETERS = [
@@ -81,4 +82,14 @@ private function prependCss(ContainerBuilder $container)
$container->prependExtensionConfig('ez_platformui', $config);
$container->addResource(new FileResource($cssConfigFile));
}
public function getTranslationDomains()
{
return [
'uploadform',
'uploadpopup',
'fileuploaditem',
'pluginfileupload'
];
}
}
@@ -13,6 +13,7 @@ system:
- 'ez-contentinfomodel'
- 'ez-viewservicebaseplugin'
- 'ez-pluginregistry'
- 'ez-translator'
dependencyOf:
- 'ez-locationviewview'
- 'ez-locationviewviewservice'
@@ -22,6 +23,7 @@ system:
- 'mfu-uploadform-view'
- 'mfu-uploadpopup-view'
- 'ez-subitemboxview'
- 'ez-translator'
- 'mfusubitemboxview-ez-template'
path: %multifile_upload.public_dir%/js/views/mfu-subitembox-view.js
mfusubitemboxview-ez-template:
@@ -30,6 +32,7 @@ system:
mfu-uploadform-view:
requires:
- 'ez-templatebasedview'
- 'ez-translator'
- 'mfu-text-format-helper'
- 'mfuuploadformview-ez-template'
path: %multifile_upload.public_dir%/js/views/mfu-uploadform-view.js
@@ -41,6 +44,7 @@ system:
- 'mfu-uploadform-view'
- 'mfu-fileitem-view'
- 'event-tap'
- 'ez-translator'
- 'mfuuploadpopupview-ez-template'
path: %multifile_upload.public_dir%/js/views/mfu-uploadpopup-view.js
mfuuploadpopupview-ez-template:
@@ -49,6 +53,7 @@ system:
mfu-fileitem-view:
requires:
- 'ez-templatebasedview'
- 'ez-translator'
- 'mfu-text-format-helper'
- 'mfufileitemview-ez-template'
path: %multifile_upload.public_dir%/js/views/mfu-fileitem-view.js
@@ -145,7 +145,7 @@ YUI.add('mfu-fileupload-plugin', function (Y) {
*/
this.fire('notify', {
notification: {
text: 'Error occurred when refreshing sub items list: ' + error,
text: this.get('subitemsListRefreshingErrorText').replace('{error}', error),
identifier: 'mfu-subitems-list-refresh-error-' + Date.now(),
state: 'error',
timeout: 0,
@@ -201,7 +201,19 @@ YUI.add('mfu-fileupload-plugin', function (Y) {
* @attribute subitemBoxView
* @type {mfu.SubitemBoxView}
*/
subitemBoxView: {}
subitemBoxView: {},

/**
* The sub items list refreshing error text
*
* @attribute subitemsListRefreshingErrorText
* @type {String}
* @readOnly
*/
subitemsListRefreshingErrorText: {
valueFn: () => Y.eZ.trans('subitems.list.refreshing.error', {}, 'pluginfileupload'),
readOnly: true,
},
}
});

@@ -225,7 +225,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
*/
_showFileUploadError: function (event) {
const errorText = event.message ?
`Cannot upload a file: ${event.message}` :
this.get('fileUploadErrorText').replace('{message}', event.message) :
this.get('fileUploadFailedText')
.replace('{statusCode}', event.target.status)
.replace('{statusText}', event.target.statusText);
@@ -532,7 +532,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileUploadStatusText: {
value: '({loaded} of {total})',
valueFn: () => Y.eZ.trans('file.upload.status', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -544,7 +544,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileUploadDoneText: {
value: '{total} uploaded',
valueFn: () => Y.eZ.trans('file.upload.done', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -556,7 +556,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileStartPublishText: {
value: 'Publishing file: {filename}',
valueFn: () => Y.eZ.trans('publishing.file', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -568,7 +568,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
filePublishedText: {
value: 'The file: {filename} has been published',
valueFn: () => Y.eZ.trans('file.published', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -580,7 +580,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileDeletedText: {
value: 'The file has been deleted: {filename}',
valueFn: () => Y.eZ.trans('file.deleted', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -592,7 +592,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileUploadAbortedText: {
value: 'The upload of {filename} has been aborted',
valueFn: () => Y.eZ.trans('file.upload.aborted', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -604,7 +604,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileStartDeleteText: {
value: 'Deleting file: {filename}',
valueFn: () => Y.eZ.trans('deleting.file', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -616,7 +616,19 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileUploadFailedText: {
value: 'File upload failed - [{statusCode}] {statusText}',
valueFn: () => Y.eZ.trans('file.upload.failed', {}, 'fileuploaditem'),
readOnly: true,
},

/**
* File upload error text
*
* @attribute fileUploadErrorText
* @type {String}
* @readOnly
*/
fileUploadErrorText: {
valueFn: () => Y.eZ.trans('file.upload.error', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -628,7 +640,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileTypeNotAllowedText: {
value: 'File Type not allowed: {filename}',
valueFn: () => Y.eZ.trans('file.type.not.allowed', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -640,7 +652,7 @@ YUI.add('mfu-fileitem-view', function (Y) {
* @readOnly
*/
fileSizeExceededText: {
value: 'File Size not allowed: {filesize} - {filename}',
valueFn: () => Y.eZ.trans('file.size.not.allowed', {}, 'fileuploaditem'),
readOnly: true,
},

@@ -139,7 +139,7 @@ YUI.add('mfu-uploadform-view', function (Y) {
*/
this.fire('notify', {
notification: {
text: 'Cannot check the permissions for uploading files',
text: this.get('checkPermissionsErrorText'),
identifier: 'mfu-file-upload-permission-check-error',
state: 'error',
timeout: 0,
@@ -322,7 +322,7 @@ YUI.add('mfu-uploadform-view', function (Y) {
*/
onDropCallback: {
valueFn: () => true,
writeOnce: 'initOnly'
writeOnce: 'initOnly',
},

/**
@@ -333,21 +333,33 @@ YUI.add('mfu-uploadform-view', function (Y) {
* @readOnly
*/
maxFileSizeText: {
value: '(Max file size: {filesize})',
readOnly: true
valueFn: () => Y.eZ.trans('max.file.size.info', {}, 'uploadform'),
readOnly: true,
},

/**
* Form active state flag
*
* @attribute
* @attribute isFormActive
* @type {Boolean}
* @default false
* @readOnly
*/
isFormActive: {
value: false,
readOnly: true
readOnly: true,
},

/**
* Check permissions error text
*
* @attribute checkPermissionsErrorText
* @type {String}
* @readOnly
*/
checkPermissionsErrorText: {
valueFn: () => Y.eZ.trans('file.upload.permissions.check.error', {}, 'uploadform'),
readOnly: true,
},
}
});
@@ -377,11 +377,10 @@ YUI.add('mfu-uploadpopup-view', function (Y) {
*
* @attribute uploadedText
* @type {String}
* @default 'Uploaded ({uploaded}/{total})'
* @readOnly
*/
uploadedText: {
value: 'Uploaded ({uploaded}/{total})',
valueFn: () => Y.eZ.trans('uploaded.info', {}, 'uploadpopup'),
readOnly: true,
},
}
@@ -1,8 +1,10 @@
<h2 class="ez-subitembox-title">
<a href="#" class="ez-collapse-toggle">{{ translate 'subitem.subitems' 'subitem' }} ({{ location.childCount }})</a>
<ul class="ez-subitembox-viewlist">
{{#each viewsInfo}}
<li class="ez-subitembox-viewlist-item{{#if selected}} is-view-selected{{/if}}"><a href="#" class="ez-switch-subitemview ez-font-icon" data-view-identifier="{{identifier}}" title="{{ name }}"></a></li>
{{#each viewsInfo }}
<li class="ez-subitembox-viewlist-item{{#if selected }} is-view-selected{{/if}}">
<a href="#" class="ez-switch-subitemview ez-font-icon" data-view-identifier="{{ identifier }}" title="{{ name }}"></a>
</li>
{{/each}}
</ul>
</h2>
@@ -7,13 +7,13 @@
</defs>
</svg>
<div class="mfu-form__container mfu-form--inactive">
<h3 class="mfu-form__call-to-action">Drag your files here</h3>
<label class="mfu-form__other-action" for="mfu-files">or if you prefer</label>
<h3 class="mfu-form__call-to-action">{{ translate 'drag.your.files.here' 'uploadform' }}</h3>
<label class="mfu-form__other-action" for="mfu-files">{{ translate 'or' 'uploadform' }}</label>
<button class="mfu-form___btn--select-files">
<span class="mfu-form__btn-label--select-files">
<svg class="mfu-form__icon-upload"><use xlink:href="#icon-mfu-upload"></use></svg> Choose files
<svg class="mfu-form__icon-upload"><use xlink:href="#icon-mfu-upload"></use></svg> {{ translate 'choose.files' 'uploadform' }}
</span>
</button>
<input class="mfu-form__input mfu--hidden" id="mfu-files" type="file" name="files[]" multiple />
<small class="mfu-form__limit-info">(Max file size 2MB)</small>
<small class="mfu-form__limit-info"></small>
</div>
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2017-03-29T12:06:37Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
</header>
<body>
<trans-unit id="ee36a21fa2f78f5da59f5792d80408b45e29a983" resname="deleting.file">
<source>Deleting file: {filename}</source>
<target>Deleting file: {filename}</target>
<note>key: deleting.file</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="1468d345f79377ac34081ad35b68b3bf0617700f" resname="file.deleted">
<source>The file has been deleted: {filename}</source>
<target>The file has been deleted: {filename}</target>
<note>key: file.deleted</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="4597389311e6a797708b8370acd805caa62b8588" resname="file.published">
<source>The file has been published: {filename}</source>
<target>The file has been published: {filename}</target>
<note>key: file.published</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="504af893987c356494d73f1c0f1111d6b7bd54d2" resname="file.size.not.allowed">
<source>File Size not allowed: {filesize} - {filename}</source>
<target>File Size not allowed: {filesize} - {filename}</target>
<note>key: file.size.not.allowed</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="2d2664ca280b4cfaf71cb0e4270343b59b6fa4ad" resname="file.type.not.allowed">
<source>File Type not allowed: {filename}</source>
<target>File Type not allowed: {filename}</target>
<note>key: file.type.not.allowed</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="ecbb6f130d3314def143f1b5c778b31baa1adbc5" resname="file.upload.aborted">
<source>The file upload has been aborted: {filename}</source>
<target>The file upload has been aborted: {filename}</target>
<note>key: file.upload.aborted</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="6760bdb1386b6a55665ee566d1dc52d0333b081a" resname="file.upload.done">
<source>{total} uploaded</source>
<target>{total} uploaded</target>
<note>key: file.upload.done</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="fb35c9fefec0f9ed7688c8ed346186612432a6b1" resname="file.upload.error">
<source>Cannot upload a file: {message}</source>
<target>Cannot upload a file: {message}</target>
<note>key: file.upload.error</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="819ce4269fd40c1c71c8af8c5a7285657973a772" resname="file.upload.failed">
<source>File upload failed - [{statusCode}] {statusText}</source>
<target>File upload failed - [{statusCode}] {statusText}</target>
<note>key: file.upload.failed</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="8d2d4a95cd909c2f8dfb0d0394824fa9ad34e946" resname="file.upload.status">
<source>({loaded} of {total})</source>
<target>({loaded} of {total})</target>
<note>key: file.upload.status</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
<trans-unit id="3b5c9a1c511d6150f8e567ea63ec8658609f7c94" resname="publishing.file">
<source>Publishing file: {filename}</source>
<target>Publishing file: {filename}</target>
<note>key: publishing.file</note>
<jms:reference-file>./Resources/public/js/views/mfu-fileitem-view.js</jms:reference-file>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 7e44fb6

Please sign in to comment.
You can’t perform that action at this time.