[Development Guides Home](/guides) >> [Guide to Locales](/guides/guide-to-locales) # Guide to Locales - Bracket Notation ## Introduction Bracket notation allows you to customize the localized strings in your custom code. This document explains the basic use of of bracket notation in custom applications and interfaces. * For additional examples of localization in Template Toolkit files, read our [Guide to Template Toolkit](/guides/guide-to-template-toolkit) in cPanel & WHM documentation. * For in-depth documentation about the `Locale::Maketext` module's methods and additional options, read [CPAN's `Locale::Maketext::Utils`](https://metacpan.org/dist/Locale-Maketext-Utils/view/lib/Locale/Maketext/Utils.pod#Improved-B) documentation. ## Bracket notation basics The following examples use the `asis` method to modify the way in which the locale system handles the text `bracket notation`. * In bracket notation, the square braces contain the bracket notation method name first, with any additional arguments as a comma-separated list. * For a list of available methods and their use requirements, read our [Guide to Locales - Bracket Notation Methods](/guides/guide-to-locales/guide-to-locales-bracket-notation/guide-to-locales-bracket-notation-methods/) documentation. * For instructions to add methods to the bracket notation method whitelist, read our [Guide to Locales - The Bracket Notation Whitelist](/guides/guide-to-locales/guide-to-locales-bracket-notation/guide-to-locales-the-bracket-notation-whitelist/) documentation. Because the `asis` method instructs translators not to translate the specified text, these examples would render the following strings after translation: | Language | Rendered string | | --- | --- | | English | `My text uses bracket notation.` | | French | `Mon texte utilise bracket notation.` | ### Perl ```perl $locale->maketext('My text uses [asis,bracket notation].'); ``` ### Template Toolkit ```perl [% locale.maketext('My text uses [asis,bracket notation].') %] ``` ### JavaScript ```javascript LOCALE.maketext("My text uses [asis,bracket notation]."); ``` ## Arguments The `is_defined` method will use the following arguments: * `_1` — The first argument instructs the method to check whether the $value variable is defined. * `“_1” is an invalid` — The second argument provides text that the method will display if the `$value` variable is defined. * `Specify a valid` — The third argument provides text that the method will display if the `$value` variable is not defined. For example, the following examples might render the following strings after translation: | Language | Rendered string | | --- | --- | | English | `Error: “boop” is an invalid value. Error: Specify a valid value.` | | French | `Erreur: "boop" est une valeur non valide. Erreur: Spécifiez une valeur valide.` | Many bracket notation methods accept ordered arguments. For example, the following localized strings include three arguments with the `is_defined` method: ### Perl ```perl $locale->maketext('Error: [is_defined,_1,"_1" is an invalid,Specify a valid] value.', $value); ``` ### Template Toolkit ```perl [% locale.maketext('Error: [is_defined,_1,"_1" is an invalid,Specify a valid] value.', $value) %] ``` ### JavaScript ```javascript LOCALE.maketext("Error: [is_defined,_1,"_1" is an invalid,Specify a valid] value.", $value); ```