PDA

View Full Version : Translations dropdown in cms/blogs



anand
23-04-10, 15:18
Hi All,

We want to add Translations dropdown menu to cms/blogs/etc how can we do it & i did not find any option.


Thanks
Anand

vBET
23-04-10, 18:34
You have to edit appropriate template manually and add there:

{vb:raw vbenterprisetranslatorflagsdropdown}

You will also have to register it:
1. Open /includes/vbentrprisetranslator_functions_hook.php
2. Find:

vB_Template::preRegister('navbar', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));

3. Double this line and in one copy change navbar to your template name.

I add right now, on our TODO list to implement it in next vBET version.

anand
25-04-10, 05:02
tried in blogtemplates/blog_navbar_link

no success

Let me know which will be the appropriate template

anand
25-04-10, 05:11
Also found bug when we use Translations drop down menu position -> navbar end its shown twice in nav bar see the screen for more details


http://www.architectpavilion.com/twiceshown.jpg

vBET
25-04-10, 20:42
Also found bug when we use Translations drop down menu position -> navbar end its shown twice in nav bar see the screen for more details


http://www.architectpavilion.com/twiceshown.jpg

Are you sure you didn't add it also manually into template?

vBET
25-04-10, 21:02
tried in blogtemplates/blog_navbar_link

no success

Let me know which will be the appropriate template

For CMS: vbcms_navbar_link
For blog: blog_navbar_link

Also I see that those templates have plugins hook, so in next release we will make it fully configurable :)

anand
26-04-10, 14:34
Are you sure you didn't add it also manually into template?


Yes we did not edit any templates sure its just default vb 4.0.3

Thanks
Anand

anand
26-04-10, 16:04
For CMS: vbcms_navbar_link
For blog: blog_navbar_link

Also I see that those templates have plugins hook, so in next release we will make it fully configurable :)


Added the code but its not working not sure what we are doing wrong

blog_navbar_link -> {vb:raw vbenterprisetranslatorflagsdropdown}

/includes/vbentrprisetranslator_functions_hook.php ->



