More error message regularization (and translatability improvements).

This commit is contained in:
Jeff Young 2021-06-28 00:26:54 +01:00
parent 08fb05e522
commit 062c4fda62
17 changed files with 131 additions and 193 deletions

View File

@ -59,10 +59,10 @@ void IO_ERROR::init( const wxString& aProblem, const char* aThrowersFile,
// a short filename will be printed (it is better for user, the full filename has no meaning).
wxString srcname = aThrowersFile;
where.Printf( _( "from %s : %s() line:%d" ),
srcname.AfterLast( '/' ),
wxString( aThrowersFunction ),
aThrowersLineNumber );
where.Printf( _( "from %s : %s() line %d" ),
srcname.AfterLast( '/' ),
wxString( aThrowersFunction ),
aThrowersLineNumber );
}
@ -73,7 +73,7 @@ void PARSE_ERROR::init( const wxString& aProblem, const char* aThrowersFile,
{
parseProblem = aProblem;
problem.Printf( _( "%s in \"%s\", line %d, offset %d" ),
problem.Printf( _( "%s in '%s', line %d, offset %d." ),
aProblem,
aSource,
aLineNumber,

View File

@ -489,7 +489,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
{
THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path \"%s\"." ),
THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path '%s'." ),
fn.GetPath() ) );
}

View File

@ -375,7 +375,7 @@ void KiCopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString&
if( !aErrors.IsEmpty() )
aErrors += "\n";
msg.Printf( _( "Cannot copy file \"%s\"." ), aDestPath );
msg.Printf( _( "Cannot copy file '%s'." ), aDestPath );
aErrors += msg;
}
}

View File

@ -250,8 +250,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
// here and catching it in the KiCad launcher resolves the crash issue. See bug
// report https://bugs.launchpad.net/kicad/+bug/1577786.
msg.Printf( _( "Failed to load kiface library \"%s\"." ),
dname );
msg.Printf( _( "Failed to load kiface library '%s'." ), dname );
THROW_IO_ERROR( msg );
}
else if( ( addr = dso.GetSymbol( wxT( KIFACE_INSTANCE_NAME_AND_VERSION ) ) ) == NULL )
@ -259,8 +258,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
// Failure: error reporting UI was done via wxLogSysError().
// No further reporting required here. Assume the same thing applies here as
// above with the Load() call. This has not been tested.
msg.Printf( _( "Could not read instance name and version symbol from kiface "
"library \"%s\"." ),
msg.Printf( _( "Could not read instance name and version from kiface library '%s'." ),
dname );
THROW_IO_ERROR( msg );
}

View File

