[TASK] Improve LocalizationUtility logic and feedback 18/54118/6
authorClaus Due <claus@namelesscoder.net>
Mon, 11 Sep 2017 14:43:19 +0000 (16:43 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 2 Mar 2018 00:02:26 +0000 (01:02 +0100)
commit016afcdd62bdb04252db140f8c822b43092b2b7e
tree30f7d34e3ff1e2d7749270a13b86aa89b4e5abc8
parent852ad1d9ad6f3bac4c977d2466d1875f9e632e01
[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 <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php