locale placeholders are not identifiable

Created on 17 September 2013, over 11 years ago
Updated 11 February 2025, 3 months ago

We have identified an issue with the locale system in interaction with translators...

Problem/Motivation

With locale strings, you never know if something after %!@ is really a placeholder or not - and the information is completely missing, if.

This is a major user / translator experience limitation and leads to wrong translations. Also, it can't be solved in contrib.

When passing locales to a translator, tools like XLIFF could mark placeholder as untranslatable.
Without masking, translators often also translate the placeholder, leading to dysfunction.

When guessing placeholders, a string "@counts" (which is @count with s for seconds) is mis-detected as a single placeholder @counts.
As a result, tools like TMGMT can't protect placeholders, nor can we validate what comes back from translators in any kind.

Proposed resolution

Approaches are
A) The original definition adds meta on what actually a real placeholder is - leading to severe locale definition change
B) The text should escape somehow if these characters are used regularly
C) The placeholders should be delimited with brackets like @{count}

It seems, C is the most appropriate for readability.

Remaining tasks

  • Reimplement the replacement function
  • Update all strings with placeholders

User interface changes

Locale string placeholders are better readable / identifyable.

API changes

All strings with placeholders will change (and thus need to be retranslated).
All contrib calls with placeholders need to be changed.

Resources

None.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

locale.module

Created by

πŸ‡¨πŸ‡­Switzerland miro_dietiker Switzerland

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • Status changed to Closed: outdated about 14 hours ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since there has been no follow up in 3 months, going to close out. But if still a valid task then it can be re-opened

    Thanks!

Production build 0.71.5 2024