Customizing language strings


From time to time you need to tweak the strings that are displayed in a module, or maybe change an admin form or two. Possibly remove some of the optional fields so that end users don't get confused. And because CMSMS is an open source package, and is written in PHP you can go ahead, find the right file(s) and tweak them to your heart's content.

However, this has challenges. The next time that a new version of that particular module is released you'll have to re-do all of these changes because the upgrade will replace your modified files.

Fortunately, for minor things like tweaking admin templates, or changing language strings, CMSMS handles this nicely.

Let's say you're using the CompanyDirectory module as more like a member, and you want to change a few language strings.

CMSMS supports overriding just the language strings that you want to override - it's a simple two step process:

  • Create a directory named module_custom/<ModuleName>/lang underneath your CMSMS root directory.
  • Next, create a file entitled en_US.php in that directory, and place in it the PHP file header and footer and just the lang strings you want to override.
$lang['addcompany'] = 'Add Member';

Now when you view the CompanyDirectory administration panel, you will see the words 'AddCompany' displaying at the bottom of the companies list. You can use this mechanism to override any string in the module. You will want to look at the original en_US.php file to find the keys for the strings you want to change.

You can use this technique to override strings in any language as well, just create an fr_FR.php file in the module_custom/<ModuleName>/lang directory, and adjust the strings in the same way. In this manner if you have an multi-lingual install or multiple administrators working in different languages you can make the changes consistent across all languages.

These simple steps can be used over and over again (just add more strings to the lang files) to customize the appearance of any module. And when you upgrade to a newer version of the module, your changes will be intact.


The method described above can also be used for Admin languagestrings, but the only difference is a different directory name.

Create a directory named admin/custom/lang/
The file filename is: en_US.php (or another language file name, ending in .php)