At least using XML output style, field labels get translated (and affect XML element names). This is very unwanted behaviour in XML, when I want the data structure to be exactly something, and not changing per language. I have set Views' localization plugin to "None" but it doesn't help.

Files: 
CommentFileSizeAuthor
#11 views_data_export.label-untranslated-1344592-11.patch720 bytesMegaChriz
FAILED: [[SimpleTest]]: [MySQL] 75 pass(es), 22 fail(s), and 84 exception(s).
[ View ]

Comments

Status:Active» Postponed (maintainer needs more info)

Did you set the following in the Views display: Advance --> Other --> Field Language to e.g., "Language neutral"?

Same problem here using CSV export. The option "Language neutral" is selected and also tried the other options of "Field language" with no success. And the content of Global Textfields gets translated too.

Had the same problem, I solved it by giving my labels unique names.

Assigned:Unassigned» Steven Jones
Status:Postponed (maintainer needs more info)» Active
Issue tags:+Needs tests

Let's get some tests in, and then fix this eh?

Status:Active» Postponed (maintainer needs more info)

I can't seem to reproduce getting any field labels in views to be translated, let alone the ones in Views data export. How are you getting the labels translated in the first place?

Assigned:Steven Jones» Unassigned

Same problem here. When accessing the view via the /de/ path the label "image" gets translated as "Bild" in the exported XML. Will try the recommendations above and report back.

EDIT:
Setting option "Language neutral" doesn't solve the problem. A unique label name does work but IMO is only a workaround.

Real problem for me as the Google contacts CSV syntax forces me to use labels like "name" and "birthday" and the corresponding fields are not identified when importing to Google because these labels get translated in the produced CSV file to "nom" and "anniversaire". I also need to rewrite field values using text like "home" (to specify a phone type) but this gets also translated to "accueil" !

I confirm that Setting option "Language neutral" or even "English" doesn't solve the problem.

In my case I solved the problem by adding a space in front of the labels, for instance: " Home". Then it doesn't get translated and the space seems not to cause problems during the Google importation.

A workaround can be to enable language detection, for example for 'session'. Then you can generate the XML with the English labels by adding the ?language=en to the URL. Problem is that the content can become English as well. In my case, I had added the path alias to the XML view and it fell back to the system path, because the path alias is localized.

Issue summary:View changes
Status:Postponed (maintainer needs more info)» Needs review
StatusFileSize
new720 bytes
FAILED: [[SimpleTest]]: [MySQL] 75 pass(es), 22 fail(s), and 84 exception(s).
[ View ]

It took me a long time to figure out at what place the label get its translation, but here is what I found:

  • In the method option_definition() of the class views_handler_field from the file views/handlers/views_handler_field.inc the following code marks the label as translatable:
    <?php
    $options
    ['label'] = array('default' => $this->definition['title'], 'translatable' => TRUE);
    ?>
  • The translation happens when $handler->init() is called in the method get_handlers() of the class views_plugin_display from the file views/plugins/views_plugin_display.inc.
  • Right before that init() call the label is still untranslated. I found out I could reach the untranslated label by calling get_option('fields') on an instance of views_plugin_display. That instance can be found on $view->display_handler.

So, in the attached patch the untranslated label is retrieved by calling get_option('fields') on the display handler. Note though that if a field handler overrides the label() method (for whatever reason), that code will not be executed. So there is a probability that this change has an undesired effect for some fields.

Maybe there is cleaner, better way to fix this problem, but I currently not see it.

Status:Needs review» Needs work

The last submitted patch, 11: views_data_export.label-untranslated-1344592-11.patch, failed testing.

Okay, label is not always available in the fields' info.