When working on multilingual sites with permissions and roles. There is an issue where core translates the two build in role names, making it hard using "user_roles()" to match in code role names as the role names are translated depend on the language of the last person to export the roles.
This is especially an issue in modules like http://drupal.org/project/secure_permissions.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | translate_role_names-2205581-1.patch | 747 bytes | cableman0408 |
Comments
Comment #1
cableman0408 commentedThe attached patch removes the translation.
Comment #2
cableman0408 commentedComment #3
David_Rothstein commentedIf they aren't translated there, where would they be translated though?
Why is it necessary to match on role names, rather than matching role ID to DRUPAL_ANONYMOUS_RID and DRUPAL_AUTHENTICATED_RID?
Comment #4
cableman0408 commentedIt's strange that only core roles are translatable and as mentioned it gives issues in different contribute modules (e.g. secure permission, features etc.)
Comment #5
David_Rothstein commentedRight, I can see why modules that export role names have a different need here. For Features that issue is a more general one though (not just limited to user roles) and from what I can see is handled by http://cgit.drupalcode.org/features/tree/features.module?h=7.x-2.7#n1225
For secure_permissions it may be limited to user roles; I am not as familiar with that module but it looks to me like they already deal with it also.
If there's a need to get the untranslated role names for export purposes, one thing we could do is change the core user_roles() function to call a new function as a helper method - the new function could return untranslated role names and then user_roles() could continue to return the translated ones.
Regarding "only core roles are translatable", that's a different issue - see #598862: Custom user roles are not translatable in core alone (requires a contributed module)