I have a site with quite a lot of content (over a thousand nodes) where most of the content is translated. Some (untranslated) content has been there for some time and now, when we use the "select node" (under Translation) we get 24 pages of content where the translation might be. This makes it very hard to use the translation system.

I know it's possible to use the "create translation" system, but it's not convenient content that is already in ... and sometimes (especially when using category.module) using this interface makes the node appear under the wrong menu (as the translation is created in the original language).

It would be very nice, useful and appreciated to have a third way of associating translations : an interface where it's possible to just type in the translation node id.

Another solution to this would be filters on what is displayed on the "select node" page : for one thing, making it possible to hide nodes already associated with a translation set would be nice. Adding the possibility to "order" the displayed nodes (by title, date, etc.) could be nice, but I don't think it would solve my problem.

I would be interested in working on this, though I would like to get some pointers and some feedback regarding feasibility .. and how welcomed this feature would be.

Mathieu

Comments

davemybes’s picture

Hi mathieu

+1 for this idea. The ability to enter in a node id would be great. I had the same problem on a site with three languages - two in chinese, making it really hard for me to figure out what node is what.

Filtering the pages would be a nice addition too, but definitely the node id bit would be the most useful initially. I might take a look at the code myself when I have a bit more time to do it.

jose reyero’s picture

+1 for the idea

You can add a texbox for the nid, or an ajax textfield with autocomplete for node title or both, it would be cool.

davemybes’s picture

StatusFileSize
new2.66 KB

I've had a go at trying to implement this feature using a textfield where you can enter either the exact node id, or the first few letters of the title and have it autolookup the full title name (it does not lookup the node id). It then returns the nid, which is submitted and assigned as the translation. It appears to be working well on my system, but let me know if you find any problems. The patch is against the April 4th release of 5.x-2.0.

mathieu’s picture

Wow! Today was day semi-off for me, I never expected to see this progress so fast. Incrn8, if we meet this Sunday at the next mtl meetup (which I think will be more "coder-oriented"), we can test/improve this together. In any way, I'll test out this out as soon as I can!

davemybes’s picture

mathieu, sounds like a plan to me. So far I'm on track to be at the Sunday meeting. I'll check the Group for more details.

mathieu’s picture

Status: Active » Needs review

This works great .. and it's fast! Any chance it could go in the next version? :)

davemybes’s picture

StatusFileSize
new2.74 KB

Here is an updated patch for the April 4, 2007, 5.x-2.0 version. I have also refined the text and the lookup a little bit. Let me know if there are any problems.

mathieu’s picture

Status: Needs review » Reviewed & tested by the community

Applies cleanly, works well... and I would really love to have that in the next version. :)

jose reyero’s picture

Status: Reviewed & tested by the community » Needs work

I've tried it and it works, I like it.

But the permissions for the autocomplete callback are not right. I think we should use a general 'translate nodes' permission for the hook plus some db_rewrite on the query so the user dont see nodes he's not suppossed to see.

And this query...

db_query("SELECT n.nid, n.title FROM {node} n INNER JOIN {i18n_node} i ON n.nid = i.nid WHERE (LOWER(n.title) LIKE LOWER('%s%%') OR n.nid = %d) AND i.language != '%s'", $string, $string, $node->nid);

The $node->nid seems a bug, but also: Can't we pass language as a different parameter? And check the parameters to see whether it is a string or a number before we throw these loose queries? (I guess it wont be too hard to make this query break with some inputs...)

davemybes’s picture

Thanks for the comments, Jose, I'll work on implementing them in the next couple of days. I also didn't really like the way I was passing the language parameter, but I couldn't get it to work any other way. I'll take another look at that and see what I can come up with.

davemybes’s picture

Title: Translation "select node" page is overcrowed - Need an input field to type in translation node id » Translation "select node" page is overcrowded - Need an input field to type in translation node id
Status: Needs work » Needs review
StatusFileSize
new2.91 KB

Alright, here is an improved patch that hopefully addresses all of Jose's concerns. Let me know if its good enough :)

mathieu’s picture

I just tried the patch on a site with i18n-5.x-2.1 and it works well.

jose reyero’s picture

Status: Needs review » Fixed

Yes, this is much better :-)

I've applied this with just a few changes

Nice job, thanks

davemybes’s picture

Thanks for putting that in, Jose. Much appreciated.

Anonymous’s picture

Status: Fixed » Closed (fixed)