Now that we've reworked country_code to set the global language to a country-specific language (e.g., fr-CA for Canadian French), the views filter that implements a language fallback is no longer in any way country specific.

Previously, the filter detected the current country and current language and said: show me all content for the current country-language or for the current language if there is no country-language version.

Now, the filter says: show me all content for the current language (e.g., fr-CA) and as a fallback any content for a two-digit version of that language (fr). In other words, it has no direct tie to country and could be implemented separately.

Comments

nedjo’s picture

Title: Move country language filter to its own module? » Move country language filter to its own module

Yes, this needs to be done. The filter is not tied to country and so belongs in a new module.

What should we call such a module? "Views language fallback" would be descriptive but long.

nedjo’s picture

The patch in #325887: Lack of indexes produces hugely slow query should go into the new module.

nedjo’s picture

Issue #328194: Switch to all lower case language codes is also relevant. We should ensure the filter treats language codes as case insensitive.

nedjo’s picture

The filter should go in the "Node translation" group rather than the "Node" one.

recidive’s picture

Assigned: Unassigned » recidive

Working on this.

recidive’s picture

Status: Active » Needs review
StatusFileSize
new3.11 KB
new1.22 KB

I've moved language filter to a new module. I called it 'views language fallback' for now (name suggestions are welcome).

Patch and new module attached and need testing.

Question: do we need an upgrade path?

nedjo’s picture

Looks good. We should incorporate the indexes from #325887: Lack of indexes produces hugely slow query, see this patch: http://drupal.org/node/325887#comment-1090586

nedjo’s picture

Status: Needs review » Needs work

As for updating... That would be pretty challenging, since we can't count on the new module being installed. Should we instead have a script that can be manually run?

We need to identify just what needs to be changed. I guess it's data in views tables. Possibly just a straight sql update substituting the new module's filter name?

recidive’s picture

Assigned: recidive » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.38 KB

Added a .install file and hooks to create the indexes.

recidive’s picture

Assigned: Unassigned » recidive

Assigning back to me. I don't know why it got unassigned.

nedjo’s picture

Before posting as a contrib module, we should check in with merlinofchaos about whether this might go in Views.

recidive’s picture

Posted a feature request to views queue.

catch’s picture

We can't put it in views due to the indexes - views is read only. Should it live in its own small module, or maybe the i18n package?

nedjo’s picture

Too specific for i18n I think. Probably this belongs in its own small module.