blob: 262a6347ccb6880a4a51a10a8796a353e145e99e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
//
// Fluid Project Internationalization header for the Fast Light Tool Kit (FLTK).
//
// Copyright 2025 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#ifndef FLUID_PROJ_I18N_H
#define FLUID_PROJ_I18N_H
#include <FL/fl_string_functions.h>
#include <stdlib.h>
#include <string.h>
class Project;
/**
Enumeration of available internationalization types.
*/
typedef int I18n_Type;
enum {
FLD_I18N_TYPE_NONE = 0, ///< No i18n, all strings are litearals
FLD_I18N_TYPE_GNU, ///< GNU gettext internationalization
FLD_I18N_TYPE_POSIX ///< Posix catgets internationalization
};
class Project_Reader;
class Project_Writer;
/**
Data and settings for a FLUID project file.
*/
class I18n
{
public:
Project &project_;
/// One of the available internationalization types.
I18n_Type type;
/// Include file for GNU i18n, writes an #include statement into the source
/// file. This is usually `<libintl.h>` or `"gettext.h"` for GNU gettext.
char *gnu_include;
// Optional name of a macro for conditional i18n compilation.
char *gnu_conditional;
/// For the gettext/intl.h options, this is the function that translates text
/// at runtime. This is usually "gettext" or "_".
char *gnu_function;
/// For the gettext/intl.h options, this is the function that marks the translation
/// of text at initialisation time. This is usually "gettext_noop" or "N_".
char *gnu_static_function;
/// Include file for Posix i18n, write a #include statement into the source
/// file. This is usually `<nl_types.h>` for Posix catgets.
char *posix_include;
// Optional name of a macro for conditional i18n compilation.
char *posix_conditional;
/// Name of the nl_catd database
char *posix_file;
/// Message set ID for the catalog.
char *posix_set;
public: // Methods
I18n(Project &p);
~I18n();
void reset();
void read(Project_Reader &f, const char *key);
void write(Project_Writer &f) const;
void set_gnu_include(const char *s);
void set_gnu_conditional(const char *s);
void set_gnu_function(const char *s);
void set_gnu_static_function(const char *s);
void set_posix_include(const char *s);
void set_posix_conditional(const char *s);
void set_posix_file(const char *s);
void set_posix_set(const char *s);
};
#endif // FLUID_PROJ_I18N_H
|