Deprecating Language Strings

Moodle introduced a method for deprecating strings in 2.8. It's purpose is to prevent making a change to a language string that changes it's meaning or purpose creating a potential problem in a plug-in that may use the string.

Step-by-step guide

The process is simple. For any branch that is not integration, if the meaning of a language string has changed, don't edit it, just create a new one.

For the integration branch, do the following:

  1. In the same folder as the language file you're working on, create a file called deprecated.txt if one doesn't exist.
  2. In the deprecated.txt file, add a line that contains the language string name and component name separated by a comma. For example,"recordoflearning,totara_core".
  3. In the language string file, create your new string and move the old one to the bottom of the file adding a comment, for example, "// Deprecated in 9.0". (You don't have to give each deprecated string a comment, just group them together under one heading.)

If you use the deprecated string from then on, you'll get a stack trace and the following error message:

String [<deprecated_language_string>,<component_name>] is deprecated. Either you should no longer be using that string, or the string has been incorrectly deprecated, in which case you should report this as a bug. Please refer to


If you want to read more about the Moodle method for deprecating strings ->

If you want an example Jira issue and patch that deprecates strings, look at TL-7644.

There is a known issue with language string processing for report builder that will prevent the deprecation error working for report sources. You can put the deprecated text file and / or string in another suitable location and it will work as required. Jira issue TL-7972.

Filter by label

There are no items with the selected labels at this time.