Skip to content

Commit

Permalink
empty translations in ts file
Browse files Browse the repository at this point in the history
and if empty in qm file take source value
  • Loading branch information
signedav committed Aug 22, 2018
1 parent 2c13e53 commit 3334b86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/core/qgsproject.cpp
Expand Up @@ -2834,5 +2834,11 @@ QString QgsProject::translate( const QString &context, const QString &sourceText
return sourceText;
}

return mTranslator->translate( context.toUtf8(), sourceText.toUtf8(), disambiguation, n );
QString result = mTranslator->translate( context.toUtf8(), sourceText.toUtf8(), disambiguation, n );

if ( result.isEmpty() )
{
return sourceText;
}
return result;
}
3 changes: 1 addition & 2 deletions src/core/qgstranslationcontext.cpp
Expand Up @@ -81,8 +81,7 @@ void QgsTranslationContext::writeTsFile( const QString &locale )
messageElement.appendChild( sourceElement );

QDomElement translationElement = doc.createElement( QStringLiteral( "translation" ) );
QDomText translationText = doc.createTextNode( translatableObject.source );
translationElement.appendChild( translationText );
translationElement.setAttribute( QStringLiteral( "type" ), QStringLiteral( "unfinished" ) );
messageElement.appendChild( translationElement );
}

Expand Down

0 comments on commit 3334b86

Please sign in to comment.