vB_Template::preRegister('navbar', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
vB_Template::preRegister('vbcms_navbar_link', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
vB_Template::preRegister('blog_navbar_link', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));



blog_navbar_link -> code below



*******************************************
<vb:if condition="$vboptions['selectednavtab'] == 'vbblog'">
<li class="selected">
<a class="navtab" href="blog.php{vb:raw session.sessionurl_q}">{vb:rawphrase blogs}</a>
<ul class="floatcontainer">
{vb:raw template_hook.blog_navbar_start}
<vb:if condition="$show['canpostitems']">
<li><a href="{vb:link blog, {vb:raw bbuserinfo}, null, 'userid', 'blog_title'}">{vb:rawphrase your_blog}</a></li>
</vb:if>
{vb:raw template_hook.blog_navbar_after_your_blog}
<li><a href="blog.php?{vb:raw session.sessionurl}do=list">{vb:rawphrase recent_entries}</a></li>
{vb:raw template_hook.blog_navbar_after_recent_entries}
<li><a href="blog.php?{vb:raw session.sessionurl}do=list&amp;blogtype=best">{vb:rawphrase best_blog_entries}</a></li>
{vb:raw template_hook.blog_navbar_after_best_entries}
<li><a href="blog.php?{vb:raw session.sessionurl}do=bloglist">{vb:rawphrase blog_list}</a></li>
{vb:raw template_hook.blog_navbar_after_blog_list}
<vb:if condition="$show['canpostitems']">
<li><a href="blog_usercp.php?{vb:raw session.sessionurl}do=editprofile">{vb:rawphrase blog_options}</a></li>
{vb:raw vbenterprisetranslatorflagsdropdown}
</vb:if>
{vb:raw template_hook.blog_navbar_end}
</ul>
</li>
<vb:else />
<li><a class="navtab" href="blog.php{vb:raw session.sessionurl_q}">{vb:rawphrase blogs}</a></li>
</vb:if>
***********************************************

vBET
26-04-10, 23:43
In described solution you need to have set custom place for flags!

To have it working in all configurations just do replace this:


if ('cu' != $vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']) {
$template_hook[$vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']] .= $vbenterprisetranslatorflagsdropdown;
} else {
vB_Template::preRegister('navbar', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
}


To this:


if ('cu' != $vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']) {
$template_hook[$vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']] .= $vbenterprisetranslatorflagsdropdown;
} else {
vB_Template::preRegister('navbar', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
}
vB_Template::preRegister('vbcms_navbar_link', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
vB_Template::preRegister('blog_navbar_link', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));

So in other words - put your 2 additional lines just 1 line lower (after "}").

Also I see that in template you put {vb:raw vbenterprisetranslatorflagsdropdown} inside of if clause - put it 1 line lower. It will give you:


*******************************************
<vb:if condition="$vboptions['selectednavtab'] == 'vbblog'">
<li class="selected">
<a class="navtab" href="blog.php{vb:raw session.sessionurl_q}">{vb:rawphrase blogs}</a>
<ul class="floatcontainer">
{vb:raw template_hook.blog_navbar_start}
<vb:if condition="$show['canpostitems']">
<li><a href="{vb:link blog, {vb:raw bbuserinfo}, null, 'userid', 'blog_title'}">{vb:rawphrase your_blog}</a></li>
</vb:if>
{vb:raw template_hook.blog_navbar_after_your_blog}
<li><a href="blog.php?{vb:raw session.sessionurl}do=list">{vb:rawphrase recent_entries}</a></li>
{vb:raw template_hook.blog_navbar_after_recent_entries}
<li><a href="blog.php?{vb:raw session.sessionurl}do=list&amp;blogtype=best">{vb:rawphrase best_blog_entries}</a></li>
{vb:raw template_hook.blog_navbar_after_best_entries}
<li><a href="blog.php?{vb:raw session.sessionurl}do=bloglist">{vb:rawphrase blog_list}</a></li>
{vb:raw template_hook.blog_navbar_after_blog_list}
<vb:if condition="$show['canpostitems']">
<li><a href="blog_usercp.php?{vb:raw session.sessionurl}do=editprofile">{vb:rawphrase blog_options}</a></li>
</vb:if>
{vb:raw vbenterprisetranslatorflagsdropdown}
{vb:raw template_hook.blog_navbar_end}
</ul>
</li>
<vb:else />
<li><a class="navtab" href="blog.php{vb:raw session.sessionurl_q}">{vb:rawphrase blogs}</a></li>
</vb:if>
***********************************************

anand
27-04-10, 06:42
adding this code makes system to go blank white pages & even admincp becomes white page

Thanks
anand

anand
27-04-10, 07:06
In described solution you need to have set custom place for flags!

To have it working in all configurations just do replace this:


if ('cu' != $vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']) {
$template_hook[$vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']] .= $vbenterprisetranslatorflagsdropdown;
} else {
vB_Template::preRegister('navbar', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
}


To this:


if ('cu' != $vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']) {
$template_hook[$vbulletin->options['vbenterprisetranslator_translationsDropdownMenu_position']] .= $vbenterprisetranslatorflagsdropdown;
} else {
vB_Template::preRegister('navbar', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
}
vB_Template::preRegister('vbcms_navbar_link', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));
vB_Template::preRegister('blog_navbar_link', array('vbenterprisetranslatorflagsdropdown' => $vbenterprisetranslatorflagsdropdown));

So in other words - put your 2 additional lines just 1 line lower (after "}").

Also I see that in template you put {vb:raw vbenterprisetranslatorflagsdropdown} inside of if clause - put it 1 line lower. It will give you:


*******************************************
<vb:if condition="$vboptions['selectednavtab'] == 'vbblog'">
<li class="selected">
<a class="navtab" href="blog.php{vb:raw session.sessionurl_q}">{vb:rawphrase blogs}</a>
<ul class="floatcontainer">
{vb:raw template_hook.blog_navbar_start}
<vb:if condition="$show['canpostitems']">
<li><a href="{vb:link blog, {vb:raw bbuserinfo}, null, 'userid', 'blog_title'}">{vb:rawphrase your_blog}</a></li>
</vb:if>
{vb:raw template_hook.blog_navbar_after_your_blog}
<li><a href="blog.php?{vb:raw session.sessionurl}do=list">{vb:rawphrase recent_entries}</a></li>
{vb:raw template_hook.blog_navbar_after_recent_entries}
<li><a href="blog.php?{vb:raw session.sessionurl}do=list&amp;blogtype=best">{vb:rawphrase best_blog_entries}</a></li>
{vb:raw template_hook.blog_navbar_after_best_entries}
<li><a href="blog.php?{vb:raw session.sessionurl}do=bloglist">{vb:rawphrase blog_list}</a></li>
{vb:raw template_hook.blog_navbar_after_blog_list}
<vb:if condition="$show['canpostitems']">
<li><a href="blog_usercp.php?{vb:raw session.sessionurl}do=editprofile">{vb:rawphrase blog_options}</a></li>
</vb:if>
{vb:raw vbenterprisetranslatorflagsdropdown}
{vb:raw template_hook.blog_navbar_end}
</ul>
</li>
<vb:else />
<li><a class="navtab" href="blog.php{vb:raw session.sessionurl_q}">{vb:rawphrase blogs}</a></li>
</vb:if>
***********************************************

its sure below if code may be while copying here i missed it

vBET
27-04-10, 21:54
its sure below if code may be while copying here i missed it

So there is an issue with blank page or given code is working? :)

anand
28-04-10, 15:29
given code is not working :( hope you have tested on vb 4.0.3 if not i will give you access to our webserver/vb


So there is an issue with blank page or given code is working? :)

anand
30-04-10, 11:49
still waiting for your replies??

vBET
01-05-10, 12:19
still waiting for your replies??

Sorry - had to accidentally miss his message. Please PM access and I will check and correct it on place.

vBET
02-05-10, 23:05
Done. Please note that give instructions are correct - you didn't made changes for hook file ;)

anand
03-05-10, 12:30
Done. Please note that give instructions are correct - you didn't made changes for hook file ;)

Thanks for the fix :D

Yes i added the code in the hooks but removed later since it gave me white blank pages & also note translation icon comes end of the navbar in blog/cms we want at start of navbar???


Also you can test yourself the navbar end problem yourself now since you have login & passwords with you

Thanks
Anand

vBET
03-05-10, 13:31
Thanks for the fix :D

Yes i added the code in the hooks but removed later since it gave me white blank pages & also note translation icon comes end of the navbar in blog/cms we want at start of navbar???


Also you can test yourself the navbar end problem yourself now since you have login & passwords with you

Thanks
Anand

To have it at the beginning just edit appropriate template and change place of vBET variable for drop-down menu.

I wrote you in PM that navbar end issue is caused by some other mod which duplicates whole content of $template_hook['navbar_end']. Please note that we are responsible only for our code and here it is not vBET bug. Please ask about solution author of mod which causes the issue. You can find guilty one by temporally disabling other mods one by one. Also you can just set custom place and add flags manually at the end of navbar.

vBET
03-05-10, 22:20
Added configuration options for drop down menu in CMS and BLOG navbar - will be included in 4.2.2

trevis
12-05-10, 16:41
You can also include in " of MediaWiki " navbar? :)

vBET
12-05-10, 18:08
You can also include in " of MediaWiki " navbar? :)

Cannot tell right now - do not know this mod. Please see answers for other posts you made about MediaWiki. I will be able to give you more specific answer when I will see how it is working on real forum. Also - to add flags for MediaViki please try first hints given here: http://www.vbenterprisetranslator.com/forum/vbet4-general-discussions/618-translations-dropdown-cms-blogs.html#post2579

But adopt it to MediaViki - so add just one preRegister line, change template name to the one used by MediaViki and add in this template our variable.

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Multilingual community supported by vBET Translator 4.10.1