Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 3385a4a

Browse files
committed
I18N new uploader
1 parent 7a1f06d commit 3385a4a

File tree

6 files changed

+135
-36
lines changed

6 files changed

+135
-36
lines changed

core/src/plugins/core.ajaxplorer/i18n/en.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
"208" => "You have no read permission on this folder",
263263
"209" => "Internal server error, please contact Administrator!",
264264
"210" => "Upload failed",
265-
"211" => "The file is too big!",
265+
"211" => "The file is too big! Please contact your administrator or use the desktop sync client.",
266266
"212" => "No file found on server!",
267267
"213" => "Error while copying file to current folder",
268268
"214" => "Browse",
@@ -392,8 +392,8 @@
392392
"334" => "more",
393393
"335" => "Please enter a page number between 1 and ",
394394
"336" => "Sorry you cannot drop folders, drop only files!",
395-
"337" => "Auto start upload",
396-
"338" => "Auto close after upload",
395+
"337" => "Start uploading automatically",
396+
"338" => "Close panel after upload is finished",
397397
"339" => "Existing Files",
398398
"340" => "Alert",
399399
"341" => "File Info",

core/src/plugins/core.ajaxplorer/i18n/fr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@
263263
"208" => "Vous n'avez pas le droit de lire dans ce répertoire",
264264
"209" => "Erreur interne du serveur. Contactez l'administrateur !",
265265
"210" => "Echec lors du transfert.",
266-
"211" => "Le fichier dépasse la taille autorisée",
266+
"211" => "Le fichier dépasse la taille autorisée, veuillez contacter votre administrateur ou utiliser l'application de synchronisation.",
267267
"212" => "Aucun fichier trouvé sur le serveur !",
268268
"213" => "Erreur lors de la copie du fichier temporaire.",
269269
"214" => "Parcourir",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/*
3+
* Copyright 2007-2016 Abstrium <contact (at) pydio.com>
4+
* This file is part of Pydio.
5+
*
6+
* Pydio is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Pydio is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* The latest code can be found at <https://pydio.com/>.
20+
*/
21+
22+
$mess = [
23+
"1" => "%s files queued for upload",
24+
"2" => "Uploading %s files",
25+
"3" => "You are not allowed to upload this file here",
26+
"4" => "Pick File",
27+
"5" => "Pick Folder",
28+
"6" => "Cannot abort folder creation",
29+
"7" => "Uploading files to server...",
30+
"8" => "It seems that your browser does not support dropping folders",
31+
"9" => "",
32+
"10" => "",
33+
"11" => "Start",
34+
"12" => "Clear list",
35+
"13" => "Folder created",
36+
"14" => "Processing",
37+
"15" => "Pending",
38+
"16" => "Processed",
39+
"17" => "Show/hide processed files",
40+
"18" => "If a file with the same name exists:",
41+
"19" => "Stop upload and alert me",
42+
"20" => "Rename file automatically",
43+
"21" => "Overwrite existing file silently",
44+
];
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/*
3+
* Copyright 2007-2016 Abstrium <contact (at) pydio.com>
4+
* This file is part of Pydio.
5+
*
6+
* Pydio is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Pydio is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* The latest code can be found at <https://pydio.com/>.
20+
*/
21+
22+
$mess = [
23+
"1" => "%s fichiers en attente",
24+
"2" => "Chargement de %s fichiers",
25+
"3" => "Vous n'êtes pas autorisé à transférer ce fichier ici",
26+
"4" => "Fichier",
27+
"5" => "Répertoire",
28+
"6" => "Impossible d'annuler la création d'un dossier",
29+
"7" => "Transfert des fichiers vers le serveur...",
30+
"8" => "Il semble que votre navigateur ne supporte pas le chargement de dossiers. Vous devriez utiliser l'application de synchronisation.",
31+
"9" => "",
32+
"10" => "",
33+
"11" => "Démarrer",
34+
"12" => "Vider",
35+
"13" => "Répertoire créé",
36+
"14" => "En cours",
37+
"15" => "En attente",
38+
"16" => "Terminés",
39+
"17" => "Montrer/cacher les fichiers transferés",
40+
"18" => "Si un fichier avec le même nom existe:",
41+
"19" => "Interrompre et me demander",
42+
"20" => "Renommer automatiquement",
43+
"21" => "Remplacer le fichier existant",
44+
];

