00001
00002
00003
00004
00005
00006 #ifndef dsTranslation_h
00007 #define dsTranslation_h
00008
00009 #ifdef HAVE_CONFIG_H
00010 # include <config.h>
00011 #endif
00012
00013 #include <iostream>
00014
00015 #include <dsSmartException.h>
00016 #include <dsApprc.h>
00017 #include <xlat.h>
00018
00019 #ifdef NO_DS_TRANSLATION
00020 # define _XL(k) (k)
00021 # define _XL_PUSH(k)
00022 # define _XL_POP()
00023 #else
00024 # ifdef QT_UNICODE
00025 # define _XL(k) _qt_codec->toUnicode( _translation->translate(k) )
00026 # else
00027 # define _XL(k) _translation->translate(k)
00028 # endif
00029 # define _XL_PUSH(k) _translation->push(k)
00030 # define _XL_POP() _translation->pop()
00031 #endif
00032
00033
00034
00042 class dsTranslation : public dsApprc
00043 {
00044 bool _good;
00045 std::ostream *_os;
00046
00047 public:
00048 dsTranslation(int table = none);
00049 dsTranslation(std::istream& is, int table = none);
00050 dsTranslation(char *fname, int table = none);
00051
00052 char *translate(char *key);
00053 bool good();
00054
00055 bool isTranslated(char *key);
00056 void enableWarnings(std::ostream *os = &(std::cerr) );
00057 };
00058
00059 inline bool dsTranslation::good()
00060 { return _good;
00061 }
00062
00063 inline void dsTranslation::enableWarnings(std::ostream *os)
00064 {
00065 _os = os;
00066 }
00067
00068 #endif