Automated node translation on cron?
EvanDonovan - July 24, 2009 - 20:43
| Project: | Node Translation |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I wrote a little module that does automatic node translation on cron. It only supports Spanish at the present time, and it needs work to make it populate all the correct fields and to be generalizable to things besides book nodes. I was wondering, though, if you thought that this was within the scope of this project or whether it would be better to create it as a separate project on Drupal.org.
If you are interested in adding this kind of functionality to this project, I will post my module file as an attachment on this issue. Otherwise, feel free to close this issue, and I will consider whether I will create it as my own project.

#1
Evan would be interested in looking definitely.
Sorry for not being responsive sooner but i am under a deadline so unfortunately until next week wont be able to go through the other tickets but will once the deadline is finished.
#2
Ah, deadlines. I've been under pressure to get automated node translation working myself. Thanks so much for your modules - I don't know how I would have done it without them. Anyway, I've managed to come up with workarounds for my other issues, at least for now.
Attached is the code for the module that I wrote. I've tested it to work on my site, but no guarantees that it will work anywhere else.
I just got it so it copies the taxonomy terms, so I think now it behaves more or less the same way that clicking the Translate tab does.
If you can review it when you have some free time, that would be great. Thanks.
#3
By the way, I just realized when I pushed this code over from the test site to the production site that it makes one non-obvious assumption.
It assumes that you have an input format #5 which has no filters on it. You should either create an input format #5 with no filters, or else modify the code to reference a different input format which has no filters. If filters are applied, you will most likely have a PHP memory overrun.
#4
I made a few revisions to my module's code based on running it a few times on my live site. Now it should skip trying to create translations of nodes that have been deleted. Also, execution of the cron hook will terminate if the translation framework function is not available.
#5
More revisions...I was asked by my boss to include nodes of content type 'page' in the translation so that happens now. I also believe I have fixed the watchdog messages which were not getting variables substituted correctly.
#6
Looks like the code at least in #5 has an issue. Sometimes it gets stuck and keeps translating the same 10 things over and over. I am going to refactor it a bit to use a database table to log which nodes have been translated, so that it won't repeat.
#7
Ok, here's an updated version (as a tar.gz). Now it uses a database table to track which nodes have been translated. Please review when you get a chance.
#8
Actually, don't bother to review this after all. I've discovered more bugs with it, and limitations that I really need to address before this could be worthwhile to others.
If I get them worked out, I will consider posting it as its own project on Drupal.org, with a dependency on your projects. However, I may not do that if it would be considered a violation of Google's ToS. (Maybe there's another automated translation service with less restrictive ToS that it could depend on though.)
I would've closed the issue, but then you wouldn't seen it. Feel free to close at your discretion.
#9