core/src/plugins/uploader.html/js/react/UploaderModel.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@
102102
}
103103
dataModel.applyCheckHook(newNode, params);
104104
}catch(e){
105-
throw new Error('Error while checking before uploads');
105+
throw new Error(global.pydio.MessageHash['html_uploader.3']);
106106
}
107107
let overwriteStatus = UploaderConfigs.getInstance().getOption("DEFAULT_EXISTING", "upload_existing");
108108
if(overwriteStatus === 'rename'){
109109
queryString += '&auto_rename=true';
110110
}else if(overwriteStatus === 'alert' && !this._relativePath && currentRepo === this._repositoryId){
111111
if(dataModel.fileNameExists(nodeName, false, this._targetNode)){
112-
if(!global.confirm(MessageHash[124])){
113-
throw new Error('File already exists');
112+
if(!global.confirm(global.pydio.MessageHash[124])){
113+
throw new Error(global.pydio.MessageHash[71]);
114114
}
115115
}
116116
}
@@ -146,11 +146,6 @@
146146
this.setStatus('loading');
147147

148148
let maxUpload = parseFloat(UploaderConfigs.getInstance().getOption('UPLOAD_MAX_SIZE'));
149-
if(this.getSize() > maxUpload){
150-
this.onError('File is too big: contact your admin to raise the upload value, or use the desktop client.');
151-
completeCallback();
152-
return;
153-
}
154149

155150
let queryString;
156151
try{
@@ -166,11 +161,21 @@
166161

167162
this.tryAlternativeUpload(complete, progress, function(){
168163
// Failed, switch back to normal upload.
164+
if(this.getSize() > maxUpload){
165+
this.onError(global.pydio.MessageHash[211]);
166+
completeCallback();
167+
return;
168+
}
169169
this.xhr = PydioApi.getClient().uploadFile(this._file,'userfile_0',queryString,complete,error,progress);
170170
}.bind(this));
171171

172172
}else{
173-
173+
174+
if(this.getSize() > maxUpload){
175+
this.onError(global.pydio.MessageHash[211]);
176+
completeCallback();
177+
return;
178+
}
174179
this.xhr = PydioApi.getClient().uploadFile(this._file,'userfile_0',queryString,complete,error,progress);
175180

176181
}
@@ -251,7 +256,7 @@
251256
}.bind(this));
252257
}
253258
_doAbort(completeCallback){
254-
if(global.console) global.console.log('Cannot abort folder creation');
259+
if(global.console) global.console.log(global.pydio.MessageHash['html_uploader.6']);
255260
}
256261
}
257262