@ -25,10 +25,8 @@
void LaunchExternal( const wxString& aPath )
{
#ifdef __WXMAC__
wxString msg;
// Quote in case there are spaces in the path.
msg.Printf( "open \"%s\"", aPath );
wxString msg = "open \"" + aPath + "\"";
system( msg.c_str() );
#else

View File

@ -108,7 +108,7 @@ bool PROJECT_ARCHIVER::Unarchive( const wxString& aSrcFile, const wxString& aDes
for( wxArchiveEntry* entry = archiveStream->GetNextEntry(); entry;
entry = archiveStream->GetNextEntry() )
{
fileStatus.Printf( _( "Extracting file \"%s\"\n" ), entry->GetName() );
fileStatus.Printf( _( "Extracting file '%s'.\n" ), entry->GetName() );
aReporter.Report( fileStatus, RPT_SEVERITY_INFO );
wxString fullname = aDestDir + entry->GetName();
@ -205,7 +205,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
if( !ostream.IsOk() ) // issue to create the file. Perhaps not writable dir
{
msg.Printf( _( "Unable to create archive file \"%s\"\n" ), aDestFile );
msg.Printf( _( "Unable to create archive file '%s'.\n" ), aDestFile );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
return false;
}
@ -251,7 +251,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
if( aVerbose )
{
msg.Printf( _( "Archive file \"%s\"\n" ), currFilename );
msg.Printf( _( "Archived file '%s'.\n" ), currFilename );
aReporter.Report( msg, RPT_SEVERITY_INFO );
}
@ -261,7 +261,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
{
if( aVerbose )
{
msg.Printf( _( "Archive file \"%s\": Failed!\n" ), currFilename );
msg.Printf( _( "Failed to archive file '%s'.\n" ), currFilename );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
}
@ -287,13 +287,15 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
if( zipstream.Close() )
{
msg.Printf( _( "Zip archive \"%s\" created (%s uncompressed, %s compressed)\n" ), aDestFile,
reportSize( uncompressedBytes ), reportSize( zipBytesCnt ) );
msg.Printf( _( "Zip archive '%s' created (%s uncompressed, %s compressed).\n" ),
aDestFile,
reportSize( uncompressedBytes ),
reportSize( zipBytesCnt ) );
aReporter.Report( msg, RPT_SEVERITY_INFO );
}
else
{
msg.Printf( wxT( "Unable to create archive \"%s\"\n" ), aDestFile );
msg.Printf( wxT( "Unable to create archive '%s'.\n" ), aDestFile );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
success = false;
}

View File

@ -299,7 +299,7 @@ bool LIB_ID_VALIDATOR::Validate( wxWindow *aParent )
}
else if( dummy.Parse( val ) != -1 || !dummy.IsValid() ) // Is valid LIB_ID.
{
msg.Printf( _( "\"%s\" is not a valid library identifier format." ), val );
msg.Printf( _( "'%s' is not a valid library identifier format." ), val );
}
if( !msg.empty() )

View File

@ -172,9 +172,8 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid symbol name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid symbol name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
name = FromUTF8();
@ -183,9 +182,8 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
if( id.Parse( name ) >= 0 )
{
error.Printf( _( "Invalid library identifier in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid library identifier" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
m_symbolName = id.GetLibItemName().wx_str();
@ -256,10 +254,8 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
if( !IsSymbol( token ) )
{
error.Printf(
_( "Invalid symbol extends name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid parent symbol name" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
name = FromUTF8();
@ -267,10 +263,8 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
if( it == aSymbolLibMap.end() )
{
error.Printf(
_( "No parent for extended symbol %s in\nfile: \"%s\"\nline: %d\noffset: %d" ),
name.c_str(), CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
error.Printf( _( "No parent for extended symbol %s" ), name.c_str() );
THROW_PARSE_ERROR( error, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
symbol->SetParent( it->second );
@ -284,21 +278,16 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
if( !IsSymbol( token ) )
{
error.Printf(
_( "Invalid symbol unit name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid symbol unit name" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
name = FromUTF8();
if( !name.StartsWith( m_symbolName ) )
{
error.Printf(
_( "Invalid symbol unit name prefix %s in\nfile: \"%s\"\n"
"line: %d\noffset: %d" ),
name.c_str(), CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
error.Printf( _( "Invalid symbol unit name prefix %s" ), name.c_str() );
THROW_PARSE_ERROR( error, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
name = name.Right( name.Length() - m_symbolName.Length() - 1 );
@ -307,29 +296,22 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
if( tokenizer.CountTokens() != 2 )
{
error.Printf(
_( "Invalid symbol unit name suffix %s in\nfile: \"%s\"\n"
"line: %d\noffset: %d" ),
name.c_str(), CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
error.Printf( _( "Invalid symbol unit name suffix %s" ), name.c_str() );
THROW_PARSE_ERROR( error, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
if( !tokenizer.GetNextToken().ToLong( &tmp ) )
{
error.Printf(
_( "Invalid symbol unit number %s in\nfile: \"%s\"\nline: %d\noffset: %d" ),
name.c_str(), CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
error.Printf( _( "Invalid symbol unit number %s" ), name.c_str() );
THROW_PARSE_ERROR( error, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
m_unit = static_cast<int>( tmp );
if( !tokenizer.GetNextToken().ToLong( &tmp ) )
{
error.Printf(
_( "Invalid symbol convert number %s in\nfile: \"%s\"\nline: %d\noffset: %d" ),
name.c_str(), CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
error.Printf( _( "Invalid symbol convert number %s" ), name.c_str() );
THROW_PARSE_ERROR( error, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
m_convert = static_cast<int>( tmp );
@ -445,16 +427,12 @@ LIB_ITEM* SCH_SEXPR_PARSER::ParseDrawItem()
double SCH_SEXPR_PARSER::parseDouble()
{
char* tmp;
wxString error;
// In case the file got saved with the wrong locale.
if( strchr( CurText(), ',' ) != NULL )
{
error.Printf( _( "Floating point number with incorrect local in\nfile: \"%s\"\n"
"line: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Floating point number with incorrect locale" ), CurSource(),
CurLine(), CurLineNumber(), CurOffset() );
}
errno = 0;
@ -463,18 +441,14 @@ double SCH_SEXPR_PARSER::parseDouble()
if( errno )
{
error.Printf( _( "Invalid floating point number in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid floating point number" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
if( CurText() == tmp )
{
error.Printf( _( "Missing floating point number in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Missing floating point number" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
return fval;
@ -774,11 +748,8 @@ void SCH_SEXPR_PARSER::parsePinNames( std::unique_ptr<LIB_SYMBOL>& aSymbol )
}
else if( token != T_RIGHT )
{
error.Printf( _( "Invalid symbol names definition in\nfile: '%s'\nline: %d\noffset: %d" ),
CurSource().c_str(),
CurLineNumber(),
CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid pin names definition" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
}
@ -799,22 +770,16 @@ LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>& aSymbol
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid property name in\nfile: '%s'\nline: %d\noffset: %d" ),
CurSource().c_str(),
CurLineNumber(),
CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid property name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
name = FromUTF8();
if( name.IsEmpty() )
{
error.Printf( _( "Empty property name in\nfile: '%s'\nline: %d\noffset: %d" ),
CurSource().c_str(),
CurLineNumber(),
CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Empty property name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
field->SetName( name );
@ -822,11 +787,8 @@ LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>& aSymbol
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid property value in\nfile: '%s'\nline: %d\noffset: %d" ),
CurSource().c_str(),
CurLineNumber(),
CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid property value" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
// Empty property values are valid.
@ -1309,9 +1271,8 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid pin name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid pin name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
if( m_requiredVersion < 20210606 )
@ -1348,9 +1309,8 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid pin number in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid pin number" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
pin->SetNumber( FromUTF8() );
@ -1386,9 +1346,8 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid alternate pin name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid alternate pin name" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
alt.m_Name = FromUTF8();
@ -1543,7 +1502,6 @@ LIB_TEXT* SCH_SEXPR_PARSER::parseText()
T token;
wxString tmp;
wxString error;
std::unique_ptr<LIB_TEXT> text = std::make_unique<LIB_TEXT>( nullptr );
text->SetUnit( m_unit );
@ -1552,9 +1510,8 @@ LIB_TEXT* SCH_SEXPR_PARSER::parseText()
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid text string in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid text string" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
text->SetText( FromUTF8() );
@ -1600,9 +1557,8 @@ void SCH_SEXPR_PARSER::parsePAGE_INFO( PAGE_INFO& aPageInfo )
if( !aPageInfo.SetType( pageType ) )
{
wxString err;
err.Printf( _( "Page type \"%s\" is not valid " ), FromUTF8() );
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
THROW_PARSE_ERROR( _( "Invalid page type" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
if( pageType == PAGE_INFO::Custom )
@ -1729,9 +1685,8 @@ void SCH_SEXPR_PARSER::parseTITLE_BLOCK( TITLE_BLOCK& aTitleBlock )
break;
default:
wxString err;
err.Printf( wxT( "%d is not a valid title block comment number" ), commentNumber );
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
THROW_PARSE_ERROR( _( "Invalid title block comment number" ), CurSource(),
CurLine(), CurLineNumber(), CurOffset() );
}
break;
@ -1752,39 +1707,32 @@ SCH_FIELD* SCH_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent )
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as a property token." ) );
wxString error;
wxString name;
wxString value;
T token = NextTok();
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid property name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid property name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
name = FromUTF8();
wxString name = FromUTF8();
if( name.IsEmpty() )
{
error.Printf( _( "Empty property name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Empty property name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
token = NextTok();
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid property value in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid property value" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
// Empty property values are valid.
value = FromUTF8();
wxString value = FromUTF8();
std::unique_ptr<SCH_FIELD> field = std::make_unique<SCH_FIELD>( wxDefaultPosition, -1, aParent, name );
@ -1831,29 +1779,23 @@ SCH_SHEET_PIN* SCH_SEXPR_PARSER::parseSchSheetPin( SCH_SHEET* aSheet )
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as a sheet pin token." ) );
wxString error;
wxString name;
wxString shape;
T token = NextTok();
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid sheet pin name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid sheet pin name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
name = FromUTF8();
wxString name = FromUTF8();
if( name.IsEmpty() )
{
error.Printf( _( "Empty sheet pin name in\nfile: \"%s\"\nline: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Empty sheet pin name" ), CurSource(), CurLine(), CurLineNumber(),
CurOffset() );
}
std::unique_ptr<SCH_SHEET_PIN> sheetPin = std::make_unique<SCH_SHEET_PIN>( aSheet, wxPoint( 0, 0 ), name );
auto sheetPin = std::make_unique<SCH_SHEET_PIN>( aSheet, wxPoint( 0, 0 ), name );
token = NextTok();
@ -2272,7 +2214,6 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
T token;
wxString tmp;
wxString error;
wxString libName;
SCH_FIELD* field;
std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();
@ -2301,10 +2242,8 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
if( !IsSymbol( token ) )
{
error.Printf( _( "Invalid symbol library name in\nfile: \"%s\"\n"
"line: %d\noffset: %d" ),
CurSource().c_str(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid symbol library name" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
libName = FromUTF8();
@ -2323,10 +2262,8 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
if( libId.Parse( FromUTF8() ) >= 0 )
{
error.Printf( _( "Invalid symbol library ID in\nfile: \"%s\"\nline: %d\n"
"offset: %d" ),
CurSource(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
THROW_PARSE_ERROR( _( "Invalid symbol library ID" ), CurSource(), CurLine(),
CurLineNumber(), CurOffset() );
}
symbol->SetLibId( libId );

View File

@ -1518,13 +1518,13 @@ void SCH_SEXPR_PLUGIN_CACHE::Load()
{
if( !m_libFileName.FileExists() )
{
THROW_IO_ERROR( wxString::Format( _( "Library file \"%s\" not found." ),
THROW_IO_ERROR( wxString::Format( _( "Library file '%s' not found." ),
m_libFileName.GetFullPath() ) );
}
wxCHECK_RET( m_libFileName.IsAbsolute(),
wxString::Format( "Cannot use relative file paths in sexpr plugin to "
"open library \"%s\".", m_libFileName.GetFullPath() ) );
"open library '%s'.", m_libFileName.GetFullPath() ) );
// The current locale must use period as the decimal point.
wxCHECK2( wxLocale::GetInfo( wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER ) == ".",

View File

@ -2607,7 +2607,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Load()
{
if( !m_libFileName.FileExists() )
{
THROW_IO_ERROR( wxString::Format( _( "Library file \"%s\" not found." ),
THROW_IO_ERROR( wxString::Format( _( "Library file '%s' not found." ),
m_libFileName.GetFullPath() ) );
}

View File

@ -504,8 +504,8 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
{
THROW_IO_ERROR( wxString::Format(
_( "Cannot create global library table path \"%s\"." ), fn.GetPath() ) );
THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path '%s'." ),
fn.GetPath() ) );
}
// Attempt to copy the default global file table from the KiCad

View File

@ -455,8 +455,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
case LAYER_TYPE::ASSCOMPCOPP:
case LAYER_TYPE::NOLAYER:
//Shouldn't be here if CPA file is correctly parsed and not corrupt
THROW_IO_ERROR( wxString::Format(
_( "Unexpected layer '%s' in layer stack." ), curLayer.Name ) );
THROW_IO_ERROR( wxString::Format( _( "Unexpected layer '%s' in layer stack." ),
curLayer.Name ) );
break;
case LAYER_TYPE::JUMPERLAYER:
@ -1213,17 +1213,17 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadGroups()
{
if( m_groupMap.find( csGroup.ID ) == m_groupMap.end() )
{
THROW_IO_ERROR( wxString::Format(
_( "The file appears to be corrupt. Unable to find group ID %s "
"in the group definitions." ),
csGroup.ID ) );
THROW_IO_ERROR( wxString::Format( _( "Unable to find group ID %s in the group "
"definitions." ),
csGroup.ID ) );
}
else if( m_groupMap.find( csGroup.ID ) == m_groupMap.end() )
{
THROW_IO_ERROR( wxString::Format(
_( "The file appears to be corrupt. Unable to find sub group %s "
"in the group map (parent group ID=%s, Name=%s)." ),
csGroup.GroupID, csGroup.ID, csGroup.Name ) );
THROW_IO_ERROR( wxString::Format( _( "Unable to find sub group %s in the group "
"map (parent group ID=%s, Name=%s)." ),
csGroup.GroupID,
csGroup.ID,
csGroup.Name ) );
}
else
{
@ -1535,18 +1535,19 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadAreas()
zone->SetDoNotAllowVias( area.NoVias );
if( area.Placement )
wxLogWarning( wxString::Format(
_( "The CADSTAR area '%s' is marked as a placement area in CADSTAR. "
"Placement areas are not supported in KiCad. Only the supported "
"elements for the area were imported." ),
area.Name ) );
{
wxLogWarning( wxString::Format( _( "The CADSTAR area '%s' is marked as a placement "
"area in CADSTAR. Placement areas are not "
"supported in KiCad. Only the supported elements "
"for the area were imported." ),
area.Name ) );
}
}
else
{
wxLogError(
wxString::Format( _( "The CADSTAR area '%s' does not have a KiCad equivalent. "
"Pure Placement areas are not supported." ),
area.Name ) );
wxLogError( wxString::Format( _( "The CADSTAR area '%s' does not have a KiCad "
"equivalent. Pure Placement areas are not supported." ),
area.Name ) );
}
//todo Process area.AreaHeight when KiCad supports 3D design rules
@ -1573,7 +1574,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents()
{
THROW_IO_ERROR( wxString::Format( _( "Unable to find component '%s' in the library"
"(Symdef ID: '%s')" ),
comp.Name, comp.SymdefID ) );
comp.Name,
comp.SymdefID ) );
}
FOOTPRINT* libFootprint = fpIter->second;

View File

@ -59,15 +59,14 @@ void CADSTAR_PCB_ARCHIVE_PARSER::Parse()
{
if( Header.Format.Type == wxT( "LIBRARY" ) )
{
THROW_IO_ERROR(
"The selected file is a CADSTAR Library file (as opposed to a Layout "
"file). CADSTAR libraries cannot yet be imported into KiCad." );
THROW_IO_ERROR( "The selected file is a CADSTAR library file (as opposed to a "
"layout file). CADSTAR libraries cannot yet be imported into "
"KiCad." );
}
else
{
THROW_IO_ERROR(
"The selected file is an unknown CADSTAR format so cannot be "
"imported into KiCad." );
THROW_IO_ERROR( "The selected file is an unknown CADSTAR format so cannot be "
"imported into KiCad." );
}
}
}

View File

@ -747,7 +747,7 @@ void LEGACY_PLUGIN::loadSHEET()
if( !page.SetType( wname ) )
{
m_error.Printf( _( "Unknown sheet type \"%s\" on line:%d" ),
m_error.Printf( _( "Unknown sheet type '%s' on line: %d." ),
wname.GetData(),
m_reader->LineNumber() );
THROW_IO_ERROR( m_error );
@ -1427,9 +1427,8 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
}
}
wxString msg = wxString::Format(
_( "Missing '$EndMODULE' for MODULE \"%s\"" ), aFootprint->GetFPID().GetLibItemName().wx_str() );
wxString msg = wxString::Format( _( "Missing '$EndMODULE' for MODULE '%s'." ),
aFootprint->GetFPID().GetLibItemName().wx_str() );
THROW_IO_ERROR( msg );
}
@ -1478,7 +1477,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
case 'O': padshape = static_cast<int>( PAD_SHAPE::OVAL ); break;
case 'T': padshape = static_cast<int>( PAD_SHAPE::TRAPEZOID ); break;
default:
m_error.Printf( _( "Unknown padshape '%c=0x%02x' on line: %d of footprint: \"%s\"" ),
m_error.Printf( _( "Unknown padshape '%c=0x%02x' on line: %d of footprint: '%s'." ),
padchar,
padchar,
m_reader->LineNumber(),
@ -1683,12 +1682,11 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
case 'A': shape = PCB_SHAPE_TYPE::ARC; break;
case 'P': shape = PCB_SHAPE_TYPE::POLYGON; break;
default:
m_error.Printf( _( "Unknown FP_SHAPE type:'%c=0x%02x' on line:%d of footprint:\"%s\"" ),
m_error.Printf( _( "Unknown FP_SHAPE type:'%c=0x%02x' on line %d of footprint '%s'." ),
(unsigned char) line[1],
(unsigned char) line[1],
m_reader->LineNumber(),
aFootprint->GetFPID().GetLibItemName().wx_str()
);
aFootprint->GetFPID().GetLibItemName().wx_str() );
THROW_IO_ERROR( m_error );
}

View File

@ -745,7 +745,7 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS
m_layersStackup.Add( layerName );
if( m_layersStackup.size() > 32 )
THROW_IO_ERROR( _( "KiCad only supports 32 signal layers" ) );
THROW_IO_ERROR( _( "KiCad only supports 32 signal layers." ) );
}
}
}

View File

@ -29,6 +29,7 @@
#include <xnode.h>
#include <wx/string.h>
#include <wx/translation.h>
namespace PCAD2KICAD {
@ -87,7 +88,7 @@ void PCB_VIA::Parse( XNODE* aNode,
lNode = FindNode( lNode, wxT( "library" ) );
if ( !lNode )
THROW_IO_ERROR( wxT( "Unable to find library section" ) );
THROW_IO_ERROR( _( "Unable to find library section." ) );
lNode = FindNode( lNode, wxT( "viaStyleDef" ) );
@ -102,7 +103,7 @@ void PCB_VIA::Parse( XNODE* aNode,
}
if ( !lNode )
THROW_IO_ERROR( wxString::Format( wxT( "Unable to find viaStyleDef " ) + m_name.text ) );
THROW_IO_ERROR( wxString::Format( _( "Unable to find viaStyleDef %s." ), m_name.text ) );
if( lNode )
{

View File

@ -220,9 +220,12 @@ PCB_VIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNe
{
shape = (SHAPE*) (*aPadstack)[0];
DSN_T type = shape->shape->Type();
if( type != T_circle )
THROW_IO_ERROR(
wxString::Format( _( "Unsupported via shape: %s" ), GetTokenString( type ) ) );
{
THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s." ),
GetTokenString( type ) ) );
}
CIRCLE* circle = (CIRCLE*) shape->shape;
int viaDiam = scale( circle->diameter, m_routeResolution );
@ -495,8 +498,8 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard )
// wire_via to text and put that text into the exception.
wxString psid( FROM_UTF8( wire_via->GetPadstackId().c_str() ) );
THROW_IO_ERROR( wxString::Format(
_( "A wire_via references a missing padstack \"%s\"" ), psid ) );
THROW_IO_ERROR( wxString::Format( _( "A wire_via refers to missing padstack '%s'." ),
psid ) );
}
NETCLASSPTR netclass = aBoard->GetDesignSettings().GetNetClasses().GetDefault();