QGIS API Documentation 4.1.0-Master (60fea48833c)
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{
40 struct TranslatableObject
41 {
42 QString context;
43 QString source;
44
45 bool operator==( const TranslatableObject &other ) const { return context == other.context && source == other.source; }
46 };
47
48 public:
50
55 QgsProject *project() const;
56
63
68 QString fileName() const;
69
75 void setFileName( const QString &fileName );
76
81 void registerTranslation( const QString &context, const QString &source );
82
86 void writeTsFile( const QString &locale ) const;
87
88 private:
89 QgsProject *mProject = nullptr;
90 QString mFileName;
91 QList< TranslatableObject > mTranslatableObjects;
92};
93
94#endif // QGSTRANSLATIONCONTEXT_H
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:113
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)