User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
mantisbt:localizing_custom_fields_labels [2011/11/16 07:32]
atrol The page rendering was broken (maybe since new PHP version on Added new line to fix it at end of file.
mantisbt:localizing_custom_fields_labels [2019/01/14 06:02] (current)
dregad This is documented in Admin Guide
Line 1: Line 1:
 ====== Localizing Custom Fields Labels ====== ====== 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: +Please refer to [[​docs/​master/​en-US/​Admin_Guide/​html-desktop/​#admin.customize.customfields.localize|Customizing MantisBT section ​in the Admin Guide]].
- +
-  * Give the custom field a valid variable name +
-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. +
- +
-  * Localize the word "​my_start_date"​ +
-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: +
- +
-<code php> +
-    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';​ +
-    } +
-</​code>​ +
- +
-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"​. +
mantisbt/localizing_custom_fields_labels.txt · Last modified: 2019/01/14 06:02 by dregad