| | 8 | |
| | 9 | #ifdef ENABLE_NLS |
| | 10 | |
| | 11 | BOOST_AUTO_TEST_CASE(gettextaaaooaaa) |
| | 12 | { |
| | 13 | using namespace std; |
| | 14 | |
| | 15 | #if defined(_UNICODE) && defined(UNICODE) |
| | 16 | WCHAR hello_world_ja[] = { |
| | 17 | 0x4E16, 0x754C, 0x3088, 0x002C, |
| | 18 | 0x0020, 0x3053, 0x3093, 0x306B, |
| | 19 | 0x3061, 0x306F, 0x0021, 0x0000, |
| | 20 | }; |
| | 21 | #else |
| | 22 | CHAR hello_world_ja[] = { |
| | 23 | 0x90, 0xA2, 0x8A, 0x45, 0x82, 0xE6, 0x2C, |
| | 24 | 0x20, 0x82, 0xB1, 0x82, 0xF1, 0x82, 0xC9, |
| | 25 | 0x82, 0xBF, 0x82, 0xCD, 0x21, 0x00, |
| | 26 | }; |
| | 27 | #endif |
| | 28 | init_windows_gettext(); |
| | 29 | |
| | 30 | basic_string<TCHAR> got; |
| | 31 | |
| | 32 | BOOST_REQUIRE(putenv("LANGUAGE=en") == 0); |
| | 33 | got = (const TCHAR*)_("Hello, world!"); |
| | 34 | BOOST_REQUIRE(got == _T("Hello, world!")); |
| | 35 | |
| | 36 | BOOST_REQUIRE(putenv("LANGUAGE=ja") == 0); |
| | 37 | got = (const TCHAR*)_("Hello, world!"); |
| | 38 | BOOST_REQUIRE(got == hello_world_ja); |
| | 39 | |
| | 40 | BOOST_REQUIRE(putenv("LANGUAGE=en") == 0); |
| | 41 | got = (const TCHAR*)_("Hello, world!"); |
| | 42 | BOOST_REQUIRE(got == _T("Hello, world!")); |
| | 43 | } |
| | 44 | |
| | 45 | #endif |
| | 46 | |