Seamly2D
Code documentation
qmutranslation.h File Reference

The VTranslation class help store string for translation. More...

#include <QString>
Include dependency graph for qmutranslation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  qmu::QmuTranslation
 

Namespaces

 qmu
 Namespace for mathematical applications.
 

Detailed Description

The VTranslation class help store string for translation.

I took idea from this article http://ololoepepe.blogspot.com/2013/08/qt.html. As you know, if wrap string to a function translate, it will be marked for translation. No matter what namespace contains this function. In class Translation used this circumstance. This mean never change name of method translate!!!!!. Instead of using QT_TRANSLATE_NOOP3 macros we can store strings in QMap. Example: create map and fill up its QMap<QString, VTranslation> map; map.insert("head_girth", VTranslation::translate("Measurements", "head_girth", "Around fullest part of Head.")); get translated string map.value(measurement).translate();

Hint. Define macros translate() for reducing code complexity. #define translate(context, source, disambiguation) QmuTranslation::translate((context), (source), (disambiguation))

Don't forget to undef macros later!

Definition in file qmutranslation.h.