As still too many options and modules in Drupal, Node Gallery is not really Multi language (yet). It is not possible to have just one and the same Gallery in several languages through Node Gallery!
When you want to translate a Node Gallery gallery, you are required to upload the images AGAIN for each new language. That is NOT the same gallery in several languages, that is several independent galleries that are somehow connected. I guess in the current situation, if you change a picture in the "English version" this doesn't sinchronize to the Dutch, Italian or Spanish version. That is not multilangauge and specially not efficient, in time, Kb and carbon footprint.
Are there any thoughts of turning this, further excellent, module to REAL Multilanguage?

Thank you, dankjewel, gracias, grazie, Danke schön, merci beaucoup, tusend takk, terima kasi, efgaristo, moito obrigado, arigato.

Comments

justintime’s picture

Since NG is just nodes, I think the Internationalization module may do this for you?

Specifically, pulled from it's Feature Overview:

Several selection modes are available for content, meaning you can have node lists for only the current language, for current and default languages, all languages, etc.

Does that give you what you need?

colordrops’s picture

sub

srobert72’s picture

Subscribing

msvilp’s picture

I have a partial solution for this problem:

I use locale and internationalization -modules, and I have basic multi-language site running (node translations etc.). Node gallery is version 6.x-2.0-alpha12.

I have translatable gallery nodes, but non-translatable image nodes. So I can internationalize my gallery descriptions but not image descriptions or image titles.

Each gallery can be translated to different languages, but normally all the images added to a translation stick to that node and are not visible in other languages. I changed this behaviour by modifying the SQL query to get images accross all language versions of selected gallery.

Here is the modified query. node_gallery.inc, line 129:

    $sql = "SELECT n.nid, n.vid, n.title, n.type, n.created, nr.body, ng.*, f.* 
        FROM {node} n_identify
        LEFT JOIN {node} n_all_langs ON (n_identify.tnid = n_all_langs.nid)
        JOIN {node_galleries} g ON (n_identify.nid = g.gid OR n_all_langs.nid = g.gid)
        JOIN {node} n ON (g.nid = n.nid)
        JOIN {node_revisions} nr ON n.vid = nr.vid 
        JOIN {node_galleries} ng ON n.nid = ng.nid 
        JOIN {files} f ON ng.fid = f.fid 
            
        WHERE n_identify.nid = %s AND n.status = 1
        ORDER BY ng.weight, ng.nid";

Should this kind of behaviour be provided as option, or even default? If so, I can put together a patch.

dddave’s picture

Category: feature » bug

If this isn't working this is a bug. There is already this issue: #759322: Multilingula support with i18n so it seems that i18n is not 100% at the moment. I am going to take a look on the i18n abilities and report back.

dddave’s picture

Title: Multi language Node Gallery without having to upload the same images again for each language. » Multilanguage Node Gallery
Category: bug » feature

Ok, this needs some thinking. The described behavior is logical as translations ARE new nodes. Therefore the gallery relationship runs somewhat empty when the added pictures were attached to the untranslated gallery node. When we translate the gallery node we create effectively a new gallery. Because this is the default drupal behavior this does not qualify as a bug.
One of the maintainers needs to have a look at this in because I cannot judge the implications of the code change proposed in #4.

Translating images is working. Of course it would make no sense to create an English gallery and attach German images because German users wouldn't be able to see the gallery in the first place. So translating images at the moment only makes sense for neutral galleries.

The problem here is that instead of two nodes connected via a relationship (gallery+image) we have to juggle four now. I don't know if this can architecturally be solved properly. The link in #5 describes additional interface problems.

Thoughts?

justintime’s picture

Do you have any idea how i18n keeps track of related nodes? There's got to be something that says nid 3 and nid 4 are translations of nid 2. I have never dug into i18n, so I'm at a loss.

dddave’s picture

I have a faint of memory about reading a write-up once. I'll see if I can dig it up. You may contact Jose Reyero or one of the other maintainers but perhaps directly as the i18n issue queue has its problems...

Don't wait for it tonight though. Need some sleep.

justintime’s picture

NM, I see the tnid field from the SQL above. I just don't know enough about this to really feel comfortable. @scroogie is multilingual, perhaps he can chime in?

scroogie’s picture

This is core translate. All nodes that are in fact translations of other nodes have the nid of the "original node" in the tnid column.
We would need to check if the content type is translation enabled and then load the source node. There are core functions to do that. It would look like that:

if (module_exists('translation')) {
  if (translation_supported_type($node->type)) {
    if ($node->tnid) {
      $source_node = node_load($node->tnid);
    }
  }
}

