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