Results 1 to 8 of 8

Thread: Translate Module Titles v.09 beta

  1. #1
    Junior Member
    Join Date
    Aug 2005
    Location
    Vienna, Austria
    Posts
    18

    Default Translate Module Titles v.09 beta

    Translate Module Titles v.09 beta
    I would need beta tester with boards with more than 1 language installed. Please report any bugs here.. ( Except for the known drawback - read bottom of post )

    File Edits: 2 (small ones)
    Product: 1 (attached)

    What the hack does:
    allows you to add translations for module titles... like in vbulletin for extra fields

    Limitations:
    Some modules are not really compatible.. like the Buddy-List module (because it is processed twice.. once for online users - that works but for the second pass - buddy-list - the module has been processed allready. so it keeps the original title.. at the bottom i added a little hack to make buddy list work also..

    I only tested with vbulletin 3.8 Gold and CMPS version 3.1

    Uninstall:
    undo the 2 file edits and uninstall the product.. (you can then delete the phrases in phrasegroup cmps Portal that start with cmps_block_

    Allthough it is non invasive, so if you dont use it will not eat any bread.


    Ah yes almost forgot.. when you delete a block, it deletes the created phrases automatically.

    Screenshots see below
    ------------
    Install:

    At first there are 2 file edits

    first open forums/includes/vba_cmps_include_top.php
    find:
    PHP Code:
                        // Link (placed before the switch() for modules that dynamically set a link) 
    above add:
    PHP Code:
                        //xba translate blocks
                        
    if(!empty($vbphrase['cmps_block_' $modid '_title']))
                        {
                            
    $mods['title'] = $vbphrase['cmps_block_' $modid '_title'];
                        } 
    I always use "xba" in comments for file edits.. because then.. if i want to find a file edit in a page i only have to search for "xba"

    save and close file..

    then open forums/admincp/vba_cmps_admin.php
    find:
    PHP Code:
    print_input_row($vbphrase['module_title'], 'module[title]'$module['title']); 
    replace with:
    PHP Code:
        // original
        //print_input_row($vbphrase['module_title'], 'module[title]', $module['title']);
        //xba multilanguage block titles
        
    print_input_row($vbphrase['module_title'] . '<dfn>' construct_link_code($vbphrase['translations'], "phrase.php?" $vbulletin->session->vars['sessionurl'] . "do=edit&fieldname=adv_portal&varname=cmps_block_" $module['modid'] . "_title&t=1"1)  . '</dfn>''module[title]'$module['title']); 
    thats it, your done for the file edits

    Now import the product.

    Thats all...
    now go to acp -->vBa CMPS -->Edit Modules
    open a module.. save it and open it again.. you now use the translate link ..

    ATTENTION!!!!:
    if you now go to acp and click the "Translate" link you will get a "No Phrases Matched Your Query" error.. That is NORMAL!!!
    because the phrase has not been created yet!

    So if you want to translate an existing module title you HAVE to do the following:
    • open the module for editing... do nothing except re-saving it.. as it is.. This creates the phrase!!!
    • You only have to do this once for each module if you want to translate the title
    • When you open it for edit again, the phrase exists and you can use the "Translate" link


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

    F.A.Q.: Why cant the phrase be created simply when adding a module?
    Answer: Because of the hook location! The new modid of a new module is only created 2 lines after the hook, and there is no other hook around. It could be done easely, but would require an aditional file edit, which nobody wants.

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

    As I said before I only tested it with the standard modules and with vbgallery module.. they work fine except for Buddy-List.
    To make "Buddy-List" work.. you have to do the following:

    open forums/modules/onlineusers.php
    find:
    PHP Code:
    $mods['collapse'] = $buddymod['modid']; 
    above add:
    PHP Code:
            // xba block names
            
    if(!empty($vbphrase['cmps_block_' $buddymod['modid'] . '_title']))
            {
                
    $buddymod['title'] = $vbphrase['cmps_block_' $buddymod['modid'] . '_title'];
            } 
    now it will work also for buddy-list

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

    Feedback would be appreciated

    Luc
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Luciano; 01-26-2009 at 02:20 AM. Reason: Added new screenshot

  2. #2
    Junior Member
    Join Date
    Jun 2008
    Posts
    5

    Default

    Thank you a lot!

    I have a multilanguage site (5 languages) and it works perfectly!

  3. #3
    Junior Member
    Join Date
    Aug 2005
    Location
    Vienna, Austria
    Posts
    18

    Default

    Good to hear...
    Luc

  4. #4
    Super Moderator KW802's Avatar
    Join Date
    Mar 2004
    Location
    A galaxy far, far away...
    Posts
    6,606

    Default

    Luciano, nice work!

  5. #5
    Junior Member
    Join Date
    Jun 2009
    Posts
    1

    Default

    How come it's not working for me.

    After I've done the installation. The Vba CMPS control panel can not be loaded.

  6. #6
    Junior Member
    Join Date
    Jun 2009
    Posts
    13

    Default

    Works on 4.0.0 RC1 thanks

    Is it possible to translate page titles as well?

  7. #7
    Junior Member
    Join Date
    Dec 2011
    Posts
    7

    Default

    Works on vBa 4.1.2
    Question up
    How to translate page titles?

  8. #8
    Junior Member
    Join Date
    Dec 2011
    Posts
    7

    Default CMPS Translate Module and Page Title

    Translate Module and Page Titles v.091 beta

    I have slightly expanded the product from Luciano, made by analogy.

    What the hack does:
    allows you to add translations for module and page titles... like in vbulletin for extra fields

    Limitations:
    Some modules are not really compatible.. like the Buddy-List module (because it is processed twice.. once for online users - that works but for the second pass - buddy-list - the module has been processed allready. so it keeps the original title.. at the bottom i added a little hack to make buddy list work also..

    Below I will try to give an example of how to fix it.

    About page title translations: I was able to translate all custom pages are added by the user, except for Default / Home page.

    Where it works:
    I only tested with vBulletin 4.1.11 and CMPS version 4.1.2
    Two language installed: Russian(default) and English.

    Uninstall:
    Undo the 2 file edits and uninstall the product.. (you can then delete the phrases in phrasegroup cmps Portal that start with cmps_block_, cmps_page_).
    When you delete a module or custom page, it deletes the created phrases automatically.

    Screenshots:




    Install:
    At first there are 2 file edits

    First open forums/includes/vba_cmps_include_top.php
    (don't forget to make backup file)
    Find:
    PHP Code:
        // Page title
        
    if ($pages['name'] == 'home' AND THIS_SCRIPT == 'adv_index')
        {
            
    $pagetitle $vbulletin->options['hometitle'];
        }
        else if (!
    $pagetitle)
        {
            
    $pagetitle $pages['title'];
        } 
    Replace with:
    PHP Code:
        // Page title
        
    if ($pages['name'] == 'home' AND THIS_SCRIPT == 'adv_index')
        {
            
    $pagetitle $vbulletin->options['hometitle'];
        }
        else if (!
    $pagetitle)
        {
            
    //xba translate pages
            
    if(!empty($vbphrase['cmps_page_' $pages['pageid'] . '_title'])) 
            {
                
    $pages['title'] = $vbphrase['cmps_page_' $pages['pageid'] . '_title'];
            }
            
    $pagetitle $pages['title'];
        } 
    Then find:
    PHP Code:
    // Link (placed before the switch() for modules that dynamically set a link) 
    above add:
    PHP Code:
        //xba translate blocks 
        
    if(!empty($vbphrase['cmps_block_' $modid '_title'])) 
        {
            
    $mods['title'] = $vbphrase['cmps_block_' $modid '_title']; 
        } 
    "xba" tag in comments is to quick a dfference with default file

    Save and close file.

    Then open forums/admincp/vba_cmps_admin.php
    (don't forget to make backup file)

    Find:
    PHP Code:
        print_input_row($vbphrase['module_title'], 'module[title]'$module['title']); 
    Replace with:
    PHP Code:
        // original 
        //print_input_row($vbphrase['module_title'], 'module[title]', $module['title']); 
        //xba multilanguage block titles 
        
    print_input_row($vbphrase['module_title'] . '<dfn>' construct_link_code($vbphrase['translations'], "phrase.php?" $vbulletin->session->vars['sessionurl'] . "do=edit&fieldname=adv_portal&varname=cmps_block_" $module['modid'] . "_title&t=1"1)  . '</dfn>''module[title]'$module['title']); 
    Then find:
    PHP Code:
        print_input_row($vbphrase['page_title'], 'page[title]'$page['title']); 
    Replace with:
    PHP Code:
        // original 
        //print_input_row($vbphrase['page_title'], 'page[title]', $page['title']);
        //xba multilanguage page titles 
        
    print_input_row($vbphrase['page_title'] . '<dfn>' construct_link_code($vbphrase['translations'], "phrase.php?" $vbulletin->session->vars['sessionurl'] . "do=edit&fieldname=adv_portal&varname=cmps_page_" $page['pageid'] . "_title&t=1"1)  . '</dfn>''page[title]'$page['title']); 
    That's it, your done for the major file edits. But some modules need changes too in "forums/modules/" folder. Be patient, I will explain below.

    ATTENTION!!!!:
    If you now go to acp and click the "Translate" link you will get a "No Phrases Matched Your Query" error.. That is NORMAL!!!
    Because the phrase has not been created yet!

    So if you want to translate an existing module or page title you HAVE to do the following:
    • open the module or custom page for editing... do nothing except re-saving it... as it is... This creates the phrase!!!
    • You only have to do this once for each module if you want to translate the title
    • When you open it for edit again, the phrase exists and you can use the "Translate" link


    ---------------------------------------------
    F.A.Q.: Why cant the phrase be created simply when adding a module?
    Answer: Because of the hook location! The new modid of a new module is only created 2 lines after the hook, and there is no other hook around. It could be done easely, but would require an aditional file edit, which nobody wants.
    ---------------------------------------------


    Now we'll translate some modules as I said before. Two modules for example:
    1. "Buddy-List" module
    Open forums/modules/onlineusers.php
    (don't forget to make backup file)
    Find:
    PHP Code:
    $mods['collapse'] = $buddymod['modid']; 
    above add:
    PHP Code:
            // xba block names 
            
    if(!empty($vbphrase['cmps_block_' $buddymod['modid'] . '_title'])) 
            { 
                
    $buddymod['title'] = $vbphrase['cmps_block_' $buddymod['modid'] . '_title']; 
            } 
    now it will work also for buddy-list

    2. "Navigation" module
    Open forums/modules/navigation.php
    (don't forget to make backup file)
    Find:
    PHP Code:
    $navigationbits[$npageid]['title'] = ($npageid == $pages['pageid']) ? '<strong>' $npage['title'] . '</strong>' $npage['title']; 
    above add:
    PHP Code:
        // xba pages names
        
    if(!empty($vbphrase['cmps_page_' $npage['pageid'] . '_title']))
        {
            
    $npage['title'] = $vbphrase['cmps_page_' $npage['pageid'] . '_title'];
        } 
    Now it almost will work also for Navigation module. Unfortunately I don't know how to translate Additional pages, added in "Navigation options" section.


    I would be glad of any help.
    Especially how to translate in Navbar the "Default / Home page" tab?
    Attached Files Attached Files
    Last edited by Selya; 04-02-2012 at 03:07 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Beta testers for multilanguage block titles?
    By Luciano in forum Module & Modification Discussion & Requests
    Replies: 0
    Last Post: 01-25-2009, 07:04 AM
  2. google translate module
    By deathemperor in forum Module & Modification Discussion & Requests
    Replies: 0
    Last Post: 10-28-2007, 07:43 PM
  3. I want to translate every vba module, how?
    By AVPFAN in forum "How Do I..." Questions
    Replies: 2
    Last Post: 07-23-2007, 09:46 AM
  4. How you can translate module title to your language
    By Alderwazeh in forum "How Do I..." Questions
    Replies: 0
    Last Post: 05-08-2007, 02:34 AM
  5. Translate Your Pages Via Google module?
    By oldfan in forum Module & Modification Discussion & Requests
    Replies: 0
    Last Post: 02-15-2007, 12:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •