The one that looks pretty strange is the single "dot" and I have no clue where this one come from:

  • t('.') ???
  • t('[url]'), $handler->display->display_options['fields']['url']['alter']['path'] = '[url]'; - I guess this should be excluded from extraction.
  • t('_blank'), $handler->display->display_options['fields']['url']['alter']['target'] = '_blank'; - I guess this should be excluded from extraction.

Here is the array:

  $translatables['Broken links'] = array(
    t('Defaults'),
    t('Broken node links'),
    t('more'),
    t('Apply'),
    t('Reset'),
    t('Sort by'),
    t('Asc'),
    t('Desc'),
    t('Items per page'),
    t('- All -'),
    t('Offset'),
    t('Edit link settings'),
    t('linkchecker/[lid]/edit?destination=admin/reports/broken-node-links'),
    t('Edit Linkchecker settings for this link'),
    t('.'),
    t('URL'),
    t('[url]'),
    t('External link'),
    t('_blank'),
    t('Response'),
    t('Error'),
    t('Status'),
    t('Edit node [nid]'),
    t('node/[nid]/edit?destination=admin/reports/broken-node-links'),
    t('Operations'),
    t('<ul><li>[nid]</li><li>[lid]</li></ul>'),
    t('Page'),
  );

Should I manually remove the dot? I'm posting a link to the linkchecker asap.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

That list is generated when exporting a view; the actual entry in all translatable sections is listed there so that when a view is embedded into a module, the strings can be easily translated with the basic tools. The system doesn't do any checking of the strings to make sure they're valid and actually translatable, and what is actually in the field is dependent upon usage.

For example, you have a string that is just a token replacement for another field, but it could Just as easily be "click on [url]" which you *would* want translated and there is no way I can think of for a system to automate excluding only the right ones.

I'm not sure there's much point to manually editing them out, as they will only re-appear if the view is ever exported again.

merlinofchaos’s picture

Status: Active » Closed (works as designed)
hass’s picture

Status: Closed (works as designed) » Active

Yeah, but above fields are technical fields. You are a bit fast in closing bugs...

Some strings should never be translatable. _blank is a target in a link element and one perfect example. I don't say we need to evaluate every value, but exclude technical fields. There is a list of allowed values for the Target field, but this field in REWRITE RESULTS form must be excluded from translation extraction. Field description is

Target of the link, such as _blank, _parent or an iframe's name. This field is rarely used.

. This is in no case a translatable string and there may be a few more technical fields to exclude like CSS classes. They may need to require tokens, but not t().

A good idea may be to add a whitelist/blacklist, what fields are allowed or not - to have translatable strings. Additional - there is NO dot in my view. How can a view generate a translatable string if the string is not used anywhere? I have no clue, but this is for sure a bug and not by design.

I'm fine with leaving the [url] placeholder field as is.

dawehner’s picture

According to http://www.w3.org/TR/html4/present/frames.html#adef-target it definitive makes sense to not translate the value of targets.

A good idea may be to add a whitelist/blacklist, what fields are allowed or not - to have translatable strings.

Well in fact you have to define the options which are available. On these definition you can set a flag whether an entry is translatable or not. See views/handlers/views_handler_field.inc::option_definition. Feel free to provide a patch to improve this.

As "." is not there by default, it's probably caused by some of your configuration. As always in the views issue queue
it helps a ton when you provide an export of your view. For example you can look at it to understand what you did.

merlinofchaos’s picture

Status: Active » Closed (works as designed)

Each individual field has a flag as to whether or not it's translatable. If you have an issue with a particular field being translatable or not, then file that issue. That is not what this issue appeared to be about. Please don't lecture me for closing this issue and then saying it's a different issue than you presented.

The issue you presented is that there are strings you didn't expect in the list of t(). This is, as I said, by design.

It is also not clear to me that 100% under no circumstances should the 'target' not be set translatable. It's entirely possible, but that would be its own issue where that field must be considered for as many possible use cases. If there is some use case where it needs to be translated then it should remain translatable.

If you have a numeric field you may, in fact, have a dot in your view because that would be the decimal which is a setting and is set translatable.

    $options['set_precision'] = array('default' => FALSE);
    $options['precision'] = array('default' => 0);
    $options['decimal'] = array('default' => '.', 'translatable' => TRUE);
    $options['separator'] = array('default' => ',', 'translatable' => TRUE);
    $options['format_plural'] = array('default' => FALSE);
    $options['format_plural_singular'] = array('default' => '1');
    $options['format_plural_plural'] = array('default' => '@count');
    $options['prefix'] = array('default' => '', 'translatable' => TRUE);
    $options['suffix'] = array('default' => '', 'translatable' => TRUE);

While it's certainly true that we do a kind of crappy job of localizing numbers with this setup, that also would be a different issue from what you presented.

merlinofchaos’s picture

A separate issue to address the translatability of 'target' is in order, given dereine's research.

hass’s picture

Sorry, I missed to post the link to the exported view: http://drupal.org/node/965720#comment-5421906

hass’s picture

Title: $translatables contain some bad strings » Don't export field display_options['fields']['url']['alter']['target'] as translatable string
Status: Closed (works as designed) » Active

There is no need to create a new case, if everything has been discussed here just to do it.

Topics may change over time / after analysis and this case topic now changes and is reduced to the "_blank" bug (views core) only.

dawehner’s picture

Category: bug » task
Issue tags: +Novice

Sounds like a doable task

mariacha1’s picture

Status: Active » Needs review
FileSize
742 bytes

I'm adding a patch to keep the "target" attribute from being listed as translatable.

dawehner’s picture

Title: Don't export field display_options['fields']['url']['alter']['target'] as translatable string » Don't mark field->options['alter']['target'] as translatable
Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.0 » 8.x-dev
Component: Translations » views.module
FileSize
897 bytes

Thank you, your code looks perfect, so committed and pushed.

Let's also get this into Drupal 8:
In general translation will probably be handled by some magic other system, but at least for proper documentation of which should be translatable we should update it there as well.

hass’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

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