summaryrefslogtreecommitdiff
path: root/src/i18n.c
blob: 06b828fb8163e2714715511fd3092ca97865ab97 (plain) (blame)
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
#include <s.h>

#include <stdio.h>

#include "meta.h"
#include "msgs.h"

#include "i18n.h"



const char *const
MSGS[] = {
	[MSG_USAGE_FIRST]="Usage:\n",
	[MSG_USAGE_1]="  " NAME " -p FILE [-o DIRECTORY]\n",
	[MSG_USAGE_2]="  " NAME " -l FILE [-o DIRECTORY]\n",
	[MSG_USAGE_LAST]="  " NAME " [-hV]\n",
	[MSG_HELP_FIRST]="\n",
	[MSG_HELP_1]="\n",
	[MSG_HELP_2]="Options:\n",
	[MSG_HELP_3]="  -p FILE          parser file to be processed\n",
	[MSG_HELP_4]="  -l FILE          lexer file to be processed\n",
	[MSG_HELP_5]="  -o DIRECTORY     output where to place the\n",
	[MSG_HELP_6]="                   generated files (default .)\n",
	[MSG_HELP_7]="  -h, --help       show this help message\n",
	[MSG_HELP_8]="  -V, --version    print the version number\n",
	[MSG_HELP_9]="\n",
	[MSG_HELP_10]="\n",
	[MSG_HELP_11]="Run the " NAME "(1) parser program.\n",
	[MSG_HELP_12]="\n",
	[MSG_HELP_13]="Here is the explanation for what it does, and the\n",
	[MSG_HELP_14]="synopsis of its usage.\n",
	[MSG_HELP_15]="\n",
	[MSG_HELP_16]="See \"man " NAME "\" for usage information and\n",
	[MSG_HELP_17]="\"man " NAME ".tutorial\" for a beginner intro.\n",
	[MSG_HELP_18]="\n",
	[MSG_HELP_19]="\n",
	[MSG_HELP_20]="Examples:\n",
	[MSG_HELP_21]="\n",
	[MSG_HELP_22]="  Do a one-line parser:\n",
	[MSG_HELP_23]="\n",
	[MSG_HELP_24]="    $ " NAME " run md.grammar < README.md\n",
	[MSG_HELP_25]="\n",
	[MSG_HELP_26]="\n",
	[MSG_HELP_27]="  Compile the grammer:\n",
	[MSG_HELP_28]="\n",
	[MSG_HELP_LAST]="    $ " NAME " build csv.grammar > dunno.alsodunno\n",
	[MSG_VERSION]= NAME " " VERSION " " DATE "\n",
	[MSG_ERR_VECTOR_MAX_CAPACITY]= "Already at max capacity (%ld): %s\n",
	[MSG_ERR_VECTOR_OUT_OF_BOUNDS]=  "idx (%ld) is beyond bounds (%ld)\n",
	[MSG_ERR_VECTOR_UNDERFLOW]=  "pop on an empty vector\n",
	NULL
};



const char *
_(const int msg_id) {
	return msgs_string(MSGS, msg_id);
}

int
i18n_init(void) {
	return msgs_init(MSGS);
}