QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgstranslationcontext.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstranslationcontext.h
3
4 ---------------------
5 begin : 23.5.2018
6 copyright : (C) 2018 by David Signer
7 email : david at opengis dot ch
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSTRANSLATIONCONTEXT_H
17#define QGSTRANSLATIONCONTEXT_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21
22#include <QList>
23#include <QString>
24
25class QgsProject;
26
34
35class CORE_EXPORT QgsTranslationContext
36{
37
41 struct TranslatableObject
42 {
43 QString context;
44 QString source;
45
46 bool operator==( const TranslatableObject &other ) const { return context == other.context && source == other.source; }
47 };
48
49 public:
50
52
57 QgsProject *project() const;
58
65
70 QString fileName() const;
71
77 void setFileName( const QString &fileName );
78
83 void registerTranslation( const QString &context, const QString &source );
84
88 void writeTsFile( const QString &locale ) const;
89
90 private:
91
92 QgsProject *mProject = nullptr;
93 QString mFileName;
94 QList < TranslatableObject > mTranslatableObjects;
95
96};
97
98#endif // QGSTRANSLATIONCONTEXT_H
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
QString fileName() const
Returns the TS fileName.
void registerTranslation(const QString &context, const QString &source)
Registers the source to be translated.
QgsProject * project() const
Returns the project.
QgsTranslationContext()=default
void setFileName(const QString &fileName)
Sets the fileName of the TS file.
void writeTsFile(const QString &locale) const
Writes the Ts-file.
void setProject(QgsProject *project)
Sets the project being translated.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)