Localize transport errors.

This commit is contained in:
Zachary Doll 2014-02-12 16:35:22 -06:00
parent 32ed92f80f
commit 9240c5c381
2 changed files with 22 additions and 12 deletions

View File

@ -89,7 +89,7 @@ class YagaController extends DashboardController {
$this->SetData('TransportType', 'Import');
if(!class_exists('ZipArchive')) {
$this->Form->AddError('You do not seem to have the minimum requirements to import a Yaga configuration automatically. Please reference manual_transport.md for more information.');
$this->Form->AddError(T('Yaga.Error.TransportRequirements'));
}
if($this->Form->IsPostBack() == TRUE) {
@ -116,7 +116,7 @@ class YagaController extends DashboardController {
Gdn_FileSystem::RemoveFolder(PATH_UPLOADS . DS . 'import' . DS . 'yaga');
}
else {
$this->Form->AddError('You must select at least one item to import.');
$this->Form->AddError(T('Yaga.Error.Includes'));
}
}
@ -136,7 +136,7 @@ class YagaController extends DashboardController {
$this->SetData('TransportType', 'Export');
if(!class_exists('ZipArchive')) {
$this->Form->AddError('You do not seem to have the minimum requirements to export your Yaga configuration automatically. Please reference manual_transport.md for more information.');
$this->Form->AddError(T('Yaga.Error.TransportRequirements'));
}
if($this->Form->IsPostBack()) {
@ -146,7 +146,7 @@ class YagaController extends DashboardController {
$this->SetData('TransportPath', $Filename);
}
else {
$this->Form->AddError('You must select at least one item to export.');
$this->Form->AddError(T('Yaga.Error.Includes'));
}
}
@ -192,7 +192,7 @@ class YagaController extends DashboardController {
$Hashes = array();
if($FH->open($Path, ZipArchive::CREATE) !== TRUE) {
$this->Form->AddError('Unable to create archive: ' . $FH->getStatusString());
$this->Form->AddError(sprintf(T('Yaga.Error.ArchiveCreate'), $FH->getStatusString()));
return FALSE;
}
@ -248,7 +248,7 @@ class YagaController extends DashboardController {
foreach($FilteredImages as $Image) {
if($FH->addFile(PATH_UPLOADS . DS . $Image, 'images' . DS . $Image) !== TRUE) {
$this->Form->AddError('Unable to add file: ' . $FH->getStatusString());
$this->Form->AddError(sprintf(T('Yaga.Error.AddFile'), $FH->getStatusString()));
return FALSE;
}
$Hashes[] = md5_file(PATH_UPLOADS . DS . $Image);
@ -271,7 +271,7 @@ class YagaController extends DashboardController {
return $Path;
}
else {
$this->Form->AddError('Unable to save archive: ' . $FH->getStatusString());
$this->Form->AddError(sprintf(T('Yaga.Error.ArchiveSave'), $FH->getStatusString()));
return FALSE;
}
}
@ -284,14 +284,14 @@ class YagaController extends DashboardController {
*/
protected function _ExtractZip($Filename) {
if(!file_exists($Filename)) {
$this->Form->AddError('File does not exist.');
$this->Form->AddError(T('Yaga.Error.FileDNE'));
return FALSE;
}
$ZipFile = new ZipArchive();
$Result = $ZipFile->open($Filename);
if($Result !== TRUE) {
$this->Form->AddError('Unable to open archive.');
$this->Form->AddError(T('Yaga.Error.ArchiveOpen'));
return FALSE;
}
@ -301,7 +301,7 @@ class YagaController extends DashboardController {
$Result = $ZipFile->extractTo(PATH_UPLOADS . DS . 'import' . DS . 'yaga');
if($Result !== TRUE) {
$this->Form->AddError('Unable to extract file.');
$this->Form->AddError(T('Yaga.Error.ArchiveExtract'));
return FALSE;
}
@ -312,7 +312,7 @@ class YagaController extends DashboardController {
return $MetaData;
}
else {
$this->Form->AddError('Archive appears to be corrupt: Checksum is invalid.');
$this->Form->AddError(T('Yaga.Error.ArchiveChecksum'));
return FALSE;
}
}
@ -352,7 +352,7 @@ class YagaController extends DashboardController {
// Import uploaded files
if(Gdn_FileSystem::Copy(PATH_UPLOADS . DS . 'import' . DS . 'yaga' . DS . 'images' . DS, PATH_UPLOADS . DS) === FALSE) {
$this->Form->AddError('Unable to copy image files.');
$this->Form->AddError(T('Yaga.Error.TransportCopy'));
}
}

View File

@ -82,6 +82,16 @@ $Definition['Yaga.Error.NoBadges'] = 'You cannot award badges without any badges
$Definition['Yaga.Error.NoRanks'] = 'You cannot promote users without any ranks defined.';
$Definition['Yaga.Error.NeedJS'] = 'That must be done via Javascript';
$Definition['Yaga.Error.DeleteFailed'] = 'Failed to delete %s';
$Definition['Yaga.Error.TransportRequirements'] = 'You do not seem to have the minimum requirements to transport a Yaga configuration automatically. Please reference manual_transport.md for more information.';
$Definition['Yaga.Error.Includes'] = 'You must select at least one item to transport.';
$Definition['Yaga.Error.ArchiveCreate'] = 'Unable to create archive: %s';
$Definition['Yaga.Error.AddFile'] ='Unable to add file: %s';
$Definition['Yaga.Error.ArchiveSave'] = 'Unable to save archive: %s';
$Defitition['Yaga.Error.FileDNE'] = 'File does not exist.';
$Definition['Yaga.Error.ArchiveOpen'] = 'Unable to open archive.';
$Definition['Yaga.Error.ArchiveExtract'] = 'Unable to extract file.';
$Definition['Yaga.Error.ArchiveChecksum'] = 'Archive appears to be corrupt: Checksum is invalid.';
$Definition['Yaga.Error.TransportCopy'] = 'Unable to copy image files.';
// Activities
$Definition['Yaga.HeadlineFormat.BadgeEarned'] = '{ActivityUserID,You} earned the <a href="{Url,html}">{Data.Name,text}</a> badge.';