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.
I'm currently translating Drupal Commons 3.2 (D7) to Norwegian Bokmål on localize.drupal.org Commons uses Views (and Panels) a lot.
I notice that all strings/titles set as
$handler->display->display_options['title'] = 'Some title';
can be translated on admin/config/regional/translate/translate on the server running Drupal Commons, but the same strings are missing from http://localize.drupal.org (Drupal Commons 3.2 is available on localize.drupal.org.)
- Is there a bug/missing feature in the parser when it comes to titles set as a display option for Views handler?
- Are the titles in Views always translatable or is this possible since Drupal Commons is using the Title module?
Comments
Comment #1
Gábor HojtsyViews exports include those strings wrapped in t() at the bottom of the export usually for this purpose. Views titles and the title module have nothing in relation, the Title module is for content entity titles and Views themselves are not at all entities in Drupal 6 or 7. Are these t() calls not in the exported views (at the bottom of the export?)
Comment #2
hansfn CreditAttribution: hansfn commentedThx for the quick reply. I didn't expect that the Title module had anything to do with this, but I didn't want to leave out any details.
No, the t() calls are missing from several of the views_default.inc files in Drupal Commons - example: "Recent site activity" in http://drupalcode.org/project/commons_activity_streams.git/blob/refs/hea...
So this is a bug (incomplete export of the views) in Drupal Commons? (I'm able to translate the strings on admin/config/regional/translate/translate on the server running Drupal Commons.)
Comment #3
Gábor HojtsyI believe the strings should be in the views exports, yes. I don't know how those export files where produced, but I'd recategorize this as a commons bug.
Comment #4
hansfn CreditAttribution: hansfn commentedI just verified that the views export contains the strings.
I tested with the view "commons_activity_streams_activity". At the end of export, you get:
This information is missing from commons_activity_streams/commons_activity_streams.views_default.inc
I haven't started creating patches since I don't know how these views_default.inc files have been created. It seems that if I recreate the related features, the "translatables" are included.
Comment #5
Gábor HojtsyYeah, theoretically if you re-export the view, it should differ in those t()s being there. You can diff and see if you don't have any other changes.
Comment #6
hansfn CreditAttribution: hansfn commentedYes, I have done that successfully for one view as a test. The question I'm asking is if it is worth while for me to do it (and post patches here) or if the Commons developers have some setup that automates this work?
Comment #7
japerryWe just do regular feature exports of our views, so I'm not quite sure why these wouldn't be showing up. Is it just some specific views or is it all of them that aren't translating? If I can get a list I can compare differences between the ones working and not.
Comment #8
ezra-g CreditAttribution: ezra-g commentedMarking as "needs more info" per #7 (specific list of the strings that appear to not be run through t()).
Comment #9
hansfn CreditAttribution: hansfn commentedRemember that this issue is about exposing translatable strings to (gettext) parsers like the one used on l.d.o, not about whether a string in a View is translatable in a Drupal installation. (Not sure what your really meant with "strings that appear to not be run through t()".)
The following files don't include $translatables:
Some random examples of strings that aren't available on l.d.o:
- "Recent site activity"
- "Recent activity in this group"
- "Upcoming events" (listed on l.d.o as part of other non-commons modules)
- "You're attending"
- "Search within group"
Comment #10
japerryNot totally done, need to get the 'commons_featured' module updated. And then do another audit of the site with translation on.. But here is a start:
http://drupalcode.org/project/commons_documents.git/commit/6d9d72c
http://drupalcode.org/project/commons_notices.git/commit/bd64297
http://drupalcode.org/project/commons_groups.git/commit/f4d53d7
http://drupalcode.org/project/commons_wikis.git/commit/ee9e05b
http://drupalcode.org/project/commons_site_homepage.git/commit/45219ed
http://drupalcode.org/project/commons_search.git/commit/e983a6e
http://drupalcode.org/project/commons_activity_streams.git/commit/89777dd
http://drupalcode.org/project/commons_polls.git/commit/a317355
http://drupalcode.org/project/commons_radioactivity.git/commit/f68d396
http://drupalcode.org/project/commons_content_moderation.git/commit/14dcad3
http://drupalcode.org/project/commons_posts.git/commit/f1b5f62
http://drupalcode.org/project/commons_q_a.git/commit/bfcb8a6
http://drupalcode.org/project/commons_follow.git/commit/522a98c
Comment #11
ezra-g CreditAttribution: ezra-g commentedIs Commons Groups really the right place to translate these strings? Surely these are not specific to Commons Groups. Perhaps Views module is the appropriate place for these, rather than duplicating in Commons Groups?
Comment #12
hansfn CreditAttribution: hansfn commented@japerry: Thx for your effort so far.
@ezra-g: If translatables were created manually I would agree with your thinking, but luckily they are created automatically when the view is exported. Anyway, a translatables list doesn't mean that the strings should be translated in this or that module, but that they are used there. The strings you listed are of course already translated and available on localize.drupal.org for all modules that use them.
PS! I'm not objecting to modify the export code in Views so such generic/common strings are excluded ;-)
Comment #13
Devin Carlson CreditAttribution: Devin Carlson commentedA patch for the remaining commons_featured module and then onto an audit.
Comment #14
Devin Carlson CreditAttribution: Devin Carlson commentedCommitted #13 to Commons Featured Content 7.x-3.x.
http://drupalcode.org/project/commons_featured.git/commit/6cc4924
Comment #15
Devin Carlson CreditAttribution: Devin Carlson commentedAfter performing a search through all of the views provided by the Commons modules, it looks like there are only three left.
Comment #16
Devin Carlson CreditAttribution: Devin Carlson commentedCommitted patches in #15 to their respective modules.
Commons Activity Streams
http://drupalcode.org/project/commons_activity_streams.git/commit/f2f1a0b
Commons Posts
http://drupalcode.org/project/commons_posts.git/commit/4808cae
Commons Radioactivity
http://drupalcode.org/project/commons_radioactivity.git/commit/f2678ba
Comment #17.0
(not verified) CreditAttribution: commentedUpdated issue summary -typo.