Localizing Custom Fields Labels

Following is the recipe for customizing the labels for custom fields. This doesn not cover localizing the possible values for the custom fields:

For example, for a start date custom field, name it “my_start_date”. Mantis will lookup $s_my_start_date in the localisation, if not found, then it will use the word “my_start_date” as the label.

Mantis provides a technique to add localized strings or update existing ones without having to modify the language files. The reason for that is to avoid having your modifications overwritten when you install the next version of Mantis.

The way to do that is to create custom_strings_inc.php and place it in the main folder of Mantis. The implementation of this file should look similar to the following:

    if ( lang_get_current() == 'german' ) {
        $s_my_start_date = 'Start Date XX';  // German translation of Start Date
    } else {
        # Default (use your preferred language as the default)
        $s_my_start_date = 'Start Date';

Note that the above code must be inside a PHP block.

If the $s_my_start_date happened to be a stock string in Mantis that is already localised in the standard files, then you do not need to do this extra localisation work. For example, if the field name was “start_date”, then it is likely that Mantis is already using this string and you can benefit from the already existing localisation. You can check that by opening lang/strings_english.txt and searching for “$s_start_date”.