| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_QTGUI_ELEMENTTRANSLATOR_H |
| 7 |
#define AVOGADRO_QTGUI_ELEMENTTRANSLATOR_H |
| 8 |
|
| 9 |
#include "avogadroqtguiexport.h" |
| 10 |
#include <QtCore/QObject> |
| 11 |
|
| 12 |
namespace Avogadro { |
| 13 |
namespace QtGui { |
| 14 |
|
| 15 |
/** |
| 16 |
* @class ElementTranslator elementtranslator.h |
| 17 |
* <avogadro/qtgui/elementtranslator.h> |
| 18 |
* @brief Internationalization of element names. |
| 19 |
* @author Geoff Hutchison |
| 20 |
* |
| 21 |
* This class provides for translation of element names: e.g., tr("Carbon") |
| 22 |
* To use the global translator: |
| 23 |
* @code |
| 24 |
* #include <avogadro/elementtranslator.h> |
| 25 |
* ... |
| 26 |
* Avogadro::elementTranslator.name(6); // Return "carbon" in English |
| 27 |
* @endcode |
| 28 |
*/ |
| 29 |
class AVOGADROQTGUI_EXPORT ElementTranslator : public QObject |
| 30 |
{ |
| 31 |
Q_OBJECT |
| 32 |
|
| 33 |
public: |
| 34 |
ElementTranslator(); |
| 35 |
|
| 36 |
/** |
| 37 |
* Translate element names. |
| 38 |
* @param element The atomic number of the element to be translated. |
| 39 |
* @return a QString with the appropriate translation for the current locale. |
| 40 |
*/ |
| 41 |
static QString name(int element); |
| 42 |
|
| 43 |
/** |
| 44 |
* @return The highest atomic number supported by this class. |
| 45 |
*/ |
| 46 |
static int numberOfElements(); |
| 47 |
}; |
| 48 |
|
| 49 |
} // End namespace QtGui |
| 50 |
} // End namespace Avogadro |
| 51 |
|
| 52 |
#endif |