Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Motivation
A few messages retrieved with variable_get()
are not wrapped in t() and thus do not show up in the translation interface.
For instance:
variable_get('google_appliance_errorcode_1', 'No results were found that matched your criteria.');
cannot be translated unless we wrap it with t():
t(variable_get('google_appliance_errorcode_1', 'No results were found that matched your criteria.'));
As a consequence we cannot translate them.
Proposed resolution
Wrapping such strings in t() would fix the problem. Attached is a suggested patch, any review is welcome.
Comment | File | Size | Author |
---|---|---|---|
#1 | google_appliance-make_messages_translatable-2005290-1.patch | 3.5 KB | fengtan |
Comments
Comment #1
fengtanComment #2
iamEAP CreditAttribution: iamEAP commentedYou should never pass dynamic values through the t() function.
Here's a slightly old blog post about how to properly translate variables: http://hojtsy.hu/blog/2011-feb-25/drupal-7039s-new-multilingual-systems-...