Skip to content

Commit

Permalink
Add QgsApplication::translation as counterpart to QgsApplication::set…
Browse files Browse the repository at this point in the history
…Translation
  • Loading branch information
manisandro authored and nyalldawson committed Jun 21, 2021
1 parent a8c1be6 commit a29ce54
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
11 changes: 10 additions & 1 deletion python/core/auto_generated/qgsapplication.sip.in
Expand Up @@ -994,9 +994,18 @@ The maximum number of concurrent connections per connections pool.

static void setTranslation( const QString &translation );
%Docstring
Set translation
Set translation locale code

.. versionadded:: 3.4
%End

QString translation() const;
%Docstring
Returns the current application translation locale code

.. seealso:: :py:func:`setTranslation`

.. versionadded:: 3.22
%End

void collectTranslatableObjects( QgsTranslationContext *translationContext );
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -1922,6 +1922,11 @@ void QgsApplication::setTranslation( const QString &translation )
*sTranslation() = translation;
}

QString QgsApplication::translation() const
{
return *sTranslation();
}

void QgsApplication::collectTranslatableObjects( QgsTranslationContext *translationContext )
{
emit requestForTranslatableObjects( translationContext );
Expand Down
9 changes: 8 additions & 1 deletion src/core/qgsapplication.h
Expand Up @@ -934,12 +934,19 @@ class CORE_EXPORT QgsApplication : public QApplication
int maxConcurrentConnectionsPerPool() const;

/**
* Set translation
* Set translation locale code
*
* \since QGIS 3.4
*/
static void setTranslation( const QString &translation );

/**
* Returns the current application translation locale code
* \see setTranslation()
* \since QGIS 3.22
*/
QString translation() const;

/**
* Emits the signal to collect all the strings of .qgs to be included in ts file
*
Expand Down

0 comments on commit a29ce54

Please sign in to comment.