naev 0.10.4
gettext.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
7#include <stdint.h>
10#include "attributes.h"
11
12typedef struct LanguageOption_ {
13 char *language;
14 double coverage;
16
17void gettext_init (void);
18void gettext_exit (void);
19const char* gettext_getLanguage (void);
20void gettext_setLanguage( const char* lang );
22double gettext_languageCoverage( const char* lang );
23
24const char* gettext_ngettext( const char* msgid, const char* msgid_plural, uint64_t n );
25FORMAT_ARG( 2 ) const char* gettext_pgettext_impl( const char* lookup, const char* msgid );
26
35#define gettext_noop( String ) String
36
41FORMAT_ARG(1) static inline const char* _( const char* msgid )
42{
43 return gettext_ngettext( msgid, NULL, 1 );
44}
45
47#define N_( msgid ) gettext_noop( msgid )
48
50FORMAT_ARG(1) static inline const char* n_( const char* msgid, const char* msgid_plural, uint64_t n )
51{
52 return gettext_ngettext( msgid, msgid_plural, n );
53}
54
56#define GETTEXT_CONTEXT_GLUE "\004"
57
63#define p_( msgctxt, msgid ) gettext_pgettext_impl( msgctxt GETTEXT_CONTEXT_GLUE msgid, msgid )
64
67const char* pgettext_var( const char* msgctxt, const char* msgid );
const char * gettext_ngettext(const char *msgid, const char *msgid_plural, uint64_t n)
Return a translated version of the input, using the current language catalogs.
Definition: gettext.c:198
void gettext_exit(void)
Free resources associated with the translation system. This invalidates previously returned pointers ...
Definition: gettext.c:70
double gettext_languageCoverage(const char *lang)
Return the fraction of strings which have a translation into the given language.
Definition: gettext.c:269
void gettext_setLanguage(const char *lang)
Set the translation language.
Definition: gettext.c:106
const char * gettext_getLanguage(void)
Gets the active (primary) translation language. Even in case of a complex locale, this will be the na...
Definition: gettext.c:93
const char * pgettext_var(const char *msgctxt, const char *msgid)
Definition: gettext.c:303
LanguageOption * gettext_languageOptions(void)
List the available languages, with completeness statistics.
Definition: gettext.c:246
void gettext_init(void)
Initialize the translation system. There's no presumption that PhysicsFS is available,...
Definition: gettext.c:46
const char * gettext_pgettext_impl(const char *lookup, const char *msgid)
Helper function for p_(): Return _(lookup) with a fallback of msgid rather than lookup.
Definition: gettext.c:215
char * language
Definition: gettext.h:13
double coverage
Definition: gettext.h:14