Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#12 | drupal-1391856-12.patch | 897 bytes | dawehner |
#11 | views-target-not-translatable-1391856-11.patch | 742 bytes | mariacha1 |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedThat 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.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedComment #3
hass CreditAttribution: hass commentedYeah, 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. 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.Comment #4
dawehnerAccording to http://www.w3.org/TR/html4/present/frames.html#adef-target it definitive makes sense to not translate the value of targets.
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.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedEach 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.
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.
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedA separate issue to address the translatability of 'target' is in order, given dereine's research.
Comment #7
hass CreditAttribution: hass commentedSorry, I missed to post the link to the exported view: http://drupal.org/node/965720#comment-5421906
Comment #8
hass CreditAttribution: hass commentedThere 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.
Comment #10
dawehnerSounds like a doable task
Comment #11
mariacha1 CreditAttribution: mariacha1 commentedI'm adding a patch to keep the "target" attribute from being listed as translatable.
Comment #12
dawehnerThank 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.
Comment #13
hass CreditAttribution: hass commentedComment #14
catchCommitted/pushed to 8.x, thanks!