Coverage Report

Created: 2025-06-22 07:35

/src/libmodi/libmodi/libmodi_i18n.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Internationalization (i18n) functions
3
 *
4
 * Copyright (C) 2012-2024, Joachim Metz <joachim.metz@gmail.com>
5
 *
6
 * Refer to AUTHORS for acknowledgements.
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Lesser General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
#include <common.h>
23
#include <types.h>
24
25
#if defined( HAVE_LIBINTL_H ) && defined( ENABLE_NLS )
26
#include <libintl.h>
27
#endif
28
29
#include "libmodi_i18n.h"
30
#include "libmodi_libcerror.h"
31
32
static int libmodi_i18n_initialized = 0;
33
34
/* Initializes library internationalization functions
35
 */
36
int libmodi_i18n_initialize(
37
     libcerror_error_t **error )
38
2.73k
{
39
2.73k
  static char *function = "libmodi_i18n_initialize";
40
41
2.73k
  if( libmodi_i18n_initialized == 0 )
42
1
  {
43
1
#if defined( HAVE_BINDTEXTDOMAIN ) && defined( LOCALEDIR )
44
1
    if( bindtextdomain(
45
1
         "libmodi",
46
1
         LOCALEDIR ) == NULL )
47
0
    {
48
0
      libcerror_error_set(
49
0
       error,
50
0
       LIBCERROR_ERROR_DOMAIN_RUNTIME,
51
0
       LIBCERROR_RUNTIME_ERROR_SET_FAILED,
52
0
       "%s: unable to bind text domain.",
53
0
       function );
54
55
0
      return( -1 );
56
0
    }
57
1
#endif /* defined( HAVE_BINDTEXTDOMAIN ) && defined( LOCALEDIR ) */
58
59
1
    libmodi_i18n_initialized = 1;
60
1
  }
61
2.73k
  return( 1 );
62
2.73k
}
63