naev 0.11.5
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_getSystemLanguage (void);
20const char* gettext_getLanguage (void);
21void gettext_setLanguage( const char* lang );
23double gettext_languageCoverage( const char* lang );
24
25const char* gettext_ngettext( const char* msgid, const char* msgid_plural, uint64_t n );
26FORMAT_ARG( 2 ) const char* gettext_pgettext_impl( const char* lookup, const char* msgid );
27
36#define gettext_noop( String ) String
37
42FORMAT_ARG(1) static inline const char* _( const char* msgid )
43{
44 return gettext_ngettext( msgid, NULL, 1 );
45}
46
48#define N_( msgid ) gettext_noop( msgid )
49
51FORMAT_ARG(1) static inline const char* n_( const char* msgid, const char* msgid_plural, uint64_t n )
52{
53 return gettext_ngettext( msgid, msgid_plural, n );
54}
55
57#define GETTEXT_CONTEXT_GLUE "\004"
58
64#define p_( msgctxt, msgid ) gettext_pgettext_impl( msgctxt GETTEXT_CONTEXT_GLUE msgid, msgid )
65
68const 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:217
void gettext_exit(void)
Free resources associated with the translation system. This invalidates previously returned pointers ...
Definition gettext.c:81
double gettext_languageCoverage(const char *lang)
Return the fraction of strings which have a translation into the given language.
Definition gettext.c:285
void gettext_setLanguage(const char *lang)
Set the translation language.
Definition gettext.c:125
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:112
const char * pgettext_var(const char *msgctxt, const char *msgid)
Definition gettext.c:318
LanguageOption * gettext_languageOptions(void)
List the available languages, with completeness statistics.
Definition gettext.c:263
const char * gettext_getSystemLanguage(void)
Gets the current system language as detected by Naev.
Definition gettext.c:102
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:234
char * language
Definition gettext.h:13
double coverage
Definition gettext.h:14