The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Include custom language files in theme

Discussion in 'User Experience' started by sc00zy, Feb 14, 2010.

  1. sc00zy

    sc00zy Active Member

    Joined:
    Jan 2, 2006
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    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!
     
  2. JordiCS

    JordiCS Well-Known Member

    Joined:
    Dec 3, 2003
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    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.
     
    #2 JordiCS, Feb 15, 2010
    Last edited: Feb 15, 2010
  3. sc00zy

    sc00zy Active Member

    Joined:
    Jan 2, 2006
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Assen, The Netherlands
    Thanks Jordi,

    I will give it a try soon and get back to you!
     
Loading...

Share This Page