Task #82453

Extbase LocalizationUtility error feedback and logic can be improved

Added by Claus Due 10 months ago. Updated 5 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2017-09-11
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Two things should be done:

1. Early return should be done if $key is empty (won't matter if $extensionName or others are passed in this case - empty key equals null return value)
2. Failure to format with vsprintf should output a gentle message about the translation failure which includes the original string and the number of arguments being passed for easy comparison of marker and parameter counts.


Related issues

Related to TYPO3 Core - Bug #84149: Avoid associative array to be used in LocalizationUtility Resolved 2018-03-06

Associated revisions

Revision 016afcdd (diff)
Added by Claus Due 5 months ago

[TASK] Improve LocalizationUtility logic and feedback

This patch does two things to improve the translation
flow in LocalizationUtility::translate:

  • Early return null on empty $key (would cause null anyway)
  • Feedback message on failure to sprintf

In order to provide failure feedback for formatted
strings, vsprintf had to be replaced with sprintf and
array unrolling, since vsprintf does not return false
on errors and sprintf does. The error is returned as
translation result so even if an unexpected failure
occurs, at least a partially meaningful text is shown.

Change-Id: I568be30b701f0c374289ed44fc5b31b13f492483
Resolves: #82453
Releases: master
Reviewed-on: https://review.typo3.org/54118
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Gerrit Code Review 10 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54118

#2 Updated by Gerrit Code Review 10 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54118

#3 Updated by Gerrit Code Review 10 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54118

#4 Updated by Susanne Moog 6 months ago

  • Category set to Extbase

#5 Updated by Gerrit Code Review 5 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54118

#6 Updated by Gerrit Code Review 5 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54118

#7 Updated by Anonymous 5 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#8 Updated by Oliver Hader 5 months ago

  • Related to Bug #84149: Avoid associative array to be used in LocalizationUtility added

Also available in: Atom PDF