Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Plugins & Atahualpa (http://forum.bytesforall.com/forumdisplay.php?f=16)
-   -   qTranslate resets to home language (http://forum.bytesforall.com/showthread.php?t=17872)

JulesG Jun 24, 2012 09:28 AM

qTranslate resets to home language
 
Hi !

Using WordPress 3.4, Atahualpa Theme 3.7.7 and qTranslate 2.5.29

I built my own bilingual menu (French and English) and when in English language, selecting any menu item resets the language to French. When in French, it works correctly and stays in French.

You can see it in action here:
http://="http://julesgobeil.com/phot...photo/?lang=en

A qTranslate FAQ seems to imply that it would be due to improper code in the template:

Quote:

FAQ: Clicking on the Title/Home-Link resets selected language.
This is a template problem. Your template is using get_option('home') to get the link for the front page, which is BAD! get_option is not supposed to be used in templates. There is a function called bloginfo for templates. Use that instead and everything will work the way it is supposed to.
http://www.qianqin.de/qtranslate/for...1cdb0&start=10

I'm using this HTML code:

HTML Code:

<div class="menu_container"><p class="menuitems">

        <!--:fr--><a class="menuitem" href="http://julesgobeil.com/photo/?lang=fr/">Accueil</a><!--:-->
        <!--:en--><a class="menuitem" href="http://julesgobeil.com/photo/?lang=en/">Home</a><!--:-->

        <!--:fr--><a class="menuitem" href="http://julesgobeil.com/photo/photos/?lang=fr/">Photos</a><!--:-->
        <!--:en--><a class="menuitem" href="http://julesgobeil.com/photo/photos/?lang=en/">Photos</a><!--:-->

        <!--:fr--><a class="menuitem" href="http://julesgobeil.com/photo/articles/?lang=fr/">Articles</a><!--:-->
        <!--:en--><a class="menuitem" href="http://julesgobeil.com/photo/articles/?lang=en/">Articles</a><!--:-->

        <!--:fr--><a class="menuitem" href="http://julesgobeil.com/photo/bio/?lang=fr/">À propos</a><!--:-->
        <!--:en--><a class="menuitem" href="http://julesgobeil.com/photo/en/bio/?lang=en/">About</a><!--:-->

        <!--:fr--><a class="menuitem" href="http://julesgobeil.com/photo/services/?lang=fr/">Services</a><!--:-->
        <!--:en--><a class="menuitem" href="http://julesgobeil.com/photo/en/services/?lang=en/">Services</a><!--:-->

        <!--:fr--><a class="menuitem" href="http://julesgobeil.com/photo/contact/?lang=fr/">Contact</a><!--:-->
        <!--:en--><a class="menuitem" href="http://julesgobeil.com/photo/en/contact/?lang=en/">Contact</a><!--:-->

</p></div>

Can you help ?

juggledad Jun 24, 2012 11:53 AM

Please go to ato->export/import settings export your settings and attach them to a reply

JulesG Jun 24, 2012 12:40 PM

1 Attachment(s)
Thanks for helping me. Here is the requested file

Regards
J

juggledad Jun 24, 2012 01:16 PM

This is another sad case of computers doing exactly what you told them to do, not what you want them to do. If you go to ato->Add HTML/CSS Inserts->HTML Inserts: Body Top I see you have MANUALLY created a menu in French, so Atahualpa is not doing anything about the menu, you have already constructed it.

p.s. I'd like to know why they think the get_option shouldn't be used. the codex states
Quote:

Function Reference/get option
A safe way of getting values for a named option from the options database table. If the desired option does not exist, or no value is associated with it, FALSE will be returned.
and if you look, the FAQ entry is from 2008!

JulesG Jun 24, 2012 01:49 PM

Hi Juggledad,

Thanks for your reply.

This is exactly what I write in my first post and I even give the HTML code for the menu I created. If you look at the code, you will see that it contains qTranslate language tags to make it bilingual.

This is the menu that doesn't work properly in English. When switching to a different menu item, the language reverts to French. Try it, the URL is in the first post.

Thanks for helping me.

Regards
J

juggledad Jun 24, 2012 01:56 PM

what you have in teh css inserts is
HTML Code:

<mycode>

        <div class="logo_container">
                <h1 class="logo"><a href="http://julesgobeil.com/site_web_3/"></a></h1>
        </div>
        <nav>
                <div class="menu_container"><p class="menuitems">
<a class="menuitem" href="http://julesgobeil.com/photo/?lang=fr/">Accueil</a>
<a class="menuitem" href="http://julesgobeil.com/photo/photos/?lang=fr/">Photos
<a class="menuitem" href="http://julesgobeil.com/photo/articles/?lang=fr/">Articles</a>
<a class="menuitem" href="http://julesgobeil.com/photo/bio/?lang=fr/">À propos</a>
<a class="menuitem" href="http://julesgobeil.com/photo/services/?lang=fr/">Services</a>
<a class="menuitem" href="http://julesgobeil.com/photo/contact/?lang=fr/">Contact</a>
                </p></div>
        </nav>

</mycode>

I see NO 'lang=en' in that.

just where do you think you have the code you reference?

JulesG Jun 24, 2012 02:39 PM

1 Attachment(s)
Woops ! I'm so sorry. I'm working from the French site to build the bilingual site and I sent you the wrong CSS Insert. My bad - shame on me !

Attached is the correct one

Regards
J

juggledad Jun 24, 2012 02:50 PM

that contains the same code - those are the EXACT same file byte for byte - sure you didn't send the wrong one?

JulesG Jun 24, 2012 04:21 PM

1 Attachment(s)
Something is seriously wrong here. I sent you the correct CSS Insert and, after checking it, I realize that the English code lines have been stripped. Attached is a screen shot in PDF format of the Add HTML/CSS Inserts page. As you can see, the format for each menu item is this one:
Quote:

<!--:fr--><a class="menuitem" href="http://julesgobeil.com/photo/?lang=fr/">Accueil</a><!--:-->
<!--:en--><a class="menuitem" href="http://julesgobeil.com/photo/?lang=en/">Home</a><!--:-->
However, in the CSS Insert, the second part, the English one, is stripped and only the French part remains. I guess it is why it is always reverting to French.

All that remains of the original code is this:
Quote:

<a class=\"footerlink\" href=\"http:\/\/julesgobeil.com\/photo\/?lang=fr\/\">Accueil<\/a>\r\n\r\n\r\n
I have the same lines in Style and Edit Footer because I repeat the menu in the footer. Those have also been stripped of the English content.

What is going on ?

juggledad Jun 24, 2012 07:21 PM

Try disabling all your plugins to see if one is causing the issue. I just put that code in and it remains.

JulesG Jun 24, 2012 08:21 PM

Hi again,

Thanks for your patience. I just desactivated all plugins - only qTranslate remains. Same problem.

2 thoughts:

1- Should I uninstall Atahualpa and reinstall ?

2- Did you look at the qTranslate FAQ I was referring to ? Clicking on the Title/Home-Link resets selected language. This is the 4th one on this page:
http://www.qianqin.de/qtranslate/for...1cdb0&start=10
I'm not knowledgeable enough to check this unfortunately.

Many thanks for your help. It is much appreciated.

Regards
J

juggledad Jun 24, 2012 08:28 PM

Try this, disable qtranslate and then add that code in and see if both versions remain.

I don't think re installing would help

Yes I looked at that FAQ, but it is from 2008

JulesG Jun 25, 2012 05:46 AM

Good morning,

I really appreciate your help. Thanks for your patience. It took us many tries due to my inexperience but we're getting there...

The code has always remained in "Add HTML/CSS Inserts". It is only stripped from the Atahualpa settings file.

I disabled qTranslate. The code remained in BOTH CSS Inserts and in the Atahualpa Settings file as shown here:
Quote:

<a class=\"menuitem\" href=\"http:\/\/julesgobeil.com\/photo\/?lang=fr\/\">Accueil<\/a><!--:-->\r\n<!--:en--><a class=\"menuitem\" href=\"http:\/\/julesgobeil.com\/photo\/?lang=en\/\">Home<\/a>
Without qTranslate, I get bilingual pages with French followed by English and bilingual menus with 12 items.

Another thought: with qTranslate enabled, the English part is stripped but I can still switch a page from one language to another using the qTranslate widget. Also, when selecting a menu item in either language, it outputs the proper page in the selected language. This should mean that the English menu code is there somewhere in the programs even if it is stripped from the settings file.

Regards
Jules

juggledad Jun 25, 2012 05:53 AM

send me a copy of the atahualpa settings WITH both languages in it.

If the the setting file only ends up with one language when doing the export while qtraslate is active, then it is causing the problem for teh export (and how knows what else).

juggledad Jun 25, 2012 06:17 AM

Ok, I just did a test and looked at some of thier code. It seems the issue is that the plugin has a hook in the get_option code (which is why they are saying the theme shoulldn't use it) and are changing things based on what language you have set for the defaule. IMHO this is wrong and there is nothing the theme can do to correct it.

You are going to have to take this up with the plugin author.

JulesG Jun 25, 2012 07:08 AM

1 Attachment(s)
Hi Juggledad,

In case you still want it, here is the Atahualpa setting file with both languages when qTranslate is inactive.

I understand your answer even if it is not the one I was looking for. However, I have to find a solution because I have too much invested in Atahualpa. I love the theme, it works beautifully and support is outstanding (thanks!). Also, it works beautifully with the WP Photo Album Plus plugin - I will have about 2000 photos in it when finished so I guess you can understand I don't want to make a separate site for each language...

I have posted the problem in the WP qTranslate support forum last Saturday and I still have no response but it is the weekend. Honestly, I'm a bit afraid of the reply I will get if I get one... They will most likely tell me that this is a template problem because it uses the get_option function instead of bloginfo.

Since you have looked at the code, do you think it would be possible, without too much work, to change the code in either qTranslate or Atahualpa to make it work ?

Regards
Jules

juggledad Jun 25, 2012 07:41 AM

Can you tell me why you are putting the menu code in the CSS Inserts BODY and not just editing the pages and putting the french and english page titles in? If you do that, you can use eithor the Atahualpa menu's or create a wordpress custom menu and they seem to work fine

JulesG Jun 25, 2012 07:58 AM

Interesting question ! I have decided to do this when I started working with WordPress and Atahualpa to gain complete control over the looks and format of the header. I wanted some features that I was unable to put in the page menus: thin line above and below the menus, repeat the menus in the footer, change a menu item to underlined bold when hovering.

I was unable to code these to work within Atahualpa so I switched to HTML in HTML Inserts: Body Top. If you look below that code in CSS Inserts, you will see a section called /*-- Menu -- */ that countains all the style and format tags. This code origins from "The Turning Gate", that makes web engines for Adobe Photoshop Lightroom - I have modified it to serve my purpose.

With time I have gained some expertise in Atahualpa and programming, maybe I should try it again as you suggest. Do you really think it could work ?

Regards
Jules

juggledad Jun 25, 2012 08:10 AM

Quote:

I wanted some features that I was unable to put in the page menus: thin line above and below the menus,
use the %bar1 and stle it the way you want
Quote:

repeat the menus in the footer
use a wordpress custom menu - add a widget area to the footer, add the custom menu widget there

My quick test seems to indicate that it will work, you will have to try it in depth.

juggledad Jun 25, 2012 08:11 AM

Quote:

I wanted some features that I was unable to put in the page menus: thin line above and below the menus,
use the %bar1 and stle it the way you want
Quote:

repeat the menus in the footer
use a wordpress custom menu - add a widget area to the footer, add the custom menu widget there

My quick test seems to indicate that it will work, you will have to try it in depth.

for a quick test, just add '%bar1 %pages %bar1' to the 'Configure Header area' option - you will need to stle the %bar1 but worry about that later

JulesG Jun 25, 2012 08:36 AM

OK, I'll try it. It may take some time and I will report to you when it is done.

Many thanks again for your SUPER help. It is much appreciated.

Best regards
Jules

JulesG Jun 25, 2012 03:33 PM

Well, it worked !!

Here is the page:
http://julesgobeil.com/photo/accueil/?lang=en

The logo image switches languages
The top custom menu works fine

However, I have been unable to insert a custom menu in the footer. When I create a widget area in the footer, the logo in the header stops switching according to language.

I tried it twice with the same result. Here is what happens to the contents of "Style and edit Header Area / Show Logo Image ?"

Contents before inserting a widget in the footer:
Quote:

[:fr]logo_fr.png [:en]logo_en.png
Content after inserting the widget
Quote:

logo_en.png
This is not major. Yes I would like to have a logo in the footer but I guess I can live without it.

Here is the code I am inserting in Style & Edit Footer / Footer Content to create the widget:
Quote:

<?php bfa_widget_area('name=footer-widget'); ?>
I guess I tried hard enough on that one to leave it like that, unless you have another bright idea.

Regards
Jules

juggledad Jun 25, 2012 04:56 PM

this is qtranslate messing things up again. do this, add the widget area THEN add the
HTML Code:

[:fr]logo_fr.png [:en]logo_en.png
to the 'Show Logo Image?'

JulesG Jun 26, 2012 09:43 AM

Well, I tried your suggestion and it does not seem to work at my end. This qTranslate seems to be quite tricky. I already spent too much time on that footer menu - I think I'll forget it for now.

I still have to implement all my plugins and see if they work with qTranslate.

Thanks for your help. Much appreciated.

Jules


All times are GMT -6. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.