View Issue Details

IDProjectCategoryView StatusLast Update
0036832mantisbtadministrationpublic2026-02-08 22:46
Reporterraspopov Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.28.0 
Target Version2.29.0Fixed in Version2.29.0 
Summary0036832: Strict verification of parameters in translation strings is required
Description

MantisBT uses language strings that may contain parameters, such as "%1$s." These parameters may be set incorrectly in translated languages, resulting in PHP errors when attempting to display them. It is quite difficult for translators to check for such errors.

Additional Information

Strict verification of translation files on the /admin/test_langs.php page is most likely necessary. The goal is to detect violations of the parameter assignment format and missing translations.

TagsNo tags attached.

Relationships

related to 0036871 resolveddregad Remove unused language strings 

Activities

raspopov

raspopov

2026-01-21 11:45

reporter   ~0070722

PR: https://github.com/mantisbt/mantisbt/pull/2170

dregad

dregad

2026-01-21 12:21

developer   ~0070724

Thanks for your contribution. I have reviewed the PR.

dregad

dregad

2026-02-08 11:23

developer   ~0070775

@raspopov despite my earlier comment, I ended up implementing a check for invalid placeholders in English language strings after all, as I made a stupid typo when "fixing" the 2 invalid strings detected by your improved test_langs,php.

raspopov

raspopov

2026-02-08 22:46

reporter   ~0070777

Yes, let a digital computer check for errors, not an analog human being. :-)

Related Changesets

MantisBT: master 81dd07f9

2026-01-21 11:41

raspopov

Committer: dregad


Details Diff
Add translations strict validation

- Added the argument format check
- Added the argument count and type check
- Added missed translation check
- Added direct links to translations

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File

MantisBT: master c13d3825

2026-01-23 09:33

raspopov

Committer: dregad


Details Diff
Make checks optional

Added a line with links for selecting options, just like in the
"Check Installation" section.

Also optimized retrieval of language code from global variable
$g_language_auto_map in a PHP-way.

Added page title.

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File

MantisBT: master 59c7b943

2026-01-23 10:08

raspopov

Committer: dregad


Details Diff
Simplify regexp

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File

MantisBT: master 518baeb7

2026-01-24 09:44

raspopov

Committer: dregad


Details Diff
Add detection of translations driven by TranslateWiki

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File

MantisBT: master cca6447c

2026-01-27 10:52

raspopov

Committer: dregad


Details Diff
Add argument number and order validation

The code is consolidated in two new functions:
checkInvalidArgs() and checkUntranslated().

Optimized checkInvalidTags() function, enabled the target="_blank"
attribute of the <a> tag found in some plugins.

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File

MantisBT: master 937c3212

2026-02-07 17:40

dregad


Details Diff
Don't link English strings to translatewiki.net

It's the base language, so there's no translation to fix there.

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File

MantisBT: master b871d674

2026-02-07 17:50

dregad


Details Diff
Change test_langs.php's page title

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File
mod - core/html_api.php Diff File

MantisBT: master 6440da97

2026-02-07 17:54

dregad


Details Diff
Fix errors in language strings

Detected via the improved test_langs.php script from issue 0036832
Affected Issues
0036832
mod - lang/strings_english.txt Diff File
mod - plugins/MantisCoreFormatting/lang/strings_english.txt Diff File

MantisBT: master 2c0deb6c

2026-02-08 11:05

dregad


Details Diff
Improve English language string errors detection

Run the strings through sprintf(), capture any errors and report them
to the user.

Fixes 0036832
Affected Issues
0036832
mod - admin/test_langs.php Diff File

MantisBT: master b8fddb37

2026-02-08 11:07

dregad


Details Diff
Fix errors in language strings (take 2)

Follow-up on 6440da975fc9bfccdcd0c61885f71db4c6873207, I made a silly
typo when updating the placeholder: `%$2d` instead of `%2$d`.

Thanks @siebrand for catching it !

Issue 0036832
Affected Issues
0036832
mod - lang/strings_english.txt Diff File
mod - plugins/MantisCoreFormatting/lang/strings_english.txt Diff File