Include custom language files in theme

sc00zy

Active Member
Jan 2, 2006
27
1
153
Assen, The Netherlands
Hi all,

This weekend I made a custom theme based on Blueroy for my company. A preview can be seen here.

I added a few custom boxes like a newsletter and live support, but now I hardcoded the text in the theme itself. I would like to add new language strings. I can add them to the language files offcourse, but when there's an update I'll lose the changes I made.

I would like to include a custom language file for both Dutch and English in my new theme. In this files I want to place the new strings only.

Any idea how to do this?

Thanks in advance!
 

JordiCS

Well-Known Member
Dec 3, 2003
57
0
156
Catalonia, EU
cPanel Access Level
Root Administrator
Hello,

You need to work with non-standard locales. On WHM go to Locales --> Copy a locale. On "Duplicate Locale" select the language file to clone. Below, check the button "Non standard locale" and enter the following values:

"i_tag" will be the name of your xml file for that language. English: i_en (the locale file will be named i_en.xml), Dutch, i_nl (I suppose, since "Locales are identified by ISO standard language and sometimes territory codes", as explained there clicking on the "?"), and thus the locale file will be named i_nl.xml.

"Display name" is a name for you to identify a locale on WHM, enter there what you want.

Click "Duplicate". Go to Locales --> View Available Locales and you'll find the new created locales, applied to all your themes and cloned/custom themes. You can edit them on Locales --> Edit a Locale. Below "Locale Editor - Bulk Mode" select your non-standard locale for your cloned X3 theme and go.

I haven't tried to add new strings directly to a locale file, but I suppose there's no problem, as far as you write all special characters in correct UTF code. Be careful; if not well coded, you won't be able to upload the xml file back to the server. To do this, go to Locales --> Locale XML Download, choose your files, download them, open them, look for the series of keys for your cloned theme, and add there your new language keys and strings. You will find hundreds or thousands of lines repeated for every theme, and maybe go mad trying to find the right place for the new strings; for this reason I preferred not to edit directly these files, but, back to the WHM editor, to look for some odd and empty key and assign my own new value to it, and hardcode accordingly the html file the language string must be displayed on.

For offering these customized locales to your users, you must assign them to a package with the WHM Package manager, the same as you do for standard locales.

Hope this helps.
 
Last edited: