Skip to content

Commit

Permalink
added: $LOCALIZE[id] in scrapers
Browse files Browse the repository at this point in the history
  • Loading branch information
spiff committed Apr 30, 2012
1 parent 4505d08 commit 5c5bd1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addons/xbmc.metadata/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="xbmc.metadata" version="2.0" provider-name="Team XBMC">
<addon id="xbmc.metadata" version="2.1" provider-name="Team XBMC">
<backwards-compatibility abi="1.0"/>
<requires>
<import addon="xbmc.core" version="0.1"/>
Expand Down
12 changes: 12 additions & 0 deletions xbmc/utils/ScraperParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ void CScraperParser::ReplaceBuffers(CStdString& strDest)
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace);
iIndex += strReplace.length();
}
// insert localize strings
iIndex = 0;
while ((size_t)(iIndex = strDest.find("$LOCALIZE[",iIndex)) != CStdString::npos)
{
int iEnd = strDest.Find("]",iIndex);
CStdString strInfo = strDest.Mid(iIndex+10,iEnd-iIndex-10);
CStdString strReplace;
if (m_scraper)
strReplace = m_scraper->GetString(strtol(strInfo.c_str(),NULL,10));
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace);
iIndex += strReplace.length();
}
iIndex = 0;
while ((size_t)(iIndex = strDest.find("\\n",iIndex)) != CStdString::npos)
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+2,"\n");
Expand Down

0 comments on commit 5c5bd1d

Please sign in to comment.