Creating a language pack
If you would like to create your own language for the Enhanced (and enhanced-like) skins, or even just change your character encoding (to UTF-8 for example), follow these instructions.
Note, there is a dedicated forum for language packs in case you're looking for one that already exists, or wish to contribute a pack you've created to the community. See the forum
- make a copy of the current language files to your own new language:
cd /usr/local/directadmin/data/skins/enhanced/lang cp -R en **yours** chown -R diradmin:diradmin * chmod -R 755 *
Where yours is the name of the language you want to use.
go into yours and edit all files to show the text you want your language to have.
From the User Panel, go to Site Summary / Statistics / Logs and select your new language.
If you want to also change the text in the images to contain your own language, you'll first need to take all of the images with text in
/usr/local/directadmin/data/skins/enhanced/images and edit them to look how you want. We won't go into detail on modifying images here.
Once you've made your own copies of the images (similar, but different names, in the same directory), you'll need to rename the image tags in the skins so that when a user accesses the images, the correct files are used. Go into the lang/yours directory, and edit "lf_images". There you will see all of the tags pointing to the old images that you don't want to use. You'll need to change the values of the image tags to something of your own.
What that will do is replace the image tags a browser is to load to use the IMG_YOURS_SKIN_HEADER instead. Now we also need to link IMG_YOURS_SKIN_HEADERS to your new files. Usually, this is done by adding the IMG_YOURS_SKIN_HEADER to the files_user.conf. BUT since all updates will just end up overwriting this file, a new file will be used: files_custom.conf
This file should not be included in any skins, and for this reason, will remain intact during skin updates. What it does is overrides all other files as it's checked first. We're not too concerned about it overriding other tags in this case because we're not using the same tag name (so that when you change languages, you'll see different images). The important aspect of it is that we can add custom tags in there without fear of losing them.
Create the files_custom.conf in your skins/enhanced/ directory and add:
where "images/header_new.gif" is the location of the image. You could actually put it in lang/yours/images/header_new.gif if you wanted, as it would keep things much cleaner. It doesn't really matter though. NOTE. as of 1.37.0, DA now supports a per-language files_custom.conf, so each language can have its own images. This would be used in place of the skins/enhanced/files_custom.conf.
Once this is done, you should be able to change languages seamlessly through the User Panel, and also see the different images for the different languages. Updates should not change/destroy anything.
NOTE about languages: Since we are constantly adding new features, new pages will most likely have new languages files which will not exist until you add them yourself.
Regarding the character set, if you wish to convert to UTF-8, do the above guide to create your own language pack, edit the lf_standard.html .
Find the code:
and replace it with
How to use UTF-8 in your skin
If you're using the enhanced skin with the "en" language pack and want to DA to use the UTF-8 encoding instead of iso-8859-1, but don't want to create an entirely new language pack or skin, do the following:
cd /usr/local/directadmin/data/skins/enhanced cp -p lang/en/lf_standard.html lang/en/my_lf_standard.html perl -pi -e 's/iso-8859-1/UTF-8/' lang/en/my_lf_standard.html echo "LF_STANDARD=my_lf_standard.html" >> files_custom.conf
How to translate hardcoded
Many of the result tables in DirectAdmin are hardcoded, meaning the text is set in the DirectAdmin binary and cannot be changed.
A trick to translate these hardcoded values would be as follows.
Find the html skin file which has the hardcoded token. Let's say it contains:
Edit the file to change that value to the following:
|$/usr/local/bin/php <?php $data = <<<END |TABLE_TOKEN| END; $data = str_replace("englishtext", "newtext", $data); $data = str_replace("englishtext2", "newtext2", $data); echo $data; ?> DONE|
Where englishtext is what's currently hardcoded and newtext is what you'd like it to be translated to. You can add as many str_replace commands as you'd like, but note that this isn't very efficient, so too many of these commands could slow things down.
How to customize one portion of DA skin
If you wish to only change one small aspect of a DA skin, you can do so by using the
files_custom.conf file. This file is related to the other 3 versions:
files_admin.conf. The only difference with the
files_custom.conf is that is has priority over the other 3 conf files. If the
files_custom.conf exists and there is a duplicate record in the
files_custom.conf and in the
files_custom.conf value has priority, thus allowing you to customize what the value of the record is. Note that the
files_custom.conf does not exist in any skin packages, thus it will be safe from updates of DA.
For example, if you wish to customize the webmail icon in DA, this method would be useful.
- First, change directory to the related skin directory that you want to customize.
You'll notice the 3 conf files in that directory.
- For this example, we're going to customize the webmail link. This link exists in the 2 files:
which are 2 variations of the header of the page (some are full wide, others have a side bar). The index DA uses to access those 2 files is found in the
files_user.conf, and shows up as follows:
- What we want to do, is copy those 2 files to our own versions, and then add the custom values into the
files_custom.conffile. The first step is to copy them to a name that isn't used, e.g.,
cp header_wide.html my_header_wide.html cp header_bar.html my_header_bar.html
Customize these 2 copied files however you wish. In this example, change the following:
value to where-ever you want the link to point. (In this specific example, it would only apply if you need a different HOSTNAME value because you can already change the WEBMAIL_LINK token with this guide).
- Now that your custom files are ready to be modified, use the
files_custom.confto override the default values so DA sees your custom values. Create the
files_custom.conffile in the same directory as the other 3 conf files. In it, put the following:
Save, and ensure the
files_custom.conf is world-readable (chmod 755).
NOTE: ensure the bottom of your
files_custom.conf file has a newline character (press enter after the last line). DA cannot read a line unless the end of the line has a newline character.
Now anyone who uses the Enhanced skin will now see your changes to the webmail button at the top of the page.
If the file you've changed is part of the enhanced skin, you may have missing |LANG_*| tokens. To resolve that link to the other lang file, e.g.,
cd /usr/local/directadmin/data/skins/enhanced/lang/en ln -s header_wide.html your_header_wide.html
Adding own custom banner/header image
DirectAdmin 1.51.3 has some basic functionality for very easily changing the header image in the enhanced skin, see:
This allows Resellers to change it in the global skin, affecting only their Users, without affecting anything in regards to the actual global skin install.
How to translate password difficulty related text
/usr/local/directadmin/scripts/difficult_password.php previously couldn't be translated and its output was what was shown.
With a new feature,
/usr/local/directadmin/data/skins/enhanced/lang/en/internal/difficult_password.txt could be used to translate password difficulty phrases.
The number codes in the .txt file are directly linked to the exit code of the script. So exit code 0 (success) lines up with:
By default, the contents of the file are as follows:
# cat /usr/local/directadmin/data/skins/enhanced/lang/en/internal/difficult_password.txt 0=Password OK 1=Password is too short (%d). Use at least %d characters 2=Password must have both upper and lower case characters 3=Password must have at least one special character such as !@#%$ etc.. 4=Password must have numbers #
%d characters, so this is the only special case where DA passes the integers into the translation class, so #1 must contain that string, e.g.,
1=Password is too short (%d). Use at least %d characters
The >2 doesn't matter, and you can add more if you want if you create a custom
difficult_password.php file with higher exit codes.
If any codes are missing from the
internal/difficult_password.txt, then the script's output is used instead.
But if the .txt for your language is completely missing, as per other
internal/*.txt files, it will revert to the default language, usually the en folder.
Also, there will be an environmental variable:
which should show the User's current language, in case you'd instead want to control the scripts output for items not included in the