Hello,

I'm trying to translate Drupal Commons. Nonetheless, it seems that I can't translate some strings.

1 - On groups page directory (/groups), I can't translate "Recent content" to "Contenu récent". There is a string "Recent content" that I can traduce in .po file, but modification doesn't work (only for the view name called Recent content).
2 - On group page (/groups/blabla), I can't translate "Create a post", "Create a document", "Create a Wiki", "Create a Poll", "List an event". There is no string related in po translation file. Nevertheless, for "Ask a question" button, it's okay ("Poser une question", in French) !
3 - For all content, under the node title, I can't translate "Post created by XX ...". It's okay for "created by". Nonetheless, there is no string to translate for node content type as "Post", "Poll", "Answer", even if I modified the name of content in content types administration. "Question", "Document" and "Wiki" are okay because it is the same names in French. But it is the same problem.

How can I translate these missing strings ?

PS : Sorry for my bad English ;)

Thanks a lot for Commons. It's an amazing application !
H. Servaes.

CommentFileSizeAuthor
#22 1942028-upcoming-events-22.patch1.68 KBhansfn
#10 r1.png170.32 KBmorphay
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

japerry’s picture

Assigned: Unassigned » japerry
mailfox’s picture

See #1 views
Is there a solution to translate # 2?
#3 admin/structure/types and admin/config/regional/translate/translate

mailfox’s picture

solution to translate # 2 here

jpontani’s picture

For the browsing widget, each button is added via an implementation of hook_commons_bw_create_all_widget in corresponding modules (ie commons_events provides the link for 'List an event', and it is currently untranslated).

The fix is to patch each content type module (events, wiki, posts, poll, q&a) and wrap the link text in the hook implementation in the translate function.

mailfox’s picture

So who will make the patch? I solved the problem ... but what about the others?

morphay’s picture

in 3.1 i could not translate messages in "admin/structure/messages" but in 3.0 it's worked, anybody can help?

upd: i added messages for other language whith "admin/config/system/message/text-copy" and translated them in "admin/structure/messages"...

japerry’s picture

jpontani’s picture

Missed a link in Wikis, committed here: http://drupalcode.org/project/commons_wikis.git/commitdiff/b763bae

For the translation issue #1 (Recent content), http://drupalcode.org/project/commons_groups.git/commitdiff/9aa600a

For the translation issue #3, Commons Origins has that text wrapped in t() already, and the node types should be available for translation, as the export for for hook_node_info() in each content type module has the name wrapped in t() as well, ie (some code trimmed to save space):

function commons_events_node_info() {
  $items = array(
    'event' => array(
      'name' => t('Event'),
    ),
  );
}
japerry’s picture

Status: Needs review » Fixed

oh thanks for caching that. Marking as fixed!

morphay’s picture

FileSize
170.32 KB

but what about post #6 ? it is also not translated in 3.2

tr

Antoine_k’s picture

Version: 7.x-3.0 » 7.x-3.2
Component: User interface » Events
Category: support » feature
Status: Fixed » Needs review

In the Commons Events submodule, the string "attendees" is not properly defined for translation in the commons_events/includes/commons_events.forms.inc file.

Line 34 should be modified this way:
'#markup' => format_plural($attendee_count, '1 ' . t('attendee'), '@count ' . t('attendees')),

Best regards!

jpontani’s picture

Status: Needs review » Fixed

The code and documentation for format_plural() has it already calling t() inside the function itself, so there is no need to pass it already localized strings.

This function ensures that the string is pluralized correctly. Since t() is called by this function, make sure not to pass already-localized strings to it.

And the corresponding code (only showing the returns that the function has):

function format_plural($count, $singular, $plural, array $args = array(), array $options = array()) {
    return t($singular, $args, $options);

    return t($plural, $args, $options);

    return t($singular, $args, $options);

    return t($plural, $args, $options);

    return t(strtr($plural, array('@count' => '@count[' . $index . ']')), $args, $options);
}
Antoine_k’s picture

I finally could fix it on my site (after hours)!
It has to do with the language configuration of your site.
Indeed, for me, all strings were set for "Undefined language" ([und]) but not for English and French. And I didn't understand how it works.

I had to go to admin/config/system/message/text-copy and copy all strings form "Undefined language" to "English" and other languages.
After that, I could modify the text strings in admin/structure/messages editing the entries I wanted to modify.

And it works now (think of clearing your cache after that) ;-)

Antoine_k’s picture

Thanks for your reply, but it didn't work for me, I really had to hack the core module... (I had already translated "attendee" and "attendees" and it wasn't displayed in my language)

morphay’s picture

I had to go to admin/config/system/message/text-copy and copy all strings form "Undefined language" to "English" and other languages.
After that, I could modify the text strings in admin/structure/messages editing the entries I wanted to modify.

And it works now (think of clearing your cache after that) ;-)

you have a Drupal Commons 3.2?

Antoine_k’s picture

Status: Fixed » Active

@morphay, yes my version is 3.2. Don't you have the same display on yours?

Nevertheless, I still have a string I can't translate:
it's a block title in user profiles: the title of the "Groups a user contributes to" view block is "Groups user_first_name contributes to" and I don't find the way to solve this :-/
Could anyone help me?

Thanks in advance!

japerry’s picture

Antoine_k, that issue is views related. Take a look at 'commons_groups_user_groups' -- it should be the title for that.

I'd suggest using i18nviews, even though d7 is in dev only right now.

http://drupal.org/project/i18nviews

hansfn’s picture

Related issue with work-around for translating activity stream - #1968238: Translation of activity stream / messages. (It's the same work-around as reported above several times with a little twist.)

hansfn’s picture

In commons_events/commons_events.features.field_base.inc there are multiple strings that aren't translatable. At least they don't show up on admin/config/regional/translate/translate ... Some example:

  • Physical Address
  • Online
  • Online and Physical Address
  • On this site
  • On another site

Reading #1827816: Add Title module it seems this should have worked.

PS! Please tell me if I should open a new issue.

hansfn’s picture

OK, this isn't part of the Events component, but maybe keeping these translation issue in the same thread is useful?

  • In commons_follow/commons_follow_node/commons_follow_node.features.inc the title "Other content" doesn't seem to be translatable.
  • In commons_follow/commons_follow_user/commons_follow_user.features.inc the title "People" doesn't seem to be translatable.
  • ...

See user/UID/notification-settings for all the troublesome strings.

hansfn’s picture

One more problem related to "override_title_text" used in Pages and Panelizer ... For example "Recent content" in ./commons_groups/modules/commons_groups_pages/commons_groups_pages.panelizer.inc and "Groups %user:field_name_first contributes to" in ./commons_user_profile_pages/commons_user_profile_pages.pages_default.inc doesn't seem to be translatable.

hansfn’s picture

There are some issues with plural handling in the views. The attached patch fixes these for the upcoming events view (commons_events_upcoming).

ezra-g’s picture

Status: Active » Needs review

Marking as "needs review" per #2.

victoria_b’s picture

Hi,

A few weeks back I tried to translate "Organizer" and "Organizers" to "Organiser" and "Organisers". It didn't work.

Could this be fixed too?

Thank you.

Devin Carlson’s picture

Status: Needs review » Fixed

The issue mentioned in #2 was solved with the commits in #7. The other translation problems mentioned in this issue have been fixed in -dev or require translation modules which are not included with Commons (ex i18n_views).

Marking this as fixed. Please try upgrading to the latest -dev release of Commons (or waiting for the stable 3.3 release) and checking if your issue(s) have been fixed. Any new or continuing problems should be filed as new, separate issues.

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