1 /*************************************************************************** 2 qgsprojecttranslator.h 3 4 --------------------- 5 begin : 24.7.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 QGSPROJECTTRANSLATOR_H 17 #define QGSPROJECTTRANSLATOR_H 18 19 #include "qgis_core.h" 20 #include "qgis_sip.h" 21 #include <QString> 22 23 /** 24 * \ingroup core 25 * \brief Wherever an object of this class is available, the derived translate function can be called from. 26 * 27 * \since QGIS 3.4 28 */ 29 30 class CORE_EXPORT QgsProjectTranslator 31 { 32 public: 33 34 /** 35 * The derived translate() translates with QTranslator and qm file the sourceText. 36 * It \returns the result string and in case there is no QTranslator loaded, the sourceText. 37 * This function can be called from wherever the QgsReadWriteContext is available. 38 * 39 * \param context describing layer etc. 40 * \param sourceText is the identifier of this text 41 * \param disambiguation it's the disambiguation 42 * \param n if -1 uses the appropriate form 43 * 44 * \since QGIS 3.4 45 */ 46 47 virtual QString translate( const QString &context, const QString &sourceText, const char *disambiguation = nullptr, int n = -1 ) const = 0; 48 49 virtual ~QgsProjectTranslator() = default; 50 }; 51 52 #endif // QGSPROJECTTRANSLATOR_H 53