Hi Guys

I was about to create a project in DO to do something similar to what this module does, but mines was simpler. I basically just return the first enabled language as according to the weight set in the language list page (admin/config/regional/language).

Would you consider creating a new branch with this functionality?
My thought was that the less amount of config and variables that need to be stored the better, and after all, language weight has no other use.

I have a sandbox project http://drupal.org/sandbox/jm.federico/1876362 with the code, but here it is (really short):

/**
 * @file
 * Module static_language.
 */

/**
 * Implements hook_language_negotiation_info().
 */
function weight_language_language_negotiation_info() {
  return array(
    'weight_language' => array(
      'callbacks' => array(
        'language' => 'weight_language_provider_callback'
      ),
      'description' => t('Set the language to the first in the <a href="@url">list of available languages</a>.', (array('@url' => url('admin/config/regional/language')))),
      'file' => drupal_get_path('module', 'weight_language') . '/weight_language.module',
      'name' => t('Weight'),
    ),
  );
}

function weight_language_provider_callback($languages) {
  return key($languages);
}

Comments

jox’s picture

Issue summary: View changes

This works great. Im using it now. Thanks.

I also vote for this method. I think it's a nice and natural approach.