1 | use std::os::raw::{c_char, c_int, c_ulong}; |
2 | |
3 | #[cfg (windows)] |
4 | #[allow (non_camel_case_types)] |
5 | type wchar_t = u16; |
6 | |
7 | extern "C" { |
8 | pub fn gettext(s: *const c_char) -> *mut c_char; |
9 | pub fn dgettext(domain: *const c_char, s: *const c_char) -> *mut c_char; |
10 | pub fn dcgettext(domain: *const c_char, s: *const c_char, category: c_int) -> *mut c_char; |
11 | |
12 | pub fn ngettext(s1: *const c_char, s2: *const c_char, n: c_ulong) -> *mut c_char; |
13 | pub fn dngettext( |
14 | domain: *const c_char, |
15 | s1: *const c_char, |
16 | s2: *const c_char, |
17 | n: c_ulong, |
18 | ) -> *mut c_char; |
19 | pub fn dcngettext( |
20 | domain: *const c_char, |
21 | s1: *const c_char, |
22 | s2: *const c_char, |
23 | n: c_ulong, |
24 | category: c_int, |
25 | ) -> *mut c_char; |
26 | |
27 | pub fn bindtextdomain(domain: *const c_char, dir: *const c_char) -> *mut c_char; |
28 | #[cfg (windows)] |
29 | // The "wbindtextdomain" symbol is not exposed directly in the compiled |
30 | // .DLL file when building using MinGW. See: https://github.com/Koka/gettext-rs/pull/79 |
31 | fn libintl_wbindtextdomain(domain: *const c_char, dir: *const wchar_t) -> *mut wchar_t; |
32 | |
33 | pub fn textdomain(domain: *const c_char) -> *mut c_char; |
34 | |
35 | pub fn bind_textdomain_codeset(domain: *const c_char, codeset: *const c_char) -> *mut c_char; |
36 | |
37 | pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char; |
38 | } |
39 | |
40 | #[cfg (windows)] |
41 | pub unsafe fn wbindtextdomain(domain: *const c_char, dir: *const wchar_t) -> *mut wchar_t { |
42 | libintl_wbindtextdomain(domain, dir) |
43 | } |
44 | |