diff options
Diffstat (limited to 'src/FbTk/I18n.hh')
-rw-r--r-- | src/FbTk/I18n.hh | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/FbTk/I18n.hh b/src/FbTk/I18n.hh index cbf241d..9a936d8 100644 --- a/src/FbTk/I18n.hh +++ b/src/FbTk/I18n.hh | |||
@@ -68,20 +68,36 @@ void catclose(nl_catd cat); | |||
68 | FbTk::I18n &i18n = *FbTk::I18n::instance() | 68 | FbTk::I18n &i18n = *FbTk::I18n::instance() |
69 | 69 | ||
70 | // ignore the description, it's for helping translators | 70 | // ignore the description, it's for helping translators |
71 | #define _FBTEXT(msgset, msgid, default_text, description) \ | 71 | |
72 | i18n.getMessage(FBNLS::msgset ## Set, FBNLS::msgset ## msgid, default_text) | 72 | // Text for X |
73 | 73 | #define _FB_XTEXT(msgset, msgid, default_text, description) \ | |
74 | i18n.getMessage(FBNLS::msgset ## Set, FBNLS::msgset ## msgid, default_text, true) | ||
75 | |||
76 | // Text for console | ||
77 | #define _FB_CONSOLETEXT(msgset, msgid, default_text, description) \ | ||
78 | i18n.getMessage(FBNLS::msgset ## Set, FBNLS::msgset ## msgid, default_text, false) | ||
79 | |||
74 | // This ensure that FbTk nls stuff is in a kind of namespace of its own | 80 | // This ensure that FbTk nls stuff is in a kind of namespace of its own |
75 | #define _FBTKTEXT( msgset, msgid, default_text, description) \ | 81 | #define _FBTK_XTEXT( msgset, msgid, default_text, description) \ |
76 | i18n.getMessage(FBNLS::FbTk ## msgset ## Set, FBNLS::FbTk ## msgset ## msgid, default_text) | 82 | i18n.getMessage(FBNLS::FbTk ## msgset ## Set, FBNLS::FbTk ## msgset ## msgid, default_text, true) |
83 | |||
84 | #define _FBTK_CONSOLETEXT( msgset, msgid, default_text, description) \ | ||
85 | i18n.getMessage(FBNLS::FbTk ## msgset ## Set, FBNLS::FbTk ## msgset ## msgid, default_text, false) | ||
77 | 86 | ||
78 | #else // no NLS | 87 | #else // no NLS |
79 | 88 | ||
80 | #define _FB_USES_NLS | 89 | #define _FB_USES_NLS |
81 | #define _FBTEXT(msgset, msgid, default_text, description) \ | 90 | |
91 | #define _FB_XTEXT(msgset, msgid, default_text, description) \ | ||
82 | std::string(default_text) | 92 | std::string(default_text) |
83 | 93 | ||
84 | #define _FBTKTEXT(msgset, msgid, default_text, description) \ | 94 | #define _FB_CONSOLETEXT(msgset, msgid, default_text, description) \ |
95 | std::string(default_text) | ||
96 | |||
97 | #define _FBTK_XTEXT(msgset, msgid, default_text, description) \ | ||
98 | std::string(default_text) | ||
99 | |||
100 | #define _FBTK_CONSOLETEXT(msgset, msgid, default_text, description) \ | ||
85 | std::string(default_text) | 101 | std::string(default_text) |
86 | 102 | ||
87 | #endif // defined NLS | 103 | #endif // defined NLS |
@@ -96,15 +112,17 @@ public: | |||
96 | inline const nl_catd &getCatalogFd() const { return m_catalog_fd; } | 112 | inline const nl_catd &getCatalogFd() const { return m_catalog_fd; } |
97 | 113 | ||
98 | FbString getMessage(int set_number, int message_number, | 114 | FbString getMessage(int set_number, int message_number, |
99 | const char *default_messsage = 0) const; | 115 | const char *default_messsage = 0, bool translate_fb = false) const; |
116 | |||
100 | void openCatalog(const char *catalog); | 117 | void openCatalog(const char *catalog); |
101 | private: | 118 | private: |
102 | I18n(); | 119 | I18n(); |
103 | ~I18n(); | 120 | ~I18n(); |
104 | std::string m_locale; | 121 | std::string m_locale; |
105 | bool m_multibyte; | 122 | bool m_multibyte, m_utf8_translate; |
106 | nl_catd m_catalog_fd; | 123 | nl_catd m_catalog_fd; |
107 | 124 | ||
125 | |||
108 | }; | 126 | }; |
109 | 127 | ||
110 | void NLSInit(const char *); | 128 | void NLSInit(const char *); |