Skip to content

Handling of dynamic phrases in templates #4657

@dtdesign

Description

@dtdesign

The |language modifier was added to allow the piping of the phrase through other functions. This has some unwanted side effects when used with plain strings that should not support variable interpolation. Another difference to {lang} is the evaluation on runtime rather than at compile time, allowing the phrase to be taken from a variable instead.

In general it is often used in places where a proper method exists, such as {$obj->title|language} instead of {$obj->getTitle()} and is more of a legacy leftover rather than an intentional use. However, we cannot change the semantics of the |language modifier without breaking compatibility, therefore we will introduce a new modifier and phase out the old one.

  • Introduce the new modifier |phrase as a thin wrapper around \wcf\system::WCF::getLanguage()->get().
  • Deprecate the |language modifier and remove it in 6.0.
  • Replace existing uses of |language with the proper method calls instead, for example, the aforementioned {$obj->getTitle()}.

Related to #2976, #4107

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions