Fixed localization issues

Translate strings when retrieving the default annotation tool list, so
that we can assume that strings in the AnnotationTools setting are
translated.

Note: In future patches, I'll remove i18n strings from the default tool
list at all
This commit is contained in:
Fabio D'Urso 2012-06-11 19:11:48 +02:00
parent f5aa37c216
commit 13e10acf9c
3 changed files with 14 additions and 3 deletions

View File

@ -255,6 +255,17 @@
QDomElement toolElement = toolDescription.toElement();
if ( toolElement.tagName() == "tool" )
{
// Translate strings
toolElement.setAttribute( "name", i18n( toolElement.attribute("name").toUtf8() ) );
QDomNode tooltip = toolElement.elementsByTagName( "tooltip" ).item( 0 );
if ( tooltip.isElement() )
{
QDomElement trTooltip = doc.createElement( "tooltip" );
QString trTooltipStr = i18nc( "Annotation tool", tooltip.toElement().text().toUtf8() );
trTooltip.appendChild( doc.createTextNode( trTooltipStr ) );
toolElement.replaceChild( tooltip, trTooltip );
}
QDomDocument temp;
temp.appendChild( temp.importNode( toolElement, true) );
// add each <tool>...</tool> as XML string

View File

@ -6,5 +6,5 @@ Mutators=true
Singleton=true
Visibility=OKULAR_EXPORT
IncludeFiles=core/okular_export.h, settings_core.h
SourceIncludeFiles=kstandarddirs.h,qdom.h
SourceIncludeFiles=klocalizedstring.h,kstandarddirs.h,qdom.h
MemberVariables=dpointer

View File

@ -645,7 +645,7 @@ void PageViewAnnotator::reparseConfig()
{
AnnotationToolItem item;
item.id = toolElement.attribute("id").toInt();
item.text = i18n( toolElement.attribute( "name" ).toUtf8() );
item.text = toolElement.attribute( "name" );
item.pixmap = toolElement.attribute("pixmap");
QDomNode shortcutNode = toolElement.elementsByTagName( "shortcut" ).item( 0 );
if ( shortcutNode.isElement() )
@ -962,7 +962,7 @@ void PageViewAnnotator::slotToolSelected( int toolID )
{
const QString tip = toolSubElement.text();
if ( !tip.isEmpty() )
m_pageView->displayMessage( i18nc( "Annotation tool", tip.toUtf8() ), QString(), PageViewMessage::Annotation );
m_pageView->displayMessage( tip, QString(), PageViewMessage::Annotation );
}
}