A few days ago I applied the i18n 7.x-1.5 update.

As a result my FAQ's page is showing now the faq's questions and answers in the original language (Dutch) and two translations (French and English) all together one after another in the same window and not just the current (selected) language.

See also http://drupal.org/node/1543416 where the author of the i18n module blames it on the Views module (and hence the FAQ module which uses also Views).

In Views I have a filter set: "Field language: Current user's language". That worked great till I updated i18n.

Can this issue be fixed soon, please?

Comments

redseujac’s picture

Assigned: redseujac » Unassigned
stella’s picture

Status: Active » Postponed (maintainer needs more info)

Well if you're using the supplied Views that come with the FAQ module and if the problem is with Views, then there's not much I can do for you here. Did you try JGO's suggestion from comment #10 in that issue? http://drupal.org/node/1543416#comment-5920280 Did that work for you?

On the other hand, if you're using the built-in page that FAQ module provides at /faq-page, then that's different and I'd need to look into it further.

stella’s picture

Upgraded to i18n-7.x-1.5 and am having the same problem in the non-Views listing, see my comment at http://drupal.org/node/1543416#comment-5935058 Need to wait for feedback to that.

redseujac’s picture

Not sure what you mean exactly in post #2, when you write about the "built-in page that the FAQ module provides at /faq-page".

When I installed the FAQ module this created automatically a View called FAQ with different possibilities. I thought it was there one had to set up some filters to let the FAQ module work properly in/with a multilingual site.

Of course my page "Frequently Asked Questions" and its translations are referring to the node "/faq-page", but that is not enough to make the thing working properly in a multilingual environment, isn't it?

Maybe I'm missing something? If so, I would be grateful if you could explain me more in detail.

Best regards

Jacques

stella’s picture

In Drupal 6, the FAQ module just provided a custom built-in page at /faq which wasn't powered by Views. You could control the layout of it in the FAQ admin settings. In D7, this page is now at /faq-page. The other faq listings the module provides are built using the Views module. Both appear to be affected and could potentially be a problem in the i18n module. I'm waiting on more information from the i18n maintainer.

redseujac’s picture

Remark for stella

It's strange: I do not have problems with another View I have created myself "News articles", as you can notice on my website www.daproverb.be.

Just click the different languages for "News articles" and you will see they are showing properly.

For "News articles" in Views I have following settings:
Filter criteria > Content translation: Language (= Current user's language)
Advanced > Other > Field language: Current user's language.

With the Views as part of the FAQ module it went wrong and it's impossible to make it work, even after removing the FAQ module and everything relating to it (Views, contents, etc.) and creating again from scratch.

Note: the page Frequently Asked Questions you see on my website now is not created with the FAQ module, but it's simply made adding "Basic pages" and links and their translation.

Best regards

Jacques

stella’s picture

marking as a blocker

paragshah2005’s picture

go to admin/config/regional/i18n/select
remove the "views" from skip tags...that solves the problem!!

regds,
parag

redseujac’s picture

Unfortunately it still does not work for me.

Regards

Jacques

stella’s picture

Status: Postponed (maintainer needs more info) » Fixed

Yeah removing the "views" tag is not really a stable solution. I've updated the Views code and also the in-built faq-page listing to accommodate the changes made in i18n 7.x-1.5 and both are working here for me now. It will be included in the next dev release of the module. I'd appreciate testing feedback if people have the time.

redseujac’s picture

Is that update included in dev release dated June 16, 2012?

If so, I will test it as soon as I find some time.

Best regards

Jacques

stella’s picture

Prob not, but it's in the one from 17th June for sure

redseujac’s picture

OK, I'll download and install the dev from 17th June and give it a try. Then I'll post my findings here.

Atragene’s picture

Correction I have made to correct this issues

  • go to \sites\all\modules\faq\faq.module
  • around line 464 add $langcode = $GLOBALS['language_content']->language;
        $default_sorting = variable_get('faq_default_sorting', 'DESC');    
        $langcode = $GLOBALS['language_content']->language;
        $query = db_select('node', 'n');
    
  • around line 468 change
        $query
          ->addTag('node_access')
          ->fields('n', array('nid'))
          ->condition('n.type', 'faq')
          ->condition('n.status', 1)
               ->condition(db_or()->condition("$weight_alias.tid", 0)->isNull("$weight_alias.tid"));
    

    by

        $query
          ->addTag('node_access')
          ->fields('n', array('nid'))
          ->condition('n.type', 'faq')
          ->condition('n.status', 1)
          ->condition('n.language ', $langcode)
          ->condition(db_or()->condition("$weight_alias.tid", 0)->isNull("$weight_alias.tid"));
    
    

I hope it will Okay for you !

redseujac’s picture

@stella

Ok, I have installed the dev from 17th june, made my FAQs (so called "recent faqs") and translated in two other languages.

Perfect! No problems at all. That dev version solved my problem I had after applying the i18n 7.x-1.5 update :)

