Download & Extend

Patch to limit 'translate interface' languages to languages assigned to user

Project:Translation Access
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

This patch modifies the translate interface form so that only the languages the user has edit control over show up.

However this patch does not (yet) control access to the 'translate interface' page. If you have 'translate interface' permission, you can see the page. I just wanted to get some feedback before proceeding

- should the user need 'translate interface' permission, or should asigning a language to them be enough to enable them to access the page?
- or what about adding a 'translate interface in own language' permission to the module?

AttachmentSize
i18ninterface.patch2.35 KB

Comments

#1

Not a bad idea.

On question 1:
I would say the user role indeed needs 'translate interface' access.

On question 2:
I don't see a reason to add this.

Could you clean up the patch a bit? It has some +- which are cluttering the patch.

#2

Version:6.x-1.0-alpha1» 6.x-1.x-dev

Ok - cleaned up patch and patched it against latest dev.

#3

@nirbhasa
The patch is not attached.

#4

oops...patch attached now

AttachmentSize
i18ninterface_v2.patch 1.61 KB

#5

Status:active» needs review

Committed to the dev #386280. Needs more review until some people have reported it to be ok.

#6

I further enhanced the patch since there were a couple of issues. Also the performance improved since it doesn't need to do redundant sql queries to get the translations (again). I'm testing it in production currently.

#7

What should with do with import/export/refresh? Implement a hook_menu_alter and introduce a new permission?

<?php
 
// Change the callbacks to check whether user has access to import/export/refresh
 
$callbacks['admin/build/translate/import']['access callback'] = 'i18n_access_translate_interface';
 
$callbacks['admin/build/translate/refresh']['access callback'] = 'i18n_access_translate_interface';
 
$callbacks['admin/build/translate/export']['access callback'] = 'i18n_access_translate_interface';
?>

where i18n_access_translate_interface() will return true or false;

Any thoughts?

#8

To be consistent with what we did for search, you could just use hook_form_alter to limit the select in 'import' and 'export' and the checkboxes in 'refresh' to a single language. That way you wouldnt need to introduce any permissions.

#9

(deleted - i accidentally submitted same comment many times)

#10

(deleted - i accidentally submitted same comment many times)

#11

(deleted - i accidentally submitted same comment many times)

#12

To be consistent with what we did for search, you could just use hook_form_alter to limit the select in 'import' and 'export' and the checkboxes in 'refresh' to a single language. That way you wouldnt need to introduce any permissions.

#13

Status:needs review» needs work

I issued a beta1 release but I'll leave this feature request open since it's not finished yet. For the time being, I personally use a hook_menu_alter to hide the export/import/refresh pages. The ultimate solution is proposed in #12. Patches are welcome.

nobody click here