---
name: "Xacobeo::I18n"
section: "3pm"
platform: "linux"
package: "xacobeo"
version: "0.15-3+b2"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/Xacobeo::I18n"
---

# Xacobeo::I18n(3pm)

Utilities for internationalization (i18n).

## NAME

Xacobeo::I18n - Utilities for internationalization (i18n).

## SYNOPSIS

```
        # Initialize the i18n framework (done once)
        use FindBin;
        use Xacobeo::I18n;
        Xacobeo::I18n->init("$FindBin::Bin/../share/locale/");

        # Import the i18n utilities (used everywhere where i18n is needed)
        use Xacobeo::I18n;
        print __("Hello world"), "\n";
```

## DESCRIPTION

This package provides utilities that perform i18n. This module relies on gettext.

The initialization of the i18n framework should be performed only once, preferably as soon as possible. Once the framework is initialized any module requiring to translate a string can include this module.

This module exports automatically the shortcut functions used for translating messages. This is done in order to make the translation transparent.

## FUNCTIONS

The following functions are available:

### \_\_

Translates a single string through gettext.

Parameters:

- •

  `$string`

  The string to translate.

### \_\_x

Translates a string that uses place holders for variable substitution.

Parameters:

- •

  `$string`

  The string to translate.

- •

  `%values`

  A series of key/value pairs that will be replacing the place holders.

### \_\_n

Translates a string in either singular or plural.

Parameters:

- •

  `$singular`

  The string in its singular form (one item).

- •

  `$plural`

  The string in its plural form (more than one item).

- •

  `$count`

  The number of items.

- •

  `%values`

  A series of key/value pairs that will be replacing the place holders.

### \_\_nx

Translates a string in either singular or plural with variable substitution.

Parameters:

- •

  `$singular`

  The string in its singular form (one item).

- •

  `$plural`

  The string in its plural form (more than one item).

- •

  `$count`

  The number of items.

### \_\_xn

Same as "\_\_nx".

Parameters:

- •

  `$singular`

  The string in its singular form (one item).

- •

  `$plural`

  The string in its plural form (more than one item).

- •

  `$count`

  The number of items.

### domain

Returns the translation domain.

### init

Initializes the i18n framework (gettext). Must be called in the fashion:

```
        Xacobeo::I18n->init($folder);
```

Parameters:

- •

  `$folder`

  The folder where to find the translation files. For instance for the translation */usr/share/locale/fr/LC\_MESSAGES/xacobeo.mo* the folder */usr/share/locale* has to be provided.

## AUTHORS

Emmanuel Rodriguez \<potyl@cpan.org\>.

## COPYRIGHT AND LICENSE

Copyright (C) 2008,2009 by Emmanuel Rodriguez.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
