The locale module doesn't currently provide a way to set nodes' languages in bulk, using the "Update options" form at admin/content/node. Users who want to changes nodes' languages have to do it one node at a time, which is infeasible for large sites.
The attached screenshot illustrates the desired functionality, and the attached patch provides it.
Note: It's my understanding that API changes are no longer being accepted for Drupal 6.x. I tried to provide this functionality as a contributed module, but was told that the module was too simple. The functionality really does belong in core, IMO. However, if updates to 6.x core simply aren't going to be entertained at this point, I'd appreciate it if someone would tag this issue "won't fix", so that I can go back to the CVS administrators and try again.
Thanks,
Andrew.
Comment | File | Size | Author |
---|---|---|---|
language_bulk_update.patch | 1.39 KB | Andrew Schulman | |
language_bulk_update.png | 47.17 KB | Andrew Schulman |
Comments
Comment #1
Andrew Schulman CreditAttribution: Andrew Schulman commentedComment #2
mokko CreditAttribution: mokko commentedFor me on a Drupal 6.14 the patch works. It would be nice to have this in a module, instead of patch.
Comment #3
Andrew Schulman CreditAttribution: Andrew Schulman commentedGood. Yes, it's been explained to me that D6 core is frozen, so I'm going to be providing this feature in a module soon. I'm also going to submit it as a patch for Views Bulk Operations.
Comment #4
Andrew Schulman CreditAttribution: Andrew Schulman commentedVBO can already do this, so I won't be submitting a patch for that.
The Language assignment module now provides this functionality for Drupal 6, and as soon as I can get to it, for Drupal 7 as well.
For Drupal 8, this option should be added to the core Locale module. Retagging for 8.x-dev.
Comment #5
Gábor HojtsyMarked #430788: feature request - add some internationalization features to the core bulk edit pages as duplicate.
Comment #7
Andrew Schulman CreditAttribution: Andrew Schulman commentedI'll update this for 8.x and resubmit.
Comment #8
Andrew Schulman CreditAttribution: Andrew Schulman commentedThe "Set language" operations come in four kinds:
Can someone please recommend how I should propose these? As One Big Patch, or one patch for nodes and one for users, or 4 separate patches, etc.? Are some of the above more likely to be of interest than the rest in core?
Thanks,
Andrew.
Comment #9
plachWould the user "Set language" operation change the user language preference? If so I ain't sure this is consistent with the node equivalent operation: they would present exactly the same but they would have different meanings.
However, personally I never had the need to change language preferences en masse, while I had the need to change multiple node languages many times (I have a small custom module for this in my installations :). How would we solve the need to specify the language? In my custom module I have an additional select to choose it, but I ain't sure this is actually what we want in core.
Perhaps we should hear a UX folk on these.
Anyway, maybe we can split this issue in operations and actions patches. Not sure if there is some kind of good practice guidance on this.
Comment #10
Andrew Schulman CreditAttribution: Andrew Schulman commentedYes, that's what the Language Assignment module currently does for users. It's true that the meanings are different, but there's no conflict since they're always presented in different places. But you're right that it might be better to label the user operation "Set language preference".
OK. This suggests that it might be better to split the patch into a node piece and a user piece, since the nodes might be of greater interest. I think the code breaks down a little more naturally that way.
Language Assignment provides a separate "Set language to" operation for each installed language. But it alters the bulk update forms so that they're presented a little more nicely as suboptions of a single "Set language" operation. See the screenshot.
Comment #11
Andrew Schulman CreditAttribution: Andrew Schulman commentedComment #12
Gábor HojtsyI think we should focus on nodes for now. There are some interesting problems there to solve. For example, if you set a node to German and it already is a member of a translation set that has a German node, then that needs to be solved. Also, if you set it to German and it has translated fields in German, how does that work? It will have two different German versions then? These are some very interesting things to consider here.
Comment #13
Gábor HojtsyMarking #809850: Locale module, node operations patch as duplicate.
Comment #14
mo6In the mean while: there's a module for D6/D7: http://drupal.org/project/languageassign
Comment #15
Andrew Schulman CreditAttribution: Andrew Schulman commentedYes, that's the module I wrote to provide the "Set language" operations and actions. My hope is to get those integrated into D8, so that there won't be any more need for Language Assignment.
Currently in D7, Language Assignment does the following to change the language of a node:
I borrowed this from locale_field_node_form_submit() in locale.module, which has:
The above code seems to work, but see #1086454: DATA-LOSS: Changing the Language of a node via language assignment deletes the content on the edit page.
I need to think through Gábor's questions in #12.
Comment #20
sunJust ran into this problem after importing lots of content in the wrong language. Coming from a WordPress background, it is weird that it is not possible in Drupal to bulk edit built-in content fields and properties by default.
The simple answer to @Gábor Hojtsy's question in #12 is that the user should get an error message after the bulk operation (without aborting it): The language could not be assigned, because the content has that language assigned already. Everything else would mean a potential data loss. The user will happily deal with it.
Comment #24
jukka792 CreditAttribution: jukka792 as a volunteer commentedRan to same problem, no way to change content language as bulk. Imported 400 000 nodes with wrong language :).