Skip to content

Order number placeholder %1$s not substituted on TYPO3 14 (order confirmation pages) #765

Description

@Hobokens

Bug Report

Current Behavior
After placing an order, the confirmation text shows the raw, unsubstituted placeholder instead of the order number:

Your order number is: %1$s

Affects:

  • Resources/Private/Templates/Cart/Order/Create.html
  • Resources/Private/Templates/Cart/Order/Show.html
  • Resources/Private/Templates/Cart/OrderFinished.html

All three use <f:translate key="tx_cart...thank_you_order_number" arguments="{1: orderItem.orderNumber}" />.

Expected behavior/output
The order number should appear in place of the placeholder, e.g. "Your order number is: 2026-00042".

Environment

  • TYPO3 version(s): 14.3
  • cart version: ^12.0 (branch targeting 14.3)
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
  • OS: Windows 11 (via ddev/Docker)

Possible Solution
TYPO3 14 changed argument handling in TYPO3\CMS\Core\Localization\LanguageService::translate(): it now uses array_is_list() to decide between classic sprintf substitution and ICU MessageFormat:

if (!array_is_list($arguments)) {
    return $this->formatIcuMessage($result, $arguments);
}
// otherwise: vsprintf($result, $arguments)

arguments="{1: orderItem.orderNumber}" produces the PHP array [1 => '...'], which does not pass array_is_list() (it doesn't start at index 0). TYPO3 therefore routes it through the ICU formatter instead of vsprintf(), and since %1$s is not valid ICU syntax, the placeholder is left untouched. This worked in earlier TYPO3 versions (where vsprintf() was always used regardless of array keys) but breaks under TYPO3 14's new auto-detection.

Fix: change the array key from 1 to 0 in all three templates:

<f:translate key="tx_cart...thank_you_order_number" arguments="{0: orderItem.orderNumber}" />

Order/Create.html additionally had an unrelated second bug: it referenced cart.orderNumber instead of orderItem.orderNumber (the Cart model has no orderNumber property — only Order\Item does). Order/Show.html and OrderFinished.html already used the correct variable.

Additional context
It may be worth auditing other f:translate calls using 1-based arguments="{1: ...}" keys elsewhere in the codebase for the same TYPO3 14 incompatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions