I'm seeing a very odd behavior for translated/substitued text. The function node_get_types()
http://api.drupal.org/api/HEAD/function/node_get_types
simply calls the function _node_names()
http://api.drupal.org/api/HEAD/function/_node_names
Within this function, hook_node_info is called for every module, and these should each return a t-ified node name. What wrong is that when function node_add() makes this call to generate the "Add content" page at /node/add, the node names are translated. However, if I paste the code below into a page and execute as PHP, the untranslated node names are returned. I'm perplexed by this, but can only guess it relates to the declaration of static arrays in _node_names()?
foreach (node_get_types() as $type => $name) {
print ("$type - $name <br/>")
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | no_static_names.patch | 421 bytes | pwolanin |
Comments
Comment #1
pwolanin commentedI can now confirm that this relates to the static varible declarations. The attached patch (for demonstration purposes only- probably causes a real performance hit) removes the static declarations. After this, the t-ified names are returned as expected by the code above. I'm still very perplexed by this however.
Comment #2
pwolanin commentedFYI, this is using PHP Version 4.4.2.
Comment #3
pwolanin commentedsee: http://drupal.org/node/65801