]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/locale-util.h
Merge pull request #10805 from poettering/migrate-boot-loader-interface
[thirdparty/systemd.git] / src / basic / locale-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <libintl.h>
5 #include <stdbool.h>
6 #include <locale.h>
7
8 #include "macro.h"
9
10 typedef enum LocaleVariable {
11 /* We don't list LC_ALL here on purpose. People should be
12 * using LANG instead. */
13
14 VARIABLE_LANG,
15 VARIABLE_LANGUAGE,
16 VARIABLE_LC_CTYPE,
17 VARIABLE_LC_NUMERIC,
18 VARIABLE_LC_TIME,
19 VARIABLE_LC_COLLATE,
20 VARIABLE_LC_MONETARY,
21 VARIABLE_LC_MESSAGES,
22 VARIABLE_LC_PAPER,
23 VARIABLE_LC_NAME,
24 VARIABLE_LC_ADDRESS,
25 VARIABLE_LC_TELEPHONE,
26 VARIABLE_LC_MEASUREMENT,
27 VARIABLE_LC_IDENTIFICATION,
28 _VARIABLE_LC_MAX,
29 _VARIABLE_LC_INVALID = -1
30 } LocaleVariable;
31
32 int get_locales(char ***l);
33 bool locale_is_valid(const char *name);
34
35 #define _(String) gettext(String)
36 #define N_(String) String
37 void init_gettext(void);
38
39 bool is_locale_utf8(void);
40
41 typedef enum {
42 TREE_VERTICAL,
43 TREE_BRANCH,
44 TREE_RIGHT,
45 TREE_SPACE,
46 TRIANGULAR_BULLET,
47 BLACK_CIRCLE,
48 ARROW,
49 MDASH,
50 ELLIPSIS,
51 MU,
52 CHECK_MARK,
53 CROSS_MARK,
54 _SPECIAL_GLYPH_MAX
55 } SpecialGlyph;
56
57 const char *special_glyph(SpecialGlyph code) _const_;
58
59 const char* locale_variable_to_string(LocaleVariable i) _const_;
60 LocaleVariable locale_variable_from_string(const char *s) _pure_;
61
62 int get_keymaps(char ***l);
63 bool keymap_is_valid(const char *name);
64
65 static inline void freelocalep(locale_t *p) {
66 if (*p == (locale_t) 0)
67 return;
68
69 freelocale(*p);
70 }
71
72 void locale_variables_free(char* l[_VARIABLE_LC_MAX]);
73 static inline void locale_variables_freep(char*(*l)[_VARIABLE_LC_MAX]) {
74 locale_variables_free(*l);
75 }