The problem is that the translated node still is a node on its own, so users can specifically upload to that node.
The question is what do the users want? Do they want that galleries are all the same in all languages, or do they want to delete or add images in other languages? I'd say let's make all our pages (Upload, manage, sort, etc.) smart enough to use the original node id instead of the translated one. This would make sure that all galleries are the same.

The problem gets harder when people start to translate image nodes, because then we would have to ask ourself how to deal with 'french' image nodes that are attached to 'english' galleries and so on.

scroogie’s picture

Actually, I take that back. Perhaps it would be a cool feature to be completely capable of internationalization, I don't think a lot of gallery modules are. But I'd invest in this if there would be enough users interested in it.

The thing is, Views supports filtering by content translation, so we could make our gallery real smart:

Gallery language neutral -> display all language neutral images (and by a global option show images of all languages)
Gallery of language x -> display all language neutral images plus all images of language x

filefield works with reference counting, so we would add new references to the fid to the table content_field_node_gallery_image.

It only makes sense to spend time on this, if there would be enough users interested in it, though. Perhaps we can implement #10 first and put this here on our todo for later versions.

srobert72’s picture

I'm interested in this feature ;-)

justintime’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev

Judging by all the issues I've seen over the last 8 mos or so that I've been involved, I think there's a pretty strong following internationally. I think it may be worth it if it can be done cleanly. The scope of this has definitely warranted bumping it up to an NG3 feature request. Writing this feature into 2.x would invariably introduce some bugs, and further delay the beta release.

dddave’s picture

Agreed. Unless someone can implement this cleanly we have to live with the status as is. I'll try to find some time to provide some docs to summarize the i18n-ability of NG2.

Perhaps, after a ("final") beta of NG2 is released any progress on this (perhaps someone provides a decent patch) can be put into the NG2 dev.

For NG3 sensible i18n integration is really a must have. This still warrants some thinking about usecases before it is implemented.

dddave’s picture

Priority: Normal » Major

Just to keep it on the radar. Nedd to check out NG3 sometime soon to evaluate...

BTW noticed that I wanted to do a write-up...narf.

scroogie’s picture

Perhaps we can put this on some kind of Roadmap for later 3.x versions.

scroogie’s picture

Just bumping this so I don't forget it. Sorry.

dddave’s picture

Is there at the moment any awareness of language settings in NG3? It seems to me that content (gallery or image) is displayed regardless of the language it is set to. So if my site is in English mode I can see German galleries and images.

savedario’s picture

I am interested in this feature too.

scroogie’s picture

This is still tricky. I don't think I'll have enough time to do this properly now, so perhaps we should postpone this. What we need to do:

- attach a language filter to our views that by default does nothing (lets all nodes pass)
- on gallery node view:
- if the image type is translateable, but not the gallery type, set the filter to show only images that are language neutral or of the current language.
- if both types are translateable, set the filter to display only images that are language neutral or of the language of the gallery
- adapt our custom queries for translations
- write a node api hook for 'prepare translation' that carries our gallery nid over for images

The big open question is how to handle translations of galleries, and I don't know a solution for that right now. If images already exist in the gallery, we would probably have to carry them over depending on the language of the source gallery and the language of the images. In that case we need to duplicate the nodes with Batch API setting the tnid and gid properly. If a source node changes, it's the responsibility of the site admin to change the child translations. Other modules do the same.

All this seems technically possible, we just need the time to carry out the work.

justintime’s picture

Status: Active » Postponed

Postponing this for 3.1 - there's too much to do, and there's a good chance that much code will bring about new bugs that would further delay release.

ayalsule’s picture

subscribe , waiting for 3.1.

krishinsh’s picture

Subscribing

Suren’s picture

I also need that feature very much.
Subscribing

krishinsh’s picture

I was looking in to the Node Gallery source (Node Gallery 6.x-3.0-alpha3) and found a place where the image nids are collected:
node_gallery.inc line 348:
$sql = "SELECT ngi.nid FROM {node_gallery_images} ngi JOIN {node} n on ngi.nid = n.nid WHERE $where gid = %d $orderby";

My idea was to change the image node list similar to comment #4 to get the list of images of current gallery and also the translation galleriy linked by the filed node.tnid

My questions is- can I actually do that? Is there something that will brak after I do this ?
I need to get the translation running as soon as possible and I want to see the same images in both translated and original gallery.

suffering drupal’s picture

Hello again,

I just happened to run into this very old post of mine. (It has taken me some time to discover how to find my own postings back...) And surprisingly the issue still hot here.

In the meantime I have been able to solve the language issue long ago thanks to Gallery Assist :-)) - http://drupal.org/project/gallery_assist.
It has the "syncronize" effect directly incorporated, so you just make a nice source page with it's gallery, and then all translations simply inherit the gallery. Even so, you can "internationalize" the description (title) to the fotos, in other words, the same gallery can have different descriptions for each language.... that is, if you have the time to comment them all of course ;) You can also add a caption and even a copyright reference. Additionally it has a lot more options that are really cool, too many to mention actually.

