Skins

How can I author or port a skin in multiple languages (a.k.a. "internationalising" skins)?

Scenario:
"I want to make my skin suitable for use in any language. Can I create language files to go with my skins so they are internationalised?"

Solution:
Plugin NP_Text.php allows skins to come with their very own language files so users no longer have to dig through messy html, css and Nucleus variables to completely internationalise skins / have skins display in their own language.

Original forum threads (thanks, Armon!):
http://forum.nucleuscms.org/viewtopic.php?t=14886
http://forum.nucleuscms.org/viewtopic.php?t=14904

Method:

  • Install the plugin NP_Text.php.
  • Create a language file, e.g. english.php. Define each constant / word / phrase you are using in your skin in the following format:
    <?php
     
    define("SL_VARIABLE", "value");
     
    ?>

    For example, in English the phrase "No comments" is "No comments". This would be defined in english.php as:

    <?php
     
    define("SL_NOCOMMENTS", "No comments");
     
    ?>

    However, in French it is "Pas de commentaire". THis would be defined in french.php as:

    <?php
     
    define("SL_NOCOMMENTS", "Pas de commentaire");
     
    ?>
  • Call your defined variables / constants using the skinvar <%Text(VARIABLE)%>, e.g. <%Text(NOCOMMENTS)%>. Depending on the skin language file the visitor is using, Nucleus will display the appropriate value, e.g. visitor using English language file will see "No comments" while visitor using French language file will see "Pas de commentaire".
section: Skins | submitted by Leng on 2007.Jan.31 | 2268 views

item rate
Total votes: 2 - Rating: 5.50

Please tell us how useful this answer was to you (0 = useless, 10 = very very helpful):

10