Thank you very much, stella for this update!

Best regards

Jacques

redseujac’s picture

@stella

In my previous post I wrote everything was perfect and it still is, even after installation of the newest version of i18n (-7.x-1.6), but in my Reports I keep getting the following in Recent log messages:

"Notice: Undefined index: format in faq-view() (line 370 of ... /faq.module)."

When I look in this faq.module I see indeed at the line 370 the word "format", but I'm not well up in understanding the syntax to know what's wrong there.

Finally it's up to you to try to fix the problem shown continually in the Recent log messages.

Best regards

Jacques

Vietyank’s picture

I have installed the dev from 17 June. This has not fixed the problem for me.

Am I supposed to add a filter to the FAQ view? I am using the built-in page at /faq-page

Is there anything else I am supposed only see the FAQ Q&As in the user's selected language.

(flushed buffers)

Vietyank’s picture

I made modifications to the code as suggested in comment #14 and now it is working as I want it to. Those mod were not in the June 17 dev release that I installed. Just installing that release did not solve the problem.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Category: support » bug
Status: Closed (fixed) » Needs review
--- modules/faq/faq.module.orig	2012-12-01 15:58:12.000000000 +0100
+++ modules/faq/faq.module	2012-12-01 16:00:07.000000000 +0100
@@ -461,6 +461,7 @@
       return;
     }
     $default_sorting = variable_get('faq_default_sorting', 'DESC');
+    $langcode = $GLOBALS['language_content']->language;
 
     $query = db_select('node', 'n');
     $weight_alias = $query->leftJoin('faq_weights', 'w', '%alias.nid=n.nid');
@@ -469,6 +470,7 @@
       ->fields('n', array('nid'))
       ->condition('n.type', 'faq')
       ->condition('n.status', 1)
+      ->condition('n.language ', $langcode)
       ->condition(db_or()->condition("$weight_alias.tid", 0)->isNull("$weight_alias.tid"));
 
     $default_weight = 0;

This diff, based on Atragene's idea, enables only showing current language on default /faq pages in my sites (D7, FAQ 1.0-rc2, i18n 1.7). Forgive me my git ignorance.

phily’s picture

#14 solved it (FAQ 7.x-1.0-rc2, i18n 7.x-1.7 and Views 7.x-3.5)
Thanks

mrfelton’s picture

I haven't tested this yet, but on glance it looks like it doesn't properly consider content that is set to LANGUAGE_NONE.

mrfelton’s picture

OK, so what this thread fails to mention is that the adjustments that were made to get the language support working require the i18n_select module to be enabled.

Strutsagget’s picture

works like a charm, thx!

ericclaeren’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev
StatusFileSize
new800 bytes

Hi, I have created a small patch based on the solution in this issue http://drupal.org/node/1543416. Tested it and it seems to work.

odizle’s picture

I go this after applying the patch. anyone else got this?
Fatal error: Call to undefined function i18n_select_langcodes() in /var/www/vhosts/techshuk.com/sites/all/modules/faq/faq.module on line 472

lendude’s picture

odizle, did you enable the i18n_select module as said in #23?

Len

webdrips’s picture

I wonder what on earth I could be doing wrong at this point? I applied the above patch to the dev/RC versions of FAQ, enabled the Multilingual select module, translated both the FAQ pages and the taxonomy terms, etc. yet I still can't seem to get the FAQ to display in the non-default language.

I originally had the issue mentioned by the OP where both the untranslated and translated versions were showing up, but now I can only see the default language.

If I recall correctly, I believe when I enabled the Multilingual select module, that's when only the default language was being displayed.

Would someone be so kind as to post their settings on a working site? Are people using the Title module to replace the name field? What are your "Multilingual options" on your FAQ taxonomy? What about the FAQ content type's "Multilingual support" setting?

For the most part, the rest of my site is fully translated and working.

Thanks.

portulaca’s picture

