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.

WHM and cPanel Custom Plugins

Discussion in 'cPanel Developers' started by liang3391, Aug 31, 2009.

  1. liang3391

    liang3391 Active Member

    Joined:
    Apr 14, 2009
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    I do plug-ins in this way:
    cPanel Plugins - Developer


    I have added a Chinese plug-in cpanel, but how to make the Chinese language pack plug-ins with the movement changed? To plug into other languages is also a Chinese. What are control?
     
  2. MattCurry

    MattCurry Well-Known Member

    Joined:
    Aug 18, 2009
    Messages:
    275
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Houston, Tx
    #2 MattCurry, Aug 31, 2009
    Last edited: Aug 31, 2009
  3. liang3391

    liang3391 Active Member

    Joined:
    Apr 14, 2009
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    I just use cpanel website plug-in generator produces a plug-in, plug-in generator url: cPanel Plugins - Developer
    generated plug-in registration to cpanel, I want to insert pieces of the client be able to follow the client's language pack for language changes. I registered when the plug is in English fonts, how to make plug-in with the language pack to conduct changed?
     
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    You want your installed plugin to display properly regardless of the language selected in the cPanel interface?
     
  5. MattCurry

    MattCurry Well-Known Member

    Joined:
    Aug 18, 2009
    Messages:
    275
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Houston, Tx
    Chinease Interface

    Hello,

    I just wanted to clarify, if you are looking for a completely Chinese interface it will be available in 11.24.9, which is in beta. Please let me know if you have any questions.

    Please below link for more information on language setup and use:
    cPanel Community Language Resource - cPanel Inc.

    Thank you,
    Mathew Curry
     
  6. liang3391

    liang3391 Active Member

    Joined:
    Apr 14, 2009
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
  7. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
  8. liang3391

    liang3391 Active Member

    Joined:
    Apr 14, 2009
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    How do I give this plug-in the establishment of regional languages do?
     
  9. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This currently involves manual editing of files via the command line. As part of our revamping of the language system beginning in 11.25, we intend to eventually introduce official locale support for plugins (Internal Case 32966). In the meantime, you can follow these instructions to allow your plugin to display a different label based on the language selected for the cPanel interface:

    1. Open up the file generated by our plugin generator in your preferred text editor. Change the text after itemdesc: to $LANG{mylangkey} where mylangkey can be almost any alphanumeric string without spaces. This is what we call a "language key." Language keys help us look up phrases in language files (more on that later).

    So, instead of something like:

    Code:
    ...
    #cpanelif tag (just the stuff inside <cpanelif> not the tag>
    if:
    #Text to display in cpanel
    [B]itemdesc:Plugin by DavidG[/B]
    #order to display the item in cpanel
    itemorder:999
    ...
    
    We now have something like:
    Code:
    ...
    #cpanelif tag (just the stuff inside <cpanelif> not the tag>
    if:
    #Text to display in cpanel
    [B]itemdesc:$LANG{davidg}[/B]
    #order to display the item in cpanel
    itemorder:999
    ...
    
    If this plugin has already been installed, uninstall it.

    Now, install this plugin.

    2. When you look in cPanel, you'll probably see a "language key not found" error under your plugin. That's expected. Let's go ahead and create that language key.

    Language keys are stored in what we call language files. When you want to add your own language keys to the system, you create a .local file. For example, to create your own language keys for the english-utf8 language file, you would create a file called english-utf8.local. You would place this file in /usr/local/cpanel/lang/ so this key is available to all cPanel themes.

    Language files have a simple format of key=value on each line. Since I'm only creating 1 new language key (in my example, davidg), my /usr/local/cpanel/lang/english-utf8.local file that I created has this as its contents:

    Code:
    davidg=Plugin by DavidG
    I then repeat this process for each language I want to translate this phrase into. For example, I would create /usr/local/cpanel/lang/chinese.local if I wanted to have this message displayed in Chinese. The key (on the left side of =) stays the same, but the value (on the right side of =) changes to be whatever the phrase is translated as, in the other language.

    3. To apply these changes, run the following command via SSH:

    /usr/local/cpanel/bin/cleancachelangfiles

    4. If you still get language key errors or your language keys fail to update when you change them, I've found clearing the contents of /var/cpanel/lang.cache/ then running the above command helps the situation.


    If you need to display which language is currently selected within your plugin, the following API1 code will display the currently selected language:

    HTML:
    <cpanel print="$CPDATA{'LANG'}">
     
  10. liang3391

    liang3391 Active Member

    Joined:
    Apr 14, 2009
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    root@server09 [/usr/local/cpanel/bin]# ls clean*
    cleandeadqfiles* cleanupphpmychat*


    Cleancachelangfiles did not find this file, the client interface, prompt missing language key
     
  11. liang3391

    liang3391 Active Member

    Joined:
    Apr 14, 2009
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    /usr/local/cpanel/bin/cachelangfiles But this script does not exist
     
  12. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Try running /scripts/upcp --force

    If the script is still missing, please provide your full cPanel version information.
     
Loading...

Share This Page