xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/examples/hello-objc/hello.m (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1/* Example for use of GNU gettext.
2   Copyright (C) 2003 Free Software Foundation, Inc.
3   This file is in the public domain.
4
5   Source code of the Objective-C program.  */
6
7
8/* Get setlocale() declaration.  */
9#include <locale.h>
10
11/* Get printf() declaration.  */
12#include <stdio.h>
13
14/* Get getpid() declaration.  */
15#if HAVE_UNISTD_H
16# include <unistd.h>
17#endif
18
19/* Get gettext(), textdomain(), bindtextdomain() declaration.  */
20#include "gettext.h"
21/* Define shortcut for gettext().  */
22#define _(string) gettext (string)
23
24int
25main ()
26{
27  setlocale (LC_ALL, "");
28  textdomain ("hello-objc");
29  bindtextdomain ("hello-objc", LOCALEDIR);
30
31  printf ("%s\n", _("Hello, world!"));
32  printf (_("This program is running as process number %d."), getpid ());
33  putchar ('\n');
34
35  return 0;
36}
37