For me the default FAQ page (I don't use Views) was showing two languages. Updating to dev version didn't help, but enabling the Multilingual select module (from i18n) did.

Thank you for all the suggestions from this thread.

webdrips’s picture

So my issue in #28 was solved by changing the "Categories layout" at /admin/config/content/faq/categories to "Don't display". If I try either "Clicking on category opens/hides questions and answers under category" or what I really want "Categories inline", I get an empty screen at /language/faq-page except for the two tabs at the top of the page.

Anyone get this working with Categories?

ezeedub’s picture

The patch in #25 worked for me to a point. I'm using Categories, and still have the problem when the categories layout is anything other than "don't display". I don't get the empty screen described in #30. I get everything as expected minus the actual translated term. For instance, I get the correct counts under a category/term. Eg, for 1 translated term with a faq in 2 languages, it shows a count of 1 not 2 (where it did show 2 before applying this patch). If I switch to the language the faq is translated to, I see only those terms/categories that have faqs in that langauge, I see the correct counts (different from the source language), but I do not see the translated term/category.

I'm wondering if the untranslated terms are related to this issue: #1371696: Taxonomy terms not translated when viewing/editing node

Or, if not that one, something else in i18n? The reason I say that is because I actually *do* see the translated terms in the term reference select on the node edit page for a faq translation. So, what else could be causing the terms to not be translated on the faq page?

ezeedub’s picture

Title: After upgrading to i18n.7.x-1.5 FAQ's are no longer filtered by language » tt() deprecated: FAQ's are no longer filtered by language
StatusFileSize
new10.8 KB

I think I found the issue. The function faq_tt() is relying on the deprecated (for D7) function tt().

There's probably more refactoring that could be done here. Anyone who's more familiar with these modules, feel free to suggest better fixes.

Also, I tested this is working for me using a vocabulary with translation mode "localized". Not sure if there are any side effects for other modes.

Rustan’s picture

On rc2 all faq questions showed for me. Upgrading to -dev fixed this, showing only the current language. No other changes, no patches. Multilingual select was activated since before.

Rustan’s picture

Issue summary: View changes

fixed a spelling error

freatida’s picture

Issue summary: View changes

I've followed instructions from #14
Posted by Atragene on June 18, 2012 at 6:32pm

and it worked like a charm.
thanks

Maya_SH’s picture

#14 is working ... thanks man

mixael’s picture

7.x-1.x-dev needs to be fixed as #14 to work correctly.

thanks to Atragene

  • stella committed 32cb33c on 8.x-1.x
    Issue #1548842: Fixed issue with multi-lingual listings as after...
sanchiz’s picture

Assigned: Unassigned » sanchiz
podarok’s picture

Assigned: sanchiz » Unassigned
Status: Needs review » Needs work
Issue tags: -D7 stable release blocker +Needs reroll

patch doesn't apply. Needs reroll

rfay’s picture

There are several basic problems here.

  1. The intent of the i18n_select module (a submodule of i18n module) is to automatically handle node queries and provide only the nodes that match the user's language. It does this by adding the user's language to any node query it encounters which do not already have either a) a query on the language or b) a query tag which says "stay away", which is configurable in the admin UI. So the overall intent of having i18n_select turned on is to *not* introduce code into a module to select by language.
  2. However, i18n_select bails on complex queries, and the query used by FAQ in the *non-categorized* if/else of faq_page() is complex. (Line 269 of i18n_select.module). (The non-categorized query in faq_page() does a very exciting ->condition(db_or()->condition("$weight_alias.tid", 0)->isNull("$weight_alias.tid")); which is definitely not something i18n_select can sort out.
  3. . This is the reason that the suggestion in #14 both works (and is required because i18n_select doesn't grok the situation).

  4. There are several places in the faq.module where the pattern is "if i18n_select is enabled, then add the language query". Which is really not the intent at all. If we want i18n_select to alter the query, we do *nothing*. If we don't want it to alter the query, we add a tag to it. There's a default tag, i18n_select, that can be added to disable ii18n_select for any query.
  5. The *categorized* section of faq_page() has a simpler query, but FAQ module has an override saying "if i18n_select is enabled, add a language query". That should probably be removed, and we can rely on i18n_select
  6. Taxonomy term translation via tt() has long been obsolete, so was not being done here, as pointed out in #32. The approach in #32 is correct, to switch from tt() to i18n_taxonomy_localize_terms().

I'm going to experiment a little bit more to see if there's a way to simplify that query so we could depend completely on i18n_select and let it do its job. In that case we could remove a bit of code and end up with a simpler situation.

rfay’s picture

Title: tt() deprecated: FAQ's are no longer filtered by language » FAQ's are no longer filtered by language AND categories are not translated

Updating title to reflect the various problems.

rfay’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new15.54 KB

Here is the patch to address the issues in #40. Note that you *must* enable i18n_select module, part of the i18n module, for selection of proper FAQ answers to be done.

Status: Needs review » Needs work

The last submitted patch, 42: faq.item_and_category_language_1548842_42.patch, failed testing.

rfay’s picture

#42needs a reroll after recent commits.

indigoxela’s picture

Any update on this old issue?

The problem still exists in faq 7.x-1.1 and drupal 7.56.