revert (goofy FOREACH macro scoping needs fixing first)
This commit is contained in:
@@ -463,92 +463,96 @@ void LanguagesDlg::OnBnClickedCheckLanguage()
|
|||||||
RString sFullFile = SpecialDirs::GetDesktopDir() + sFile;
|
RString sFullFile = SpecialDirs::GetDesktopDir() + sFile;
|
||||||
file.Open( sFullFile, RageFile::WRITE );
|
file.Open( sFullFile, RageFile::WRITE );
|
||||||
|
|
||||||
FOREACH_CONST_Child( &ini1, key )
|
|
||||||
{
|
{
|
||||||
FOREACH_CONST_Attr( key, value )
|
FOREACH_CONST_Child( &ini1, key )
|
||||||
{
|
{
|
||||||
const RString &sSection = key->m_sName;
|
FOREACH_CONST_Attr( key, value )
|
||||||
const RString &sID = value->first;
|
|
||||||
const RString &sBaseLanguage = value->second;
|
|
||||||
RString sCurrentLanguage;
|
|
||||||
ini2.GetValue( sSection, sID, sCurrentLanguage );
|
|
||||||
|
|
||||||
if( sCurrentLanguage.empty() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Check &FOO;, %{foo}, %-1.2f, %. Some mismatches here are normal, particularly in
|
|
||||||
* languages with substantially different word order rules than English. */
|
|
||||||
{
|
{
|
||||||
RString sRegex = "(&[A-Za-z]+;|%{[A-Za-z]+}|%[+-]?[0-9]*.?[0-9]*[sidf]|%)";
|
const RString &sSection = key->m_sName;
|
||||||
vector<RString> asMatchesBase;
|
const RString &sID = value->first;
|
||||||
GetAllMatches( sRegex, sBaseLanguage, asMatchesBase );
|
const RString &sBaseLanguage = value->second;
|
||||||
|
RString sCurrentLanguage;
|
||||||
|
ini2.GetValue( sSection, sID, sCurrentLanguage );
|
||||||
|
|
||||||
vector<RString> asMatches;
|
if( sCurrentLanguage.empty() )
|
||||||
GetAllMatches( sRegex, sCurrentLanguage, asMatches );
|
continue;
|
||||||
|
|
||||||
if( asMatchesBase.size() != asMatches.size() ||
|
/* Check &FOO;, %{foo}, %-1.2f, %. Some mismatches here are normal, particularly in
|
||||||
!std::equal(asMatchesBase.begin(), asMatchesBase.end(), asMatches.begin()) )
|
* languages with substantially different word order rules than English. */
|
||||||
{
|
{
|
||||||
file.PutLine( ssprintf("Entity/substitution mismatch in section [%s] (%s):", sSection.c_str(), sID.c_str()) );
|
RString sRegex = "(&[A-Za-z]+;|%{[A-Za-z]+}|%[+-]?[0-9]*.?[0-9]*[sidf]|%)";
|
||||||
file.PutLine( ssprintf(" %s", sCurrentLanguage.c_str()) );
|
vector<RString> asMatchesBase;
|
||||||
file.PutLine( ssprintf(" %s", sBaseLanguage.c_str()) );
|
GetAllMatches( sRegex, sBaseLanguage, asMatchesBase );
|
||||||
|
|
||||||
|
vector<RString> asMatches;
|
||||||
|
GetAllMatches( sRegex, sCurrentLanguage, asMatches );
|
||||||
|
|
||||||
|
if( asMatchesBase.size() != asMatches.size() ||
|
||||||
|
!std::equal(asMatchesBase.begin(), asMatchesBase.end(), asMatches.begin()) )
|
||||||
|
{
|
||||||
|
file.PutLine( ssprintf("Entity/substitution mismatch in section [%s] (%s):", sSection.c_str(), sID.c_str()) );
|
||||||
|
file.PutLine( ssprintf(" %s", sCurrentLanguage.c_str()) );
|
||||||
|
file.PutLine( ssprintf(" %s", sBaseLanguage.c_str()) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Check "foo::bar", "foo\nbar" and double quotes. Check these independently
|
/* Check "foo::bar", "foo\nbar" and double quotes. Check these independently
|
||||||
* of the above. */
|
* of the above. */
|
||||||
{
|
|
||||||
RString sRegex = "(\"|::|\\n)";
|
|
||||||
vector<RString> asMatchesBase;
|
|
||||||
GetAllMatches( sRegex, sBaseLanguage, asMatchesBase );
|
|
||||||
|
|
||||||
vector<RString> asMatches;
|
|
||||||
GetAllMatches( sRegex, sCurrentLanguage, asMatches );
|
|
||||||
|
|
||||||
if( asMatchesBase.size() != asMatches.size() ||
|
|
||||||
!std::equal(asMatchesBase.begin(), asMatchesBase.end(), asMatches.begin()) )
|
|
||||||
{
|
{
|
||||||
file.PutLine( ssprintf("Quote/line break mismatch in section [%s] (%s):", sSection.c_str(), sID.c_str()) );
|
RString sRegex = "(\"|::|\\n)";
|
||||||
file.PutLine( ssprintf(" %s", sCurrentLanguage.c_str()) );
|
vector<RString> asMatchesBase;
|
||||||
file.PutLine( ssprintf(" %s", sBaseLanguage.c_str()) );
|
GetAllMatches( sRegex, sBaseLanguage, asMatchesBase );
|
||||||
|
|
||||||
|
vector<RString> asMatches;
|
||||||
|
GetAllMatches( sRegex, sCurrentLanguage, asMatches );
|
||||||
|
|
||||||
|
if( asMatchesBase.size() != asMatches.size() ||
|
||||||
|
!std::equal(asMatchesBase.begin(), asMatchesBase.end(), asMatches.begin()) )
|
||||||
|
{
|
||||||
|
file.PutLine( ssprintf("Quote/line break mismatch in section [%s] (%s):", sSection.c_str(), sID.c_str()) );
|
||||||
|
file.PutLine( ssprintf(" %s", sCurrentLanguage.c_str()) );
|
||||||
|
file.PutLine( ssprintf(" %s", sBaseLanguage.c_str()) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_CONST_Child( &ini1, key )
|
|
||||||
{
|
{
|
||||||
bool bFirst = true;
|
FOREACH_CONST_Child( &ini1, key )
|
||||||
RString sLastSection;
|
|
||||||
RString sLine;
|
|
||||||
FOREACH_CONST_Attr( key, value )
|
|
||||||
{
|
{
|
||||||
const RString &sSection = key->m_sName;
|
bool bFirst = true;
|
||||||
const RString &sID = value->first;
|
RString sLastSection;
|
||||||
RString sCurrentLanguage;
|
RString sLine;
|
||||||
ini2.GetValue( sSection, sID, sCurrentLanguage );
|
FOREACH_CONST_Attr( key, value )
|
||||||
if( !sCurrentLanguage.empty() )
|
{
|
||||||
continue;
|
const RString &sSection = key->m_sName;
|
||||||
|
const RString &sID = value->first;
|
||||||
|
RString sCurrentLanguage;
|
||||||
|
ini2.GetValue( sSection, sID, sCurrentLanguage );
|
||||||
|
if( !sCurrentLanguage.empty() )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( bFirst )
|
if( bFirst )
|
||||||
{
|
{
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
file.PutLine( ssprintf("Not translated in section [%s]:", sSection.c_str()) );
|
file.PutLine( ssprintf("Not translated in section [%s]:", sSection.c_str()) );
|
||||||
}
|
}
|
||||||
if( sLine.size() + sID.size() > 100 )
|
if( sLine.size() + sID.size() > 100 )
|
||||||
{
|
{
|
||||||
file.PutLine( sLine );
|
file.PutLine( sLine );
|
||||||
sLine = "";
|
sLine = "";
|
||||||
|
}
|
||||||
|
if( sLine.size() )
|
||||||
|
sLine += ", ";
|
||||||
|
else
|
||||||
|
sLine += " ";
|
||||||
|
|
||||||
|
sLine += sID;
|
||||||
}
|
}
|
||||||
if( sLine.size() )
|
if( sLine.size() )
|
||||||
sLine += ", ";
|
file.PutLine( sLine );
|
||||||
else
|
|
||||||
sLine += " ";
|
|
||||||
|
|
||||||
sLine += sID;
|
|
||||||
}
|
}
|
||||||
if( sLine.size() )
|
|
||||||
file.PutLine( sLine );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file.Close();
|
file.Close();
|
||||||
|
|||||||
Reference in New Issue
Block a user