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