The node translation: language allows a view to be filtered by the users current language. It should also be possible to sort a view using the same criteria.

For example you might have a blog with posts in French and German, using views you should be able to make the blog language relevant to the visitor (showing German visitors the German posts at the top of the blog).

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new468 bytes

here is a patch for it.

sittard’s picture

The submitted patch adds the Node translation: Translation status option to the sort criteria but when selected you can sort by 'Ascending' or 'Descending' only. Which I guess is allowing me sort the language by name rather than by current user language.

Thanks.

dawehner’s picture

Status: Needs review » Needs work

Ah ok, Perhaps i will time to write this handler.

Gerto’s picture

Same here; need to be able to sort by language.

iamjon’s picture

Subscribing this would be a really cool feature.

Vote_Sizing_Steve’s picture

Subscribing - would be useful for me too in listboxes used in node reference fields.

dawehner’s picture

Status: Needs work » Needs review

It sor'ts but the language.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed to 3.x branches.

iamjon’s picture

Version: 6.x-2.10 » 6.x-3.x-dev

updating version

Status: Fixed » Closed (fixed)

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

eiland’s picture

Version: 6.x-3.x-dev » 6.x-2.16
Status: Closed (fixed) » Active

sorry for opening an old issue, but is it hard to backport this to views 2?

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Sorry, no features will be backported to Views 2; the only changes that will go into Views 2 are critical bugfixes (and even that is iffy as there are not enough people currently maintaining Views to pay attention to current stuff, let alone something old like Views 2.)

eiland’s picture

Category: feature » support
Status: Closed (won't fix) » Active

Ok I understand. i changed it to a support request, as it seems that custom sort-handlers aren't soo uncommon, and i'm sure someone already has it.

eiland’s picture

Version: 6.x-2.16 » 6.x-3.x-dev
Category: support » feature

Now I tested views 3 in D 6 and i understand that the patch was committed, but it s in fact not an resolving the op's question, to be able to sort by the current language.

Just to explain what is in my POV the use case:

I have nodes which can be - and are being - translated. I don't want to limit the view to displaying only translated nodes, because in some languages there are hardly any nodes, and the English ones will do, too. However, I do want the view to first display translated nodes in the current language, and then display nodes in other languages, so not mixing untranslated and translated nodes, hence sorting by (active) language.

The patch didn't provide this, it just provided sorting by language name, ignoring which is the current active language.

eiland’s picture

Status: Active » Needs review
StatusFileSize
new706 bytes

Okay, I'm not so much of a custom module writer, so I hacked the default 'random sort' to sort on the set language, default language and secondary, on node title. Works for me both with Views 2 and Views 3.
Be sure you don’t have a table sort on as it overrides other sort criteria.

Just backup /sites/all/modules/views/handlers/views_handler_sort_random.inc and replace it with the attached file.

chris matthews’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue