NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
neomutt.c
Go to the documentation of this file.
1
23
29
30#include "config.h"
31#include <errno.h>
32#include <locale.h>
33#include <stdio.h>
34#include <string.h>
35#include <sys/stat.h>
36#include <unistd.h>
37#include "mutt/lib.h"
38#include "config/lib.h"
39#include "neomutt.h"
40#include "account.h"
41#include "command.h"
42#include "mailbox.h"
43#include "module_api.h"
44#include "muttlib.h"
45
46struct NeoMutt *NeoMutt = NULL;
47
49#define CONFIG_INIT_TYPE(CS, NAME) \
50 extern const struct ConfigSetType Cst##NAME; \
51 cs_register_type(CS, &Cst##NAME)
52
54#define CONFIG_INIT_VARS(CS, NAME) \
55 bool config_init_##NAME(struct ConfigSet *cs); \
56 config_init_##NAME(CS)
57
64static bool init_env(struct NeoMutt *n, char **envp)
65{
66 if (!n)
67 return false;
68
71
72 envlist_free(&n->env);
73 n->env = envlist_init(envp);
74
75 return true;
76}
77
83static bool init_locale(struct NeoMutt *n)
84{
85 if (!n)
86 return false;
87
88 setlocale(LC_ALL, "");
89
90#ifdef ENABLE_NLS
91 const char *domdir = mutt_str_getenv("TEXTDOMAINDIR");
92 if (domdir)
93 bindtextdomain(PACKAGE, domdir);
94 else
95 bindtextdomain(PACKAGE, MUTTLOCALEDIR);
96 textdomain(PACKAGE);
97#endif
98
99 n->time_c_locale = duplocale(LC_GLOBAL_LOCALE);
100 if (n->time_c_locale)
101 n->time_c_locale = newlocale(LC_TIME_MASK, "C", n->time_c_locale);
102
103 if (!n->time_c_locale)
104 {
105 mutt_error("%s", strerror(errno)); // LCOV_EXCL_LINE
106 return false; // LCOV_EXCL_LINE
107 }
108
109#ifndef LOCALES_HACK
110 /* Do we have a locale definition? */
111 if (mutt_str_getenv("LC_ALL") || mutt_str_getenv("LANG") || mutt_str_getenv("LC_CTYPE"))
112 {
113 OptLocales = true;
114 }
115#endif
116
117 return true;
118}
119
120#ifdef ENABLE_NLS
125static void localise_config(struct ConfigSet *cs)
126{
127 struct Buffer *value = buf_pool_get();
128 struct HashElemArray hea = get_elem_list(cs, GEL_ALL_CONFIG);
129 struct HashElem **hep = NULL;
130
131 ARRAY_FOREACH(hep, &hea)
132 {
133 struct HashElem *he = *hep;
134 if (!(he->type & D_L10N_STRING))
135 continue;
136
137 buf_reset(value);
138 cs_he_initial_get(cs, he, value);
139
140 // Lookup the translation
141 const char *l10n = gettext(buf_string(value));
142 config_he_set_initial(cs, he, l10n);
143 }
144
145 ARRAY_FREE(&hea);
146 buf_pool_release(&value);
147}
148#endif
149
154static void reset_tilde(struct ConfigSet *cs)
155{
156 static const char *names[] = { "folder", "mbox", "postponed", "record" };
157
158 struct Buffer *value = buf_pool_get();
159 for (size_t i = 0; i < countof(names); i++)
160 {
161 struct HashElem *he = cs_get_elem(cs, names[i]);
162 if (!he)
163 continue;
164 buf_reset(value);
165 cs_he_initial_get(cs, he, value);
166 expand_path(value, false);
167 config_he_set_initial(cs, he, value->data);
168 }
169 buf_pool_release(&value);
170}
171
182static bool init_config(struct NeoMutt *n)
183{
184 if (!n)
185 return false;
186
187 n->cs = cs_new(500);
188
189 n->sub = cs_subset_new(NULL, NULL, n->notify);
191 n->sub->cs = n->cs;
192
193 bool rc = true;
194
195 // Set up the Config Types
196 for (enum ModuleId id = MODULE_ID_MAIN; id < MODULE_ID_MAX; id++)
197 {
198 const struct Module *mod = n->modules[id];
199 if (!mod)
200 continue;
201
202 if (mod->config_define_types)
203 {
204 mutt_debug(LL_DEBUG3, "%s:config_define_types()\n", mod->name);
205 rc &= mod->config_define_types(n, n->sub->cs);
206 }
207 }
208
209 if (!rc)
210 return false;
211
212 // Define the Config Variables
213 for (enum ModuleId id = MODULE_ID_MAIN; id < MODULE_ID_MAX; id++)
214 {
215 const struct Module *mod = n->modules[id];
216 if (!mod)
217 continue;
218
220 {
221 mutt_debug(LL_DEBUG3, "%s:config_define_variables()\n", mod->name);
222 rc &= mod->config_define_variables(n, n->sub->cs);
223 }
224 }
225
226 if (!rc)
227 return false;
228
229 // Post-processing
230#ifdef ENABLE_NLS
232#endif
233 reset_tilde(n->sub->cs);
234
235 /* Unset suspend by default if we're the session leader */
236 if (getsid(0) == getpid())
237 config_str_set_initial(n->sub->cs, "suspend", "no");
238
239 return rc;
240}
241
247static bool init_commands(struct NeoMutt *n)
248{
249 if (!n)
250 return false;
251
252 struct CommandArray *ca = &n->commands;
253
254 bool rc = true;
255
256 // Set up the Config Types
257 for (enum ModuleId id = MODULE_ID_MAIN; id < MODULE_ID_MAX; id++)
258 {
259 const struct Module *mod = n->modules[id];
260 if (!mod)
261 continue;
262
263 if (mod->commands_register)
264 {
265 mutt_debug(LL_DEBUG3, "%s:commands_register()\n", mod->name);
266 rc &= mod->commands_register(n, ca);
267 }
268 }
269
270 return rc;
271}
272
278static bool init_modules(struct NeoMutt *n)
279{
280 if (!n)
281 return false;
282
283 bool rc = true;
284
285 // Initialise the Modules
286 for (enum ModuleId id = MODULE_ID_MAIN; id < MODULE_ID_MAX; id++)
287 {
288 const struct Module *mod = n->modules[id];
289 if (!mod)
290 continue;
291
292 if (mod->init)
293 {
294 mutt_debug(LL_DEBUG3, "%s:init()\n", mod->name);
295 rc &= mod->init(n);
296 }
297 }
298
299 return rc;
300}
301
307static bool init_gui_modules(struct NeoMutt *n)
308{
309 if (!n)
310 return false;
311
312 bool rc = true;
313
314 // Initialise the Gui Modules
315 for (enum ModuleId id = MODULE_ID_MAIN; id < MODULE_ID_MAX; id++)
316 {
317 const struct Module *mod = n->modules[id];
318 if (!mod)
319 continue;
320
321 if (mod->gui_init)
322 {
323 mutt_debug(LL_DEBUG3, "%s:gui_init()\n", mod->name);
324 rc &= mod->gui_init(n);
325 }
326 }
327
328 return rc;
329}
330
335struct NeoMutt *neomutt_new(void)
336{
337 return MUTT_MEM_CALLOC(1, struct NeoMutt);
338}
339
347bool neomutt_init(struct NeoMutt *n, char **envp, const struct Module **modules)
348{
349 if (!n || !modules)
350 return false;
351
352 for (int i = 0; modules[i]; i++)
353 {
354 const struct Module *mod = modules[i];
355
356 n->modules[mod->mid] = mod;
357 }
358
359 if (!init_env(n, envp))
360 return false;
361
362 if (!init_locale(n))
363 return false;
364
365 if (!init_config(n))
366 return false;
367
368 if (!init_commands(n))
369 return false;
370
371 if (!init_modules(n))
372 return false;
373
374 ARRAY_INIT(&n->accounts);
375 n->notify = notify_new();
377
380
383
384 // Change the current umask, and save the original one
385 n->user_default_umask = umask(077);
386 mutt_debug(LL_DEBUG1, "user's umask %03o\n", n->user_default_umask);
387 mutt_debug(LL_DEBUG3, "umask set to 077\n");
388
389 return true;
390}
391
398{
399 if (!n)
400 return false;
401
402 return init_gui_modules(n);
403}
404
410static bool cleanup_modules(struct NeoMutt *n)
411{
412 if (!n)
413 return false;
414
415 bool rc = true;
416
417 // Cleanup the Modules
418 for (enum ModuleId id = MODULE_ID_MAIN; id < MODULE_ID_MAX; id++)
419 {
420 const struct Module *mod = n->modules[id];
421 if (!mod)
422 continue;
423
424 void *mod_data = n->module_data[mod->mid];
425
426 if (mod->cleanup && mod_data)
427 {
428 n->module_data[mod->mid] = NULL;
429 mutt_debug(LL_DEBUG3, "%s:cleanup()\n", mod->name);
430 rc &= mod->cleanup(n, mod_data);
431 }
432
433 if (n->module_data[mod->mid])
434 {
435 mutt_debug(LL_DEBUG1, "Module %s didn't clean up its data\n", mod->name);
436 rc = false;
437 }
438 }
439
440 return rc;
441}
442
447static void cleanup_gui_modules(struct NeoMutt *n)
448{
449 if (!n)
450 return;
451
452 // Cleanup the Gui Modules
453 for (enum ModuleId id = MODULE_ID_MAIN; id < MODULE_ID_MAX; id++)
454 {
455 const struct Module *mod = n->modules[id];
456 if (!mod)
457 continue;
458
459 if (mod->gui_cleanup)
460 {
461 mutt_debug(LL_DEBUG3, "%s:gui_cleanup()\n", mod->name);
462 mod->gui_cleanup(n);
463 }
464 }
465}
466
472{
473 if (!n)
474 return;
475
477
480}
481
487{
488 if (!n)
489 return;
490
492}
493
498void neomutt_free(struct NeoMutt **ptr)
499{
500 if (!ptr || !*ptr)
501 return;
502
503 struct NeoMutt *n = *ptr;
504
506
507 if (n->sub)
508 {
509 struct ConfigSet *cs = n->sub->cs;
510 cs_subset_free(&n->sub);
511 cs_free(&cs);
512 }
513
516 notify_free(&n->notify);
517 if (n->time_c_locale)
518 freelocale(n->time_c_locale);
519
520 FREE(&n->home_dir);
521 FREE(&n->username);
522
523 envlist_free(&n->env);
524
525 FREE(ptr);
526}
527
534bool neomutt_account_add(struct NeoMutt *n, struct Account *a)
535{
536 if (!n || !a)
537 return false;
538
539 ARRAY_ADD(&n->accounts, a);
541
542 mutt_debug(LL_NOTIFY, "NT_ACCOUNT_ADD: %s %p\n",
543 mailbox_get_type_name(a->type), (void *) a);
544 struct EventAccount ev_a = { a };
546 return true;
547}
548
554void neomutt_account_remove(struct NeoMutt *n, struct Account *a)
555{
556 if (!n || !a || ARRAY_EMPTY(&n->accounts))
557 return;
558
559 struct Account **ap = NULL;
560 ARRAY_FOREACH(ap, &n->accounts)
561 {
562 if ((*ap) != a)
563 continue;
564
565 ARRAY_REMOVE(&n->accounts, ap);
566 account_free(&a);
567 break;
568 }
569}
570
576{
577 if (!n)
578 return;
579
580 if (!ARRAY_EMPTY(&n->accounts))
581 {
582 mutt_debug(LL_NOTIFY, "NT_ACCOUNT_DELETE_ALL\n");
583 struct EventAccount ev_a = { NULL };
585
586 struct Account **ap = NULL;
587 ARRAY_FOREACH(ap, &n->accounts)
588 {
589 account_free(ap);
590 }
591 }
592
593 ARRAY_FREE(&n->accounts);
594}
595
604struct MailboxArray neomutt_mailboxes_get(struct NeoMutt *n, enum MailboxType type)
605{
606 struct MailboxArray ma = ARRAY_HEAD_INITIALIZER;
607
608 if (!n)
609 return ma;
610
611 struct Account **ap = NULL;
612 struct Mailbox **mp = NULL;
613
614 ARRAY_FOREACH(ap, &n->accounts)
615 {
616 struct Account *a = *ap;
617 if ((type > MUTT_UNKNOWN) && (a->type != type))
618 continue;
619
620 ARRAY_FOREACH(mp, &a->mailboxes)
621 {
622 ARRAY_ADD(&ma, *mp);
623 }
624 }
625
626 return ma;
627}
628
641FILE *mutt_file_fopen_masked_full(const char *path, const char *mode,
642 const char *file, int line, const char *func)
643{
644 // Set the user's umask (saved on startup)
645 mode_t old_umask = umask(NeoMutt->user_default_umask);
646 mutt_debug(LL_DEBUG3, "umask set to %03o\n", NeoMutt->user_default_umask);
647
648 // The permissions will be limited by the umask
649 FILE *fp = mutt_file_fopen_full(path, mode, 0666, file, line, func);
650
651 umask(old_umask); // Immediately restore the umask
652 mutt_debug(LL_DEBUG3, "umask set to %03o\n", old_umask);
653
654 return fp;
655}
656
663void *neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
664{
665 if (!n)
666 return NULL;
667
668 return n->module_data[id];
669}
670
677void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
678{
679 if (!n)
680 return;
681
682 n->module_data[id] = data;
683}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition array.h:157
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition array.h:355
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition array.h:74
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
#define ARRAY_INIT(head)
Initialize an array.
Definition array.h:65
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition array.h:58
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:76
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
NeoMutt commands API.
bool config_str_set_initial(struct ConfigSet *cs, const char *name, const char *value)
Set the initial value of a Config Option.
Definition helpers.c:332
bool config_he_set_initial(struct ConfigSet *cs, struct HashElem *he, const char *value)
Set the initial value of a Config Option.
Definition helpers.c:312
Convenience wrapper for the config headers.
struct HashElem * cs_get_elem(const struct ConfigSet *cs, const char *name)
Get the HashElem representing a config item.
Definition set.c:176
void cs_free(struct ConfigSet **ptr)
Free a Config Set.
Definition set.c:142
struct ConfigSet * cs_new(size_t size)
Create a new Config Set.
Definition set.c:128
int cs_he_initial_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *result)
Get the initial, or parent, value of a config item.
Definition set.c:582
void account_free(struct Account **ptr)
Free an Account.
Definition account.c:148
A group of associated Mailboxes.
@ NT_ACCOUNT_ADD
Account has been added.
Definition account.h:67
@ NT_ACCOUNT_DELETE_ALL
All Accounts are about to be deleted.
Definition account.h:69
void commands_clear(struct CommandArray *ca)
Clear an Array of Commands.
Definition command.c:70
const char * mailbox_get_type_name(enum MailboxType type)
Get the type of a Mailbox.
Definition mailbox.c:325
Representation of a mailbox.
MailboxType
Supported mailbox formats.
Definition mailbox.h:40
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition mailbox.h:43
void envlist_free(char ***envp)
Free the private copy of the environment.
Definition envlist.c:42
char ** envlist_init(char **envp)
Create a copy of the environment.
Definition envlist.c:58
FILE * mutt_file_fopen_full(const char *path, const char *mode, const mode_t perms, const char *file, int line, const char *func)
Call fopen() safely.
Definition file.c:556
#define mutt_error(...)
Definition logging2.h:94
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_DEBUG3
Log at debug level 3.
Definition logging2.h:47
@ LL_DEBUG1
Log at debug level 1.
Definition logging2.h:45
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
bool OptLocales
(pseudo) set if user has valid locale definition
Definition mbyte.c:45
#define countof(x)
Definition memory.h:49
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
Module API.
ModuleId
Unique Module Ids.
Definition module_api.h:42
@ MODULE_ID_MAX
Definition module_api.h:93
@ MODULE_ID_MAIN
ModuleMain, NeoMutt Email Client
Definition module_api.h:44
Convenience wrapper for the library headers.
struct Notify * notify_new(void)
Create a new notifications handler.
Definition notify.c:62
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition notify.c:173
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition string.c:731
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
void expand_path(struct Buffer *buf, bool regex)
Create the canonical path.
Definition muttlib.c:122
Some miscellaneous functions.
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
struct MailboxArray neomutt_mailboxes_get(struct NeoMutt *n, enum MailboxType type)
Get an Array of matching Mailboxes.
Definition neomutt.c:604
static bool init_modules(struct NeoMutt *n)
Initialise the Modules.
Definition neomutt.c:278
static bool init_locale(struct NeoMutt *n)
Initialise the Locale/NLS settings.
Definition neomutt.c:83
static void localise_config(struct ConfigSet *cs)
Localise some config.
Definition neomutt.c:125
void neomutt_account_remove(struct NeoMutt *n, struct Account *a)
Remove an Account from the global list.
Definition neomutt.c:554
static void cleanup_gui_modules(struct NeoMutt *n)
Clean up each of the Gui Modules.
Definition neomutt.c:447
static void reset_tilde(struct ConfigSet *cs)
Temporary measure.
Definition neomutt.c:154
bool neomutt_account_add(struct NeoMutt *n, struct Account *a)
Add an Account to the global list.
Definition neomutt.c:534
void neomutt_cleanup(struct NeoMutt *n)
Clean up NeoMutt and Modules.
Definition neomutt.c:471
bool neomutt_init(struct NeoMutt *n, char **envp, const struct Module **modules)
Initialise NeoMutt.
Definition neomutt.c:347
static bool cleanup_modules(struct NeoMutt *n)
Clean up each of the Modules.
Definition neomutt.c:410
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
void neomutt_accounts_free(struct NeoMutt *n)
Definition neomutt.c:575
void neomutt_gui_cleanup(struct NeoMutt *n)
Clean up the GUI Modules.
Definition neomutt.c:486
FILE * mutt_file_fopen_masked_full(const char *path, const char *mode, const char *file, int line, const char *func)
Wrapper around mutt_file_fopen_full()
Definition neomutt.c:641
struct NeoMutt * neomutt_new(void)
Create the main NeoMutt object.
Definition neomutt.c:335
static bool init_config(struct NeoMutt *n)
Initialise the config system.
Definition neomutt.c:182
static bool init_gui_modules(struct NeoMutt *n)
Initialise the Gui Modules.
Definition neomutt.c:307
static bool init_env(struct NeoMutt *n, char **envp)
Initialise the Environment.
Definition neomutt.c:64
void neomutt_free(struct NeoMutt **ptr)
Free a NeoMutt.
Definition neomutt.c:498
static bool init_commands(struct NeoMutt *n)
Initialise the NeoMutt commands.
Definition neomutt.c:247
bool neomutt_gui_init(struct NeoMutt *n)
Initialise the GUI Modules.
Definition neomutt.c:397
Container for Accounts, Notifications.
@ NT_ACCOUNT
Account has changed, NotifyAccount, EventAccount.
Definition notify_type.h:36
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
A group of associated Mailboxes.
Definition account.h:36
enum MailboxType type
Type of Mailboxes this Account contains.
Definition account.h:37
struct Notify * notify
Notifications: NotifyAccount, EventAccount.
Definition account.h:41
struct MailboxArray mailboxes
All Mailboxes.
Definition account.h:40
String manipulation buffer.
Definition buffer.h:36
char * data
Pointer to data.
Definition buffer.h:37
Container for lots of config items.
Definition set.h:251
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition subset.h:51
struct ConfigSet * cs
Parent ConfigSet.
Definition subset.h:50
enum ConfigScope scope
Scope of Subset, e.g. SET_SCOPE_ACCOUNT.
Definition subset.h:48
An Event that happened to an Account.
Definition account.h:77
The item stored in a Hash Table.
Definition hash.h:44
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition hash.h:45
A mailbox.
Definition mailbox.h:81
bool(* gui_init)(struct NeoMutt *n)
Definition module_api.h:165
void(* gui_cleanup)(struct NeoMutt *n)
Definition module_api.h:176
const char * name
Name of the library module.
Definition module_api.h:104
bool(* cleanup)(struct NeoMutt *n, void *data)
Definition module_api.h:189
enum ModuleId mid
Module Id.
Definition module_api.h:103
bool(* init)(struct NeoMutt *n)
Definition module_api.h:115
bool(* config_define_types)(struct NeoMutt *n, struct ConfigSet *cs)
Definition module_api.h:128
bool(* commands_register)(struct NeoMutt *n, struct CommandArray *ca)
Definition module_api.h:154
bool(* config_define_variables)(struct NeoMutt *n, struct ConfigSet *cs)
Definition module_api.h:141
Container for Accounts, Notifications.
Definition neomutt.h:41
const struct Module * modules[MODULE_ID_MAX]
Library modules.
Definition neomutt.h:42
struct Notify * notify_timeout
Timeout notifications handler.
Definition neomutt.h:47
struct AccountArray accounts
All Accounts.
Definition neomutt.h:50
struct CommandArray commands
NeoMutt commands.
Definition neomutt.h:53
struct Notify * notify_resize
Window resize notifications handler.
Definition neomutt.h:46
char ** env
Private copy of the environment variables.
Definition neomutt.h:57
char * username
User's login name.
Definition neomutt.h:56
void * module_data[MODULE_ID_MAX]
Private library module data.
Definition neomutt.h:43
mode_t user_default_umask
User's default file writing permissions (inferred from umask)
Definition neomutt.h:52
char * home_dir
User's home directory.
Definition neomutt.h:55
struct ConfigSet * cs
Config set.
Definition neomutt.h:48
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
locale_t time_c_locale
Current locale but LC_TIME=C.
Definition neomutt.h:51
struct HashElemArray get_elem_list(struct ConfigSet *cs, enum GetElemListFlags flags)
Create a sorted list of all config items.
Definition subset.c:81
struct ConfigSubset * cs_subset_new(const char *name, struct ConfigSubset *sub_parent, struct Notify *not_parent)
Create a new Config Subset.
Definition subset.c:158
void cs_subset_free(struct ConfigSubset **ptr)
Free a Config Subset.
Definition subset.c:112
@ GEL_ALL_CONFIG
All the normal config (no synonyms or deprecated)
Definition subset.h:81
@ SET_SCOPE_NEOMUTT
This Config is NeoMutt-specific (global)
Definition subset.h:37
#define D_L10N_STRING
String can be localised.
Definition types.h:82