1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changes to "Language Packs"

Discussion in 'Language Packs' started by Nick, Jan 21, 2010.

  1. Nick

    Nick Well-Known Member

    When I was making the default theme, all the templates and language files were included from the default "Language Pack" or from plugins. If a user wanted to change the language they could simply copy those files into their language pack and edit them there.

    I thought it was very clever, until I started making a custom theme, that is.

    Until now, theme designers have had no control over the language. If a particular word or phrase was too big and wouldn't fit in their design, they were stuck!

    Language File Override System - Take 2

    In Hotaru 1.0.4, the "Language Pack" folder in the /content directory is removed. The original admin_language.php and main_language.php files are still there, but moved up to the content directory itself. These are considered the default language files and are included by Hotaru when the page starts loading.

    Likewise, the language files in plugin folders are also considered as default files. In other words, if Hotaru can't find them elsewhere, it uses these defaults.

    The fun begins when theme designers include their own "languages" folder and copy those default files into it. Hotaru will go to the theme first and use those files before falling back on the defaults.

    Simple, but tremendously handy for theme designers. And if someone wants to make language files in a different language they can throw all the files in a "languages" folder, offer it in these forums and users can just replace their theme's "languages" folder with the new one.

    Edit: To include the "main" language file in your theme. Copy "main_language.php" from content/ to your theme's "languages" folder (which you will probably need to make). Then add this at the top of you theme's index.php file (after the comments):

    PHP:
    $h->includeThemeLanguage();
    That will make your "main" language file override the original.
     
    sharkbyteusa likes this.
  2. Nick

    Nick Well-Known Member

    How To Make a Language Pack

    As of Hotaru 1.1.3, you can manipulate Admin language from themes.

    First, Hotaru gets the default admin_language.php from content/admin_language.php

    Second, it looks in an admin theme's "languages" folder for admin_language.php and merges that with the default.

    Third, it looks in a user theme's "languages" folder for admin_language.php and merges that with the above.

    So what's the point?

    Two benefits:

    1. Anyone making an Admin theme can override or change in part the default admin_language.php file.
    2. Anyone making a language pack, e.g. Chinese, can bundle all the files into a single folder called "languages", which a user can put in their regular theme. Instant Chinese across both regular and admin themes :cool:

    Instructions:

    1. Make sure the admin theme has $h->includeThemeLanguage('admin'); at the top of its index.php file.
    2. Make sure the regular theme has $h->includeThemeLanguage(); at the top of its index.php file.
    3. Put admin_language.php, main_language.php and plugin language files in a "languages" folder for the end user to put in their theme.
     
    shibuya246 likes this.
  3. penido

    penido New Member

    Nick

    you have the date of the release of version 1.1.3
    Tip:
    As in pligg has a language folder, file translated the entire site is translated, both admin and site
    this is possible in hotaru?
    you know very well the pligg

    Thanks
     
  4. dariush

    dariush New Member

    i've just done this but it doesnt work. I put the language folder with all plugin language files into the active theme folder but there is no changes. what other works should i do? meanwhile i add the code in the index.php file of theme and admin theme. what else remains?
     
  5. PuckRobin

    PuckRobin New Member

    Did you clear your language cache?
     
  6. dariush

    dariush New Member

    Thanks. The problem solved.
     

Share This Page