If you (still) have the same problem as I had on starting this post, a year and a half ago, you really should have a look. It is one of the very few modules in Drupal that did NOT make me suffer! :) And in fact, we couldn't even have launched our website without it.

I happily invite you to get a live impression at http://costadelaluz.on-map.net/en/beaches/los-canos-de-meca-coast-of-lig...
this is one of our few galleries where you can see the translation of the descriptions. Best is to click the description text below the thumbnail to really enjoy it - that's where you really go to the slide-show (http://costadelaluz.on-map.net/en/beaches/los-canos-de-meca-coast-of-lig...). Clicking the photo itself opens up the lightbox.

ctrnz’s picture

As far as i see 3.x relies on Views to display output of images.
Therefor I suppose - something can be done about in Views themselves. No need to break a module.
However when I select Node Translation: Source translation as Relationship it is not enough.

Perhaps someone could give a clue how to choose Parent gallery from Source translation and then use it for picking up images?

ctrnz’s picture

Here is my "workaround".
First of all - what I needed (everyone has unique needs).
I have gallery content type which is in two languages. Gallery images are language neutral.
When You create this content (Parent gallery) images are uplaoded. After that you translate this content (another Parent gallery but in different language). My wish was to avoid image uploading again.

I made use of viewsphpfilter
So I crated one more page display in node_gallery_gallery_image_views. Let's call it "Translation". Made argument Override and removed it from this display.
Then I added Views filter Node: PHP filter. Relationship is Parent Gallery, Operator is Filter to these IDs, Handel is PHP code and code itself is

$view = views_get_current_view();
$args = $view->args;
$nid = $args[0]; 
$tpath='node/'.$nid;
$allnids=translation_path_get_translations($tpath);
$gid=str_replace('node/','',$allnids['set-your-default-language-here']);
return $gid;

Code still should be improved with IFs to make it much safer but I just giving idea how to do it.

All You need after this is to change gallery settings and set Gallery view definitions to "Translation".
Thank You for great gallery module! :)

scroogie’s picture

Crosslinking to another i18n issue that should be respected: #1109074: Noderef field count no image in other language

ayalsule’s picture

is it time to active this issue?

crea’s picture

Subscribing

ayalsule’s picture

@ctrnz your method in #28 dosen`t worked with me, is there any thing missing , please recheck
thanks.

ImanDalain’s picture

I need this feature too ... asap please.
thanks a lot.

ayalsule’s picture

did you tried method in #28, give us your reviews.

ctrnz’s picture

I did recheck and i can't see anything missing. Do you have same needs as I did?
What is your setup and what errors do you get?

ayalsule’s picture

I just want to avoid upload images again, can you confirm and explain more views steps , step by step please
many thanks :)

ImanDalain’s picture

i did the same steps at #28 but it didn't work :(
i don't know why, i have the same needs.

would you please provide me with the step by step process

thank a lot :)

ctrnz’s picture

Have you done this step?

All You need after this is to change gallery settings and set Gallery view definitions to "Translation".

I've just recreated everything with clean install and different languages and it still works.
Have a look yourself. Details sent to you by contact form.

ayalsule’s picture

thanks ... @ctrnz
I will test :)

ayalsule’s picture

please check this issue :
if you didn`t translated the gallery ,the images will not displayed.
many thanks

ctrnz’s picture

Solution is very easy.
Last line in Node: PHP filter replace with this one:

if (empty($gid)) {return $nid;} else {return $gid;}
ImanDalain’s picture

Thanks Thanks Thanks @ctrnz
it is work :)

James Andres’s picture

#28 worked well for me too. A few notes on specific issues I encountered:

  • The new views Page display you add must have a path, I used this gallery_image_translation/%
  • When adding the Node: PHP filter, ensure you add it as an Override or you might/will break the other views
  • The exact php code I entered was (without the open and close PHP tags)
    // See: http://drupal.org/node/656192#comment-4666252
    // See: http://drupal.org/node/656192#comment-4900028
    $view = views_get_current_view();
    $args = $view->args;
    $nid = $args[0]; 
    $tpath='node/'.$nid;
    $allnids=translation_path_get_translations($tpath);
    $gid=str_replace('node/','',$allnids['en']);
    if (empty($gid)) {return $nid;} else {return $gid;}
    
zengenuity’s picture

Status: Postponed » Closed (won't fix)

At this point, I won't be adding new features to the D6 version. If features are wanted for D7, please post a new issue.