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

Multilingual Module - Announcement

Discussion in 'Modification Release' started by darek, Nov 22, 2008.

  1. darek Customer

    This is something I missed. I want to have full translation to 2 languages for my upgrade to v4. After creating Virtual Tour module, I gave it a try to create multi language module. I just wanted to have my 68c in polish and english. What it has:
    - totally independent page creation and edition, and more, it uses real files, so after creating languages and pages, you may download all pages files, edit them on your pc and upload back, however, it is still possible to edit the pages using admin (see files).
    - category translation in as many languages as you want
    - extra fields translation in as many languages as you want
    if you have any ideas about such module, let me know

    I forgot, what it will do:
    - generate language buttons for available languages
    - display available pages for a chosen language
    - display translated categories/breadcrumbs for a chosen language
    - display translated extra fields for a chosen language

    all will be nicely edited in the admin area

    Attached Files:

  2. ombre Customer

    great stuff, must have. How to get a copy for a review ? Thanks in advance.
    Does it work with 4.1 beta 2 ?
  3. darek Customer

    I am now working on the module, I know, I have sorted most problems so I could post a thread about it, however at the moment I am changing too many things and there is no front end files yet. This is what categories are going to look like

    If anybody is planning on using it, english is a default languge, the module needs all the data created with 68c (this is mostly for categories, breedcrumbs and extra fields), then this data can be translated and pulled out from the database, the module cannot translate english for the above; however it will be possible to turn english language off. The module will have totally independent from 68c page solution, only pages will be in all languages including english, the rest will use data created by 68c

    I will try to make the module working with any v4+ of 68c, though custom changes will be possible, it for sure will work on 4.1

    Attached Files:

  4. ZacWoe New Member

    I am impatient to see the results!
    Any update?
  5. darek Customer

    Zac, thanks, I had lots of other things to do and I had to put the module away for a moment, however I have changed lots of things since the annoucement.

    the admin actually has all the tools needed for creating pages and editing category translation, all seem to work very stable

    ok, if anyone interested I can give what I have for testing, if someone is seriously interested it would be possible to start creating pages on what has been done, I don't think I will change the part that has already been created

    for testing and review I will give between 50-100% off, however I am not shure how much I will want for it, the script became really complicated

    for sure I will finish it as I need it myself

    ----------------------------------------

    no more testing, so far I sent the module to 2 people, no one answered, no more testing, no more discounts
  6. nickhaughton Customer

    Hi again Darek,

    I also have a need to add a second language to 68, have you done any further work on this?

    Regards
  7. darek Customer

    lots since the annoucement, but I had no chance to set up the frond end yet
  8. hel68c Customer

    Hello Darek,

    All my site is Bilingual (English and French) . I'm not a programmer at all so a lot of try and try...

    We are now open since few days only. You can take a look HobbyClassified.com.

    If you need any help, let me know.
  9. darek Customer

    Serge, very nice work, I actually did the same before the module idea, I even got my categories translated and emails were sent in proper language, however it bothered me that for example "Animals" category was at the end instead at the beginning and to do that a module is rather necessary, also slug has to be the same in your system, I wanted to make it all easy and proper, page structure in my module is really easy, each language will have its slug, sorting of categories will be by its name.

    You did really good job!

    if you want category translation I did this:

    in Categories.php
    after line 47 ($rs['name']=htmlspecialchars($rs['name']);) write this:
    PHP:
    $slug = ( empty($rs['slug']) ) ? $rs['id']: $rs['slug'];
    $new_name 'LANG_CAT_'.strtoupper(str_replace("-","_"$slug));
    //echo $new_name."<br>";    
    if (defined($new_name)) {    
    //echo $new_name."<br>";            
    $rs['name'] = constant($new_name);
    } else {
    $rs['name'] = $rs['name'];
    }    
    then in french.php (I noticed you use english slug for categories)
    add translation of all categories like this:
    PHP:
    define("LANG_CAT_ANIMALS""Zwierzęta"true);
    where ANIMALS is slug animals for category Animals

    the above way will let you translate categories to any language where real slug is the variable that lets you do the trick

    the above code needs to be in a few places in Category.php
  10. hel68c Customer

    Nice trick

    thanks for sharing!
  11. darek Customer

    The Multilingual Module is ready for shipping

    it is a very complicated module (or at least it was quite hard to do it for me), I spent lots of time on it, and to be honest I did it for myself than for selling; however why not make some money on it... - it costs round $100, it will be shipped when paypal paymen done

    one module for one domain

    it has been tested on v 4.10 beta4 and I will correct issues for free if something comes up, I think it should work with any v4 and with a few changes with v3

    Attention
    this module does some changes to the system, it needs at least 2 major files to have changed (supplied) and it does change a bit original database, as I said, it is not an easy module, however I did try to make the system files as safe as possible and my tests didn't bring any dangerous issues
    but.. you use it at your risk

    also, I am not sure how much I will develope it, I will use it myself, so I guess if any new version appears I will update the module, the updates will cost money (I am not sure how much, probably not much as I tried to do the module quite independent from the 68c system)

    what the module does:
    - creates languages and displays them swapping language.php in front end
    - has independent page system where pages have this sort of links: index.php?page=new_page, it actually creates files so user after creating pages can download .tpl.php files edit them on his PC and upload back - they will display; pages are in module location (you will never loose them unless you do it manually)
    - translates categories
    - translates extra fields
    - make you possible to sent mails in different languages

    the installeation:
    - upload files
    - add some code to 2 php files
    - add some code in layout.tpl (to generate language and pages)

    what you will have to do
    - translate system files to language.php files (home page, terms, about, contact)
    - translate mail files

    the all.jpg shows you all at once

    Attached Files:

  12. darek Customer

    additional info:
    these are changes you will need to do to make the module work
    the changes can stay if you uninstall/delete the module, just nothing will happen if you leave the changes

    I have been testing the module on v4.10 beta5




    in layout.tpl
    ------------------------

    add kaywords for pages
    change:
    PHP:
    <meta name="Keywords" content="{$sitekeywords}/>
    to:
    PHP:
    <meta name="Keywords" content="{if $pageKeywords <> ""}{$pageKeywords}{else}{$sitekeywords}{/if}" />

    add page title for pages
    change:
    PHP:
    <title>{$sitetitle}</title>
    to:
    PHP:
    <title>{if $pageName<> ""}{$sitetitle} - {$pageName}{else}{$sitetitle}{/if}</title>

    create language buttons
    add:
    PHP:
    {foreach from=$MultiResults item="lang"}
    <
    a href="{$lang.changeLang}">{$lang.langName}</a> | 
    {/foreach}


    create page buttons
    add:
    PHP:
    {foreach from=$MultiPages item="pages"}
    <
    li><a href="{$pages.pageLink}">{$pages.pageName}</a></li>
    {/foreach}
    or

    PHP:
    {foreach from=$MultiPages item="pages"}
    <
    a href="{$pages.pageLink}">{$pages.pageName}</a><br>
    {/foreach}




    in index.php
    ------------------------

    change:
    PHP:
    $class_tpl->assign('body','home.tpl');
    to:

    PHP:
    if (!isset($_GET["page"])) 
    {
    $class_tpl->assign('body','home.tpl');
    }



    in init.php
    ------------------------

    add these lines at the end

    PHP:
    if (file_exists(FILESYSTEM_PATH .'modules/multilingual/langinit.php'))
    {
    require_once(
    FILESYSTEM_PATH .'modules/multilingual/langinit.php');
    }


    replace files
    ------------------------

    you also need to replace 3 files in includes/classes/kernel

    Mailer.php - this will let you send emails in language user uses
    Categories.php - this will change names for categories and breadcrumbs
    Listings.php - this will let you change names for extrafields


    the module doesn't really use the module system and new hooks, it should work for virtually any version of the 68c, appart from one thing, files Mailer.php, Categories.php, Listings.php need to be changed for the right version (probably)



    Also, I think it is worth mentioning
    - each category has its own slug, for english - english slug, for french - french slug, if particular language doesn't have a slug - it will use default slug used by the 68c system
    - each page has its own slug (page uri, whatever it is called)
    - categories sort using national translations, not system categories
    - pages can have thier own names and kaywords
    - the module has a totally independent page system, pages' links are: index.php?page=new_page,
    - pages are files, not data in database, after creating pages (module will automatically create files) you can download the files and edit them on your pc, then upload back - they will work
    - files are in the module directory - they will work for any template and you will not loose them unless you delete the module files

Share This Page