QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 #include "qgis.h"
22 
23 class QgsProject;
24 
33 class CORE_EXPORT QgsTranslationContext
34 {
35 
39  struct TranslatableObject
40  {
41  QString context;
42  QString source;
43  };
44 
45  public:
46 
50  QgsTranslationContext() = default;
51 
56  QgsProject *project() const;
57 
63  void setProject( QgsProject *project );
64 
69  QString fileName() const;
70 
76  void setFileName( const QString &fileName );
77 
82  void registerTranslation( const QString &context, const QString &source );
83 
87  void writeTsFile( const QString &locale );
88 
89  private:
90 
91  QgsProject *mProject = nullptr;
92  QString mFileName;
93  QList < TranslatableObject > mTranslatableObjects;
94 
95 };
96 
97 #endif // QGSTRANSLATIONCONTEXT_H
Reads and writes project states.
Definition: qgsproject.h:89
Used for the collecting of strings from projects for translation and creation of ts files...