View Issue Details

IDProjectCategoryView StatusLast Update
0027241mantisbtlocalizationpublic2021-03-07 18:29
Reporterdregad Assigned Todregad  
PrioritynormalSeveritytweakReproducibilityalways
Status closedResolutionfixed 
Target Version2.25.0Fixed in Version2.25.0 
Summary0027241: Improve handling of missing language strings
Description

When a language string is missing, MantisBT currently displays an empty string

Additionally, if $g_display_error settings for E_USER_WARNING are set to DISPLAY_ERROR_INLINE, an alert is displayed on screen, e.g.

APPLICATION WARNING #300: String "add_profile" not found. (in '/home/dregad/dev/mantisbt/core/lang_api.php' line 307)

So we know which string is missing, but not where it was referenced as the error is always triggered from Lang API.

Even though it is not a normal scenario to have missing strings, this behavior is not very user-friendly to

  • the user, who is missing information to use the system (e.g. a button label)
  • the admin/developer, who does not know where to look to get context and fix the problem
TagsNo tags attached.

Activities

Related Changesets

MantisBT: master 6ef1734d

2020-09-05 02:45

dregad


Details Diff
Print lang string if English localization missing

When an English language string is missing, MantisBT currently displays
an empty string; this is not very friendly to the user, who may be
missing important information (e.g. a button label).

If English string is missing, display the language string itself
(i.e. the $p_string parameter to lang_get()).

Fixes 0027241
Affected Issues
0027241
mod - core/lang_api.php Diff File

MantisBT: master 60004349

2020-09-06 04:49

dregad


Details Diff
Special handling for missing lang string errors

If the error type is 300 (ERROR_LANG_STRING_NOT_FOUND), we retrieve the
details (file name and line number) of the parent error. Properly
handles the case when user's language is not English, by going through
the error stack trace until the first lang_get() call is found.

This allows printing information about the actual location of the
missing string, instead of a not-so-useful reference to lang_get().

Fixes 0027241
Affected Issues
0027241
mod - core/error_api.php Diff File