vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced CMPS > Add-On Modules & Modifications > vBa CMPS v3.x & 2.x > Modifications (version 3.x & 2.x)

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2009, 03:48 PM
Luciano Luciano is offline
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
File Type: jpg screenshot1.jpg (93.4 KB, 139 views)
File Type: jpg screenshot2.jpg (96.1 KB, 119 views)
Attached Files
File Type: xml product-adv_portal_translate.xml (2.0 KB, 29 views)

Last edited by Luciano; 01-26-2009 at 02:20 AM. Reason: Added new screenshot
Reply With Quote
  #2  
Old 03-25-2009, 02:42 PM
ekantnl ekantnl is offline
Junior Member
 
Join Date: Jun 2008
Posts: 5
Default

Thank you a lot!

I have a multilanguage site (5 languages) and it works perfectly!
Reply With Quote
  #3  
Old 03-26-2009, 10:27 AM
Luciano Luciano is offline
Junior Member
 
Join Date: Aug 2005
Location: Vienna, Austria
Posts: 18
Default

Good to hear...
Luc
Reply With Quote
  #4  
Old 03-27-2009, 01:09 PM
KW802's Avatar
KW802 KW802 is offline
Administrator
 
Join Date: Mar 2004
Location: A galaxy far, far away...
Posts: 5,030
Default

Luciano, nice work!
__________________
Sci-Fi | Walking Dead Forum
Reply With Quote
  #5  
Old 08-01-2009, 02:47 AM
pony8028 pony8028 is offline
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.
Reply With Quote
  #6  
Old 04-05-2010, 01:47 PM
Hey Me Hey Me is offline
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?
Reply With Quote
  #7  
Old 12-14-2011, 04:21 AM
Selya Selya is offline
Junior Member
 
Join Date: Dec 2011
Posts: 7
Default

Works on vBa 4.1.2
Question up
How to translate page titles?
Reply With Quote
  #8  
Old 04-02-2012, 02:37 AM
Selya Selya is offline
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
File Type: xml product-adv_portal_translate.xml (3.4 KB, 1 views)

Last edited by Selya; 04-02-2012 at 03:07 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -4. The time now is 07:59 AM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.