back to phpList.org

Tutorial - Creating Custom Language File

Hi, i just set up an override (custom) english language file for my users side and i wanted to share this in case it might help someone. I call it an override because to me it overrides the default file, but you can call it a custom file if you want, same thing.

I used phpList in the old days (php4 era) and so im new to this version and i hope this is the best way to do this. I have not found a better way yet :slight_smile:

First lets talk about why we might need a override/custom language file. Well lets say for example you dont like the wording of the default language and you want to change or add to the text. However, if you change the default file, any update that phplist releases will overwrite your changes and you will have to start all over again.

Thankfully you dont have to worry about that and you can just make your own custom language file. In this example i only did one english.inc file for the users side. This is how it is done for the english.inc file.

Go to lists/texts and find the english.inc file (there are some other files there like one with usa in the name , i didnt mess with those just this one file)

First you need to create your empty custom file, call it whatever you want but keep it all lower case and if you need a name seperator use the underscore and give it the .inc extention like so: my_custom_language.inc

Now open up the english.inc file and copy everything in it (top to bottom everything).

Now open up your custom language file you just created and paste everything you just copied into your new custom file. Now save your custom file.

Now go to your lists/config folder and open up the config.php file.

If you already have this value just change it to your new custom file name, whatever you named it.

$language_module = 'my_custom_english.inc';

If you do not have that value then you can copy either from here or from the extended config file and place it in your config.php file.

Then save the config fileโ€ฆ and thats it, now you can modify the text in your custom file and no worries when there is a new release because your custom file wont be touched.

A few cautions here:

When there is a new release you will need to compare your custom file to the new english.inc file from the release because there may be new language keys added or names changed. I use winmerge to compare files, its free and its easy to use.

Also if you are new to this, never ever ever ever open a php file in a word processing program, always use the code editor on cPanel or notepad or programmers notepad or notepad++ or some other editor used for code. If you open your php file using a normal word processing program it will put invisible characters in the file and you could corrupt the code.

I hope that this helps someone set up their own custom language file.

Dave :slight_smile: