view modules/translate/REFERENCE.md @ 306:894390fdd6d7

Make sure that the right keyring back-ends are installed
author IBBoard <dev@ibboard.co.uk>
date Sat, 22 Feb 2020 16:22:57 +0000
parents b0f8b88fea5c
children
line wrap: on
line source

# Reference
<!-- DO NOT EDIT: This document was generated by Puppet Strings -->

## Table of Contents

**Functions**

* [`translate`](#translate): A function that calls the _() function in gettext. This is because _ is protected in the puppet language

## Functions

### translate

Type: Ruby 4.x API

A function that calls the _() function in gettext. This is because _ is protected in the puppet language

* **Note** Translate with simple strings:
  - Takes in a string and passes it to fast_gettext's _() function. Primarily used for 'marking' a string to be added to a .pot file.
Translate with interpolation:
  - Takes in a string and a hash. Please note that variables in the message are wrapped with %{VAR} not ${VAR}.
  - The hash contains key value pairs with marker and the variable it will be assigned to.
  - The translate module passes it to fast_gettext's _() function. Primarily used for 'marking' a string to be added to a .pot file.

#### Examples

##### 

```puppet
fail(translate("Failure message"))
```

##### 

```puppet
fail(translate('message is %{color}'), {'color' => 'green'})
```

#### `translate(String $message, Optional[Hash] $interpolation_values)`

The translate function.

Returns: `String` translated message.

##### Examples

###### 

```puppet
fail(translate("Failure message"))
```

###### 

```puppet
fail(translate('message is %{color}'), {'color' => 'green'})
```

##### `message`

Data type: `String`

Message to translate

##### `interpolation_values`

Data type: `Optional[Hash]`

Optional.