Mercurial > repos > other > Puppet
view modules/translate/REFERENCE.md @ 399:2c6065b5be5e
Switch to config-based PHP extensions
This makes it compatible with Ubuntu, otherwise it keeps
trying to re-install the same module because the "phpX.X"
package is a virtual package and the Puppet handling of
Ubuntu's "is it installed" system is incapable of saying
"yes" when a virtual package is installed.
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 20 Apr 2022 19:08:14 +0100 |
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.