Skip to content

Audit string interpolation: standardize on named-placeholder lang() and adopt ICU MessageFormat where it helps #4745

Open

Description

@jekkos

CodeIgniter 4.7+ formats lang() placeholders via ICU MessageFormatter (the intl extension is a hard dependency in composer.json), so the full ICU MessageFormat toolkit is available for user-facing strings: named placeholders, pluralization, ordinals, dates, numbers, and select.

PR #4727 converted powered_by from positional {0}/{1} to named {app}/{version}, and the AGENTS.md (Localization section) now codifies the standard. This issue tracks the broader follow-up work flagged in that PR, split out to keep #4727 scoped to the powered_by fix + the AGENTS.md standard.

1. Concatenation → interpolation
Find user-facing strings built with string concatenation (. ) that should instead use lang() with placeholders, so translations can reorder words to fit grammar.

2. Positional → named placeholders
Find remaining positional placeholders ({0}, {1}, …) in language files and convert them to named placeholders.

3. ICU MessageFormat opportunities
Identify strings where ICU features would improve correctness/clarity, e.g.:

  • Counts / quantities → pluralization: '{count, plural, =0 {None} one {# item} other {# items}}'
  • Ordinals (1st/2nd/3rd) → ordinal formatting
  • Dates / times → date/time formatting
  • Numbers, currencies → number formatting

4. ICU MessageFormat validity in placeholder-bearing translations
Since ICU is invoked for any lang() call that passes arguments, audit placeholder-bearing translations for ICU MessageFormat validity — literal braces must be doubled ({{/}}) and apostrophes doubled (''). (Placeholder-free strings are unaffected, since they are never passed to ICU.)

Relevant: #4727, AGENTS.md → Localization.

Activity

  1. objecttothis commented on Oct 23, 2026

    @objecttothis
    Member

    Claude Issue Checker Agent (cc @objecttothis)

    Investigated against current master.

    Status: Partially addressed — the named-placeholder standard (item 2) is far from complete; items 1, 3, 4 appear largely untouched.

    Evidence:

    • PR fix(i18n): interpolate powered_by app name and version via placeholders #4727's powered_by conversion did land (Common.powered_by is now a plain string with no placeholders, used via concatenation-free interpolation), and the AGENTS.md Localization section does document the convention, as the issue states.
    • However, positional placeholders ({0}, {1}, …) are still widespread in app/Language/en/*: a repo search turns up unconverted positional placeholders in Login.php (migration_auth_message, migration_needed), Attributes.php (definition_error_adding_updating), Bootstrap_tables.php (page_from_to, rows_per_page), Giftcards.php (cannot_use, remaining_balance), Customers.php (csv_import_partially_failed), Items.php (csv_import_invalid_location, csv_import_partially_failed), Common.php (copyrights), Taxes.php (tax_group_not_unique), and Sales.php (invoice_number_duplicate, quantity_of_items) — i.e., item 2 (positional → named) is still largely outstanding.
    • I found no evidence of ICU pluralization/ordinal/date/number MessageFormat usage anywhere in the language files (item 3), nor any indication of a completed audit for doubled braces/apostrophes in placeholder-bearing translations (item 4).

    This is a broad, multi-part tracking issue rather than a single bug, so "resolved" doesn't quite apply — but based on current master, the bulk of the described follow-up work (items 1, 2, 3, 4) has not been done yet, beyond the powered_by precedent already merged via #4727.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions