The problem:

When creating a CSV-export of multi-lingual content using Views, the field "Content: Language" does not give the option to use the language code, but only the English or native name. This results in issues like this one, because the imported field does not contain the ISO code that Drupal recognizes as a valid language, but the language name.

Solutions would be possible in several modules:

The Feeds Tamper solution:

The solution here is provided in the form of a plugin. It simply replaces the language name with the corresponding code at import. If that fails or the language field is empty , "und" (undefined) will be used, resulting in "Language neutral".
Just rename the attached file to and place it in the modules/feeds_tamper/plugins folder.
After that a new plugin "Language to ISO code" is available, obviously to be applied on a field with English language names.

A more sophisticated piece of code might be possible using the Drupal API:
$languages = language_list('enabled');
that returns a list of installed languages. I didn't look into that.


Along the way I wrote a small reference article with a list of languages used in Drupal. Feel free to copy and paste it somewhere in the Drupal documentation (leave a cross-link here), as I couldn't find it there.

language_to_code.txt3.78 KBlolandese


Issue summary:View changes

Bolded the action required to apply this solution.

Issue summary:View changes

Readability enhancement

Issue summary:View changes

Clarified the use.

Status:Active» Needs review

Changed status. Forgive me for not providing a patch, as it is just a one file plugin addition (no alteration of existing code).

Issue summary:View changes

Emphasize what needs to

Status:Needs review» Reviewed & tested by the community

No objections for some time, thus changing status.

Status:Reviewed & tested by the community» Needs work

We should definitely load the language list from Drupal and not hardcode it in the plugin.

I'm not sure why you RTBC'd your own issue without anyone reviewing it.

Issue summary:View changes

Clarification of application