Closed (works as designed)
Project:
Translation template extractor
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2008 at 19:10 UTC
Updated:
25 Sep 2008 at 08:17 UTC
I've found some translation issues in content_permission module.
In the following cases i need placeholder, but I'm not sure if this is supported here. As an example - in German it must be translated to "@field_name bearbeiten" and "@field_name ansehen". As you can see we must move translated string of the hardcoded "edit " and "view " string to the end in German.
function content_permissions_perm() {
foreach (content_fields() as $field) {
$perms[] = 'edit '. $field['field_name'];
$perms[] = 'view '. $field['field_name'];
}
return $perms;
}
...
function content_permissions_content_views_access($field_name) {
return user_access('view '. $field_name);
}
Aside POTX generator struggles on this syntax, too.
Comments
Comment #1
karens commentedThe way it is done now is consistent with the way core handles node type permissions in the node.module, which I assume is the right example to follow.
I'm not quite sure what else to do with this.
Comment #2
hass commentedCould be an issue of POTX. So moving for now... i generated the POT files for node module myself and it does not contain this broken strings. Maybe Gabor could bring some light on this much quicklier.
modules-content_permissions.pot
modules-node.pot does not contain the node module permission strings... and i wasn't able to find them in general.pot or somewhere else.
Comment #3
gábor hojtsyThere is no way to have placeholders in permissions in Drupal 5 or 6. Feel free to code patches for Drupal 7! Therefore Drupal 5 and 6 potx can only extract literal permission names, not composite permission names. Since composite permission names do not have these placeholders, they are site dependent and cannot be generally translated. That's how it is. Feel free to provide a patch for a better way in Drupal 7!
Comment #4
hass commentedWell i thought this... but where are the composite permission names from node module gone?
In CCK the composite permission names are included in the POT files but the core node modules strings are not in any file!? Do you have any filter build in POTX that filters out composite permission names of core modules? In node.module i see
$perms[] = 'create '. $name .' content';, but if i search all POT files for"create "or" content"i cannot find anything, but i should...Comment #5
hass commentedI found it... node.module permissions are blacklisted in POTX. Should we write POTX patches for every contrib module? What is the plan about this for non-core modules?
Comment #6
hass commentedComment #7
gábor hojtsyThe plan is that some bright folk will submit patches for the next Drupal version to support composite permissions. Until then, we don't support that. The potx code which discovers permission names could be a bit more intelligent not to pick up 'create ' when it is part of a composite operation.
Comment #8
hass commentedYep, hopefully we are able to find a workaround to filter/remove the composite permissions for 6.x POT files in a POTX 6.x-2.1 or a -dev soon...
I'm not deep enough in potx code to solve this quickly... For now I haven't touched the composite permissions strings in the German translation files of CCK... hopefully others won't try to translate them... but i'm sure this will happen soon in other translations...
Comment #9
gábor hojtsySubmitted this issue against Drupal 7, so that we can get real translatable composite permissions in Drupal 7: http://drupal.org/node/313213 Please provide your feedback, support and review there. I've tried to make it as painless and simple as possible for non-composite permissions.
http://drupal.org/node/306402 exists to implement the new hook_perm() parsing in potx for Drupal 7, but until it looks like finalized, I am not beginning on doing that.
Marking this by design, since the issue is outside potx. Let's solve it in Drupal core!