The maketext() Function
The
maketext() API1 and API2 calls follow the same format as
maketext() calls in Perl. The first argument is the phrase you wish to create in bracket notation. Any arguments that follow are placeholder values.
API1
If you choose to pass arguments to the
maketext() API1 call, they can be either strings or variables that appear elsewhere in cPanel. For example:
<cpanel Locale="maketext('bracket notation phrase goes here [_1], [_2], [_3]',$FORM{'param_name'},"string",$CPDATA{"DNS"})">
Note: Even if you wish to pass a string, it is a good idea not to. This will help you avoid using partial phrases. For more information, you can visit our documentation
about consistency in lexicon entries.
API2
You can call
maketext() in an API2 call's "Call Template." You may pass the following kinds of arguments to the maketext API2 call:
- Positional: '%'
- Named Variable: '${name}'
- Variable: "$FORM{'param_name'}"
- String: 'Your domain has been set up.'
maketext('bracket notation phrase goes here [_1], [_2], [_3], [_4]', %, ${name}, $FORM{'variable'}, "string")
<?cp Module::function([p class="example"]maketext('bracket notation phrase goes here [_1], [_2], [_3], [_4]', %, ${name}, $FORM{'variable'}, "string")[/p], name,name) ?>
Note: Even if you wish to pass a string, it is a good idea not to. This will help you avoid using partial phrases. For more information, you can visit our documentation
about consistency in lexicon entries.
Avoiding Partial Strings
Rather than using strings, like so:
maketext('Your [_1] has been set up.', 'email');
maketext('Your [_1] has been set up.', 'database');
You should use separate and full phrases:
maketext('Your email has been set up.');
maketext('Your database has been set up.');
If there are only 2 or 3 options, you may use the "boolean" bracket notation method in order to reuse the same phrase:
maketext('Your [boolean,_1,email,database] has been set up.', 0);
maketext('Your [boolean,_1,email,database] has been set up.', 1);
References