-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.cpp
More file actions
26 lines (21 loc) · 692 Bytes
/
test.cpp
File metadata and controls
26 lines (21 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <string>
#include "cppgettext/cppgettext.h"
#define _(msg) cppgettext(msg)
int main()
{
Translations c, c2;
c.parser.parse_file("catalog.mo");
c2.parser.parse_file("catalog_2.mo");
c.set_fallback(&c2);
std::cout << c.gettext("hello original") << std::endl;
std::cout << c.gettext("a") << std::endl;
std::cout << c.gettext("c") << std::endl; // this is not in catalog
std::cout << c.gettext("not translated") << std::endl;
std::cout << std::endl;
std::cout << cppgettext("hello original") << std::endl;
c.install();
std::cout << cppgettext("hello original") << std::endl;
std::cout << _("hello original") << std::endl;
return 0;
}