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

Commit 1646efe

Browse files
committed
i18n new prompt exception mechanism
1 parent c2f4926 commit 1646efe

File tree

29 files changed

+99
-10
lines changed

29 files changed

+99
-10
lines changed

core/src/core/src/pydio/Core/Exception/PydioPromptException.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Pydio\Core\Http\Middleware\WorkspaceAuthMiddleware;
2424
use Pydio\Core\Http\Response\JSONSerializableResponseChunk;
2525
use Pydio\Core\Http\Response\XMLSerializableResponseChunk;
26+
use Pydio\Core\Services\LocaleService;
2627

2728
defined('AJXP_EXEC') or die( 'Access not allowed');
2829

@@ -83,12 +84,15 @@ public function __construct($promptType, $data, $messageString, $messageId = fal
8384
* @return PydioPromptException
8485
*/
8586
public static function promptForWorkspaceCredentials($parameters, $postSubmitCallback = ""){
87+
$mess = LocaleService::getMessages();
8688
$inputs = [];
8789
foreach($parameters as $key => $value){
8890
if($key === WorkspaceAuthMiddleware::FORM_RESUBMIT_LOGIN) {
89-
$inputs[] = "<input type='text' name='$key' value='$value' placeholder='Login'>";
91+
$loginString = str_replace("'","\'", $mess['181']);
92+
$inputs[] = "<input type='text' name='$key' value='$value' placeholder='$loginString'>";
9093
}else if($key === WorkspaceAuthMiddleware::FORM_RESUBMIT_PASS){
91-
$inputs[] = "<input type='password' name='$key' value='' placeholder='Password' autocomplete='off'>";
94+
$passString = str_replace("'","\'", $mess['182']);
95+
$inputs[] = "<input type='password' name='$key' value='' placeholder='$passString' autocomplete='off'>";
9296
}else{
9397
$inputs[] = "<input type='hidden' name='$key' value='$value'>";
9498
}
@@ -97,8 +101,8 @@ public static function promptForWorkspaceCredentials($parameters, $postSubmitCal
97101
"confirm",
98102
array(
99103
"DIALOG" => "<div>
100-
<h3>Credentials Required</h3>
101-
<div class='dialogLegend'>Please provide a password to enter this workspace.</div>
104+
<h3>".$mess['557']."</h3>
105+
<div class='dialogLegend'>".$mess['558']."</div>
102106
<form autocomplete='off'>
103107
".implode("\n", $inputs)."
104108
</form>
@@ -112,7 +116,7 @@ public static function promptForWorkspaceCredentials($parameters, $postSubmitCal
112116
"EVAL" => ""
113117
)
114118
),
115-
"Credentials Needed");
119+
$mess['557']);
116120

117121
}
118122

core/src/core/src/pydio/Core/Exception/WorkspaceAuthRequired.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Pydio\Auth\Core\MemorySafe;
2525
use Pydio\Core\Model\Context;
2626
use Pydio\Core\Model\UserInterface;
27+
use Pydio\Core\Services\LocaleService;
2728

2829
defined('AJXP_EXEC') or die('Access not allowed');
2930

@@ -43,10 +44,13 @@ class WorkspaceAuthRequired extends PydioException {
4344
* @param boolean $requireLogin
4445
* @param string $message
4546
*/
46-
public function __construct($workspaceId, $requireLogin = false, $message = "Authentication required for this workspace")
47+
public function __construct($workspaceId, $requireLogin = false, $message = "")
4748
{
4849
$this->workspaceId = $workspaceId;
4950
$this->requireLogin = $requireLogin;
51+
if(empty($message)){
52+
$message = LocaleService::getMessages()['559'];
53+
}
5054
parent::__construct($message, false, null);
5155
}
5256

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,5 +654,8 @@
654654
"553" => "Invalid password, please try again. \\n Make sure your Caps Lock is not engaged!",
655655
"554" => "%s result(s) in Recycle Bin",
656656
"556" => "Launching task %s in background",
657+
"557" => "Credentials required",
658+
"558" => "Please provide a password to enter this workspace.",
659+
"559" => "Authentication failed for this workspace.",
657660

658661
);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,4 +651,7 @@
651651
"553" => "Invalid password, please try again. \\n Make sure your Caps Lock is not engaged!",
652652
"554" => "%s result(s) in Recycle Bin",
653653
"556" => "Launching task %s in background",
654+
"557" => "Credentials required",
655+
"558" => "Please provide a password to enter this workspace.",
656+
"559" => "Authentication failed for this workspace.",
654657
);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,5 +656,8 @@
656656
"553" => "Invalid password, please try again. \\n Make sure your Caps Lock is not engaged!",
657657
"554" => "%s result(s) in Recycle Bin",
658658
"556" => "Launching task %s in background",
659+
"557" => "Credentials required",
660+
"558" => "Please provide a password to enter this workspace.",
661+
"559" => "Authentication failed for this workspace.",
659662
/* END SENTENCE */
660663
);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,9 @@
658658
"553" => "Ungültiges Passwort. Bitte stellen Sie sicher, dass die Feststelltaste nicht gedrückt ist und geben Sie das Kennwort erneut ein.",
659659
"554" => "%s Ergebnis(se) im Papierkorb",
660660
"556" => "Starte Aufgabe %s im Hintergrund",
661+
"557" => "Credentials required",
662+
"558" => "Please provide a password to enter this workspace.",
663+
"559" => "Authentication failed for this workspace.",
661664
/* END SENTENCE */
662665
/* password strength tester */
663-
);
666+
);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,4 +653,7 @@
653653
"553" => "Invalid password, please try again. \\n Make sure your Caps Lock is not engaged!",
654654
"554" => "%s result(s) in Recycle Bin",
655655
"556" => "Launching task %s in background",
656+
"557" => "Credentials required",
657+
"558" => "Please provide a password to enter this workspace.",
658+
"559" => "Authentication failed for this workspace.",
656659
);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,4 +658,7 @@
658658
"553" => "Invalid password, please try again. \\n Make sure your Caps Lock is not engaged!",
659659
"554" => "%s result(s) in Recycle Bin",
660660
"556" => "Launching task %s in background",
661+
"557" => "Credentials required",
662+
"558" => "Please provide a password to enter this workspace.",
663+
"559" => "Authentication failed for this workspace.",
661664
);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,5 +654,8 @@
654654
"553" => "Invalid password, please try again. \\n Make sure your Caps Lock is not engaged!",
655655
"554" => "%s result(s) in Recycle Bin",
656656
"556" => "Launching task %s in background",
657+
"557" => "Credentials required",
658+
"558" => "Please provide a password to enter this workspace.",
659+
"559" => "Authentication failed for this workspace.",
657660
/* END SENTENCE */
658661
);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,5 +652,8 @@
652652
"553" => "Invalid password, please try again. \\n Make sure your Caps Lock is not engaged!",
653653
"554" => "%s result(s) in Recycle Bin",
654654
"556" => "Launching task %s in background",
655+
"557" => "Credentials required",
656+
"558" => "Please provide a password to enter this workspace.",
657+
"559" => "Authentication failed for this workspace.",
655658
/* END SENTENCE */
656659
);

0 commit comments

Comments
 (0)