@@ -263,7 +268,7 @@
263268
userId : global.pydio.user.id,
264269
wsId : global.pydio.user.activeRepository,
265270
flags : PydioTasks.Task.FLAG_HAS_PROGRESS|PydioTasks.Task.FLAG_STOPPABLE,
266-
label : "Uploading files to server...",
271+
label : global.pydio.MessageHash['html_uploader.7'],
267272
status : PydioTasks.Task.STATUS_COMPLETE,
268273
statusMessage : ''
269274
});
@@ -274,11 +279,11 @@
274279
this.updateStatus(PydioTasks.Task.STATUS_RUNNING);
275280
}
276281
setPending(queueSize){
277-
this._internal['statusMessage'] = queueSize + ' files waiting for upload';
282+
this._internal['statusMessage'] = global.pydio.MessageHash['html_uploader.1'].replace('%s', queueSize);
278283
this.updateStatus(PydioTasks.Task.STATUS_PENDING);
279284
}
280285
setRunning(queueSize){
281-
this._internal['statusMessage'] = 'Uploading ' + queueSize + ' files';
286+
this._internal['statusMessage'] = global.pydio.MessageHash['html_uploader.2'].replace('%s', queueSize);
282287
this.updateStatus(PydioTasks.Task.STATUS_RUNNING);
283288
}
284289
setIdle(){
@@ -514,7 +519,7 @@
514519
for(var j=0;j<files.length;j++){
515520
console.log(files[j]);
516521
if(files[j].size === 0){
517-
alert('It seems that your browser does not support dropping folders.');
522+
alert(global.pydio.MessageHash['html_uploader.8']);
518523
return;
519524
}
520525
let uploadItem = new UploadItem(files[j], targetNode);

core/src/plugins/uploader.html/js/react/UploaderView.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
render: function(){
4747

4848
let options;
49+
let messages = global.pydio.MessageHash;
50+
4951
if(this.state && this.state.options){
5052
let dismiss = function(e){
5153
this.toggleOptions(e);
@@ -59,21 +61,21 @@
5961
let e = global.document.createElement('input');
6062
e.setAttribute('type', 'file');
6163
if('webkitdirectory' in e){
62-
folderButton = <ReactMUI.RaisedButton label="Pick Folder" onClick={this.openFolderPicker}/>;
64+
folderButton = <ReactMUI.RaisedButton label={messages['html_uploader.5']} onClick={this.openFolderPicker}/>;
6365
}
6466
e = null;
6567
let configs = UploaderModel.Configs.getInstance();
6668
if(!configs.getOptionAsBool('DEFAULT_AUTO_START', 'upload_auto_send', true)){
67-
startButton = <ReactMUI.FlatButton label="Start" onClick={this.start} secondary={true}/>
69+
startButton = <ReactMUI.FlatButton label={messages['html_uploader.11']} onClick={this.start} secondary={true}/>
6870
}
6971
return (
7072
<div style={{position:'relative'}}>
7173
<div className="react-mui-context uploader-action-bar">
7274
<ReactMUI.FlatButton style={{float: 'right'}} label="Options" onClick={this.toggleOptions}/>
73-
<ReactMUI.RaisedButton secondary={true} label="Pick File" onClick={this.openFilePicker}/>
75+
<ReactMUI.RaisedButton secondary={true} label={messages['html_uploader.4']} onClick={this.openFilePicker}/>
7476
{folderButton}
7577
{startButton}
76-
<ReactMUI.FlatButton label="Clear List" onClick={this.clear}/>
78+
<ReactMUI.FlatButton label={messages['html_uploader.12']} onClick={this.clear}/>
7779
</div>
7880
<PydioForm.FileDropZone
7981
ref="dropzone"
@@ -169,7 +171,7 @@
169171
render: function(){
170172
let statusMessage;
171173
if(this.props.item.getStatus() === 'loaded'){
172-
statusMessage = 'Created';
174+
statusMessage = global.pydio.MessageHash['html_uploader.13'];
173175
}
174176
return (
175177
<div className={"folder-row upload-" + this.props.item.getStatus() + " " + (this.props.className?this.props.className:"")}>
@@ -226,9 +228,9 @@
226228
render: function(){
227229
let items = [];
228230
if(this.state && this.state.items){
229-
this.renderSection(items, this.state.items.processing, 'Processing', 'section-processing');
230-
this.renderSection(items, this.state.items.pending, 'Pending', 'section-pending');
231-
this.renderSection(items, this.state.items.processed, 'Processed', 'section-processed');
231+
this.renderSection(items, this.state.items.processing, global.pydio.MessageHash['html_uploader.14'], 'section-processing');
232+
this.renderSection(items, this.state.items.pending, global.pydio.MessageHash['html_uploader.15'], 'section-pending');
233+
this.renderSection(items, this.state.items.processed, global.pydio.MessageHash['html_uploader.16'], 'section-processed');
232234
}
233235
return (
234236
<div id="upload_files_list" className={UploaderModel.Configs.getInstance().getOptionAsBool('UPLOAD_SHOW_PROCESSED', 'upload_show_processed', false) ? 'show-processed' : ''}>
@@ -279,8 +281,12 @@
279281

280282
render: function(){
281283

282-
let maxUpload = this.state.configs.getOption('UPLOAD_MAX_SIZE');
283-
let maxUploadMessage = MessageHash[282] + ': ' + PathUtils.roundFileSize(maxUpload, '');
284+
let maxUploadMessage
285+
if(!global.pydio.getPluginConfigs('mq').get('UPLOAD_ACTIVE')){
286+
let maxUpload = this.state.configs.getOption('UPLOAD_MAX_SIZE');
287+
maxUploadMessage = global.pydio.MessageHash[282] + ': ' + PathUtils.roundFileSize(maxUpload, '');
288+
maxUploadMessage = <div className="option-row">{maxUploadMessage}</div>;
289+
}
284290
let toggleStart = this.state.configs.getOptionAsBool('DEFAULT_AUTO_START', 'upload_auto_send');
285291
let toggleClose = this.state.configs.getOptionAsBool('DEFAULT_AUTO_CLOSE', 'upload_auto_close');
286292
let toggleShowProcessed = this.state.configs.getOptionAsBool('UPLOAD_SHOW_PROCESSED', 'upload_show_processed', false);
@@ -289,16 +295,16 @@
289295
return (
290296
<div className="upload-options-pane react-mui-context">
291297
<span className="close-options mdi mdi-close" onClick={this.props.onDismiss}></span>
292-
<div className="option-row">{maxUploadMessage}</div>
293-
<div className="option-row"><ReactMUI.Toggle label="Start uploading automatically" labelPosition="right" toggled={toggleStart} defaultToggled={toggleStart} onToggle={this.updateField.bind(this, 'autostart')}/></div>
294-
<div className="option-row"><ReactMUI.Toggle label="Close panel after upload is finished" labelPosition="right" toggled={toggleClose} onToggle={this.updateField.bind(this, 'autoclose')}/></div>
295-
<div className="option-row"><ReactMUI.Toggle label="Show/hide processed files" labelPosition="right" toggled={toggleShowProcessed} onToggle={this.updateField.bind(this, 'show_processed')}/></div>
298+
{maxUploadMessage}
299+
<div className="option-row"><ReactMUI.Toggle label={global.pydio.MessageHash[337]} labelPosition="right" toggled={toggleStart} defaultToggled={toggleStart} onToggle={this.updateField.bind(this, 'autostart')}/></div>
300+
<div className="option-row"><ReactMUI.Toggle label={global.pydio.MessageHash[338]} labelPosition="right" toggled={toggleClose} onToggle={this.updateField.bind(this, 'autoclose')}/></div>
301+
<div className="option-row"><ReactMUI.Toggle label={global.pydio.MessageHash['html_uploader.17']} labelPosition="right" toggled={toggleShowProcessed} onToggle={this.updateField.bind(this, 'show_processed')}/></div>
296302
<div className="option-row">
297-
<div style={{marginBottom: 10}}>If a file with the same name exists</div>
303+
<div style={{marginBottom: 10}}>{global.pydio.MessageHash['html_uploader.18']}</div>
298304
<ReactMUI.RadioButtonGroup ref="group" name="shipSpeed" defaultSelected={overwriteType} onChange={this.radioChange}>
299-
<ReactMUI.RadioButton value="alert" label="Stop upload and alert me"/>
300-
<ReactMUI.RadioButton value="rename" label="Rename new file automatically"/>
301-
<ReactMUI.RadioButton value="overwrite" label="Overwrite existing file"/>
305+
<ReactMUI.RadioButton value="alert" label={global.pydio.MessageHash['html_uploader.19']}/>
306+
<ReactMUI.RadioButton value="rename" label={global.pydio.MessageHash['html_uploader.20']}/>
307+
<ReactMUI.RadioButton value="overwrite" label={global.pydio.MessageHash['html_uploader.21']}/>
302308
</ReactMUI.RadioButtonGroup>
303309
</div>
304310
</div>

0 commit comments

Comments
 (0)