Product SiteDocumentation Site

7.2.5. Localizing Custom Field Names

It is possible to localize the custom fields' labels. This can be done as follows:
  1. Define the custom field (see Section 7.2.2, “Custom Field Definition”), keeping in mind that its name must be a valid PHP identifier.
    As an example, we will use my_start_date for a custom field of type "Date", storing the date when work on an issue was initiated.
  2. Set the localization strings
    • In the MantisBT config directory, locate and edit custom_strings_inc.php (see Section 7.1, “Strings / Translations”), create it if it does not exist.
    • Localize the custom field's label my_start_date by adding the following code
      <?php
      switch( $g_active_language ) {
      	case 'french':
      		$s_my_start_date = 'Date de début';
      		break;
      
      	default:
      		# Default language, as defined in config/config_inc.php
      		# ($g_default_language, English in this case)
      		$s_my_start_date = 'Start Date';
      		break;
      }
      

Note

Had we decided to use start_date as the custom field's name, then it would not have been necessary to modify custom_strings_inc.php (see Section 7.1, “Strings / Translations”), since MantisBT would have used the existing, already localized string from the standard language files. To check for standard strings, inspect lang/strings_english.txt.