This patch fixes an awkward string concatenation which prevents correct translations in the permission filter dropdown on the user listing page. We can’t just expect all language to have the same word order as in English. Also, some languages might want to use additional punctuation (e.g. in German, it’s “System-Modul”, not “system Modul”).

CommentFileSizeAuthor
user-filter-dropdown.patch817 byteskkaefer

Comments

gábor hojtsy’s picture

Because the form output will escape the value anyway, I would not use @, but simply !.

kkaefer’s picture

No, @module is better because we already have the exact same string for the exact same use case (headers on the permissions page).

Freso’s picture

Patch applies cleanly and site (D6, fresh from CVS) runs the same as without patch. The patch, however, doesn't change one string to another:

gentoo-vm drupal6 # php potx-cli.php --files modules/user/user.module
Processing modules/user/user.module...
Invalid marker content in modules/user/user.module:1759
* t($permission)

Done.
gentoo-vm drupal6 # mv general.pot general.old.pot
gentoo-vm drupal6 # patch -p0 < user-filter-dropdown.patch
patching file modules/user/user.module
gentoo-vm drupal6 # php potx-cli.php --files modules/user/user.module
Processing modules/user/user.module...
Invalid marker content in modules/user/user.module:1758
* t($permission)

Done.
gentoo-vm drupal6 # mv general.pot general.new.pot
gentoo-vm drupal6 # diff -uI"^#" general.old.pot general.new.pot
--- general.old.pot 2007-09-13 00:25:07.000000000 +0200
+++ general.new.pot 2007-09-13 00:25:39.000000000 +0200
@@ -425,11 +425,11 @@
msgid "role"
msgstr ""

-#: modules/user/user.module:1754
-msgid "module"
+#: modules/user/user.module:1758
+msgid "@module module"
msgstr ""

-#: modules/user/user.module:1765
+#: modules/user/user.module:1764
msgid "permission"
msgstr ""

gentoo-vm drupal6 #

Unless Gábor wants to keep up his critique, I'd say this is RTBC.

Freso’s picture

The patch, however, doesn't change one string to another:

I, of course, meant that the patch does change one string (module) to another (@module module). (I really should go to bed. It's bloody half past one in the morn! Oh well. Time flies by when you're having fun, I guess.)

gábor hojtsy’s picture

I think if we ever have a module name, which has special HTML chars (I am not sure Drupal recognizes these as modules), we would end up with the module name double escaped due to the use of @ here. As I understand it, @ escapes it and then the select dropdown generation process also escapes it, right? It would be nice to check:

- whether the select dropdown generation actually escapes
- what chars are allowed in module names

Freso’s picture

I tried adding a $module = '<>"\''; before the t()-call with the array('@module' => $module), to test the escaping.
The result on the page (admin/user/user - are there other places to test this?) was as such: <optgroup label="&lt;&gt;&quot;'-MODUL"> (-MODUL is a test translation into Danish)
As you can see, the special characters are escaped only once.

I don't know about which characters are allowed in module names.

gábor hojtsy’s picture

Status: Needs review » Fixed

Great, thanks. Committed then.

kkaefer’s picture

Note: The module name here is *not* the module name from the .info file but the module identifier.

Anonymous’s picture

Status: Fixed » Closed (fixed)