A couple of places in core, a global $language_url is used:
http://api.drupal.org/api/function/l/7
http://api.drupal.org/api/function/theme_links/7
http://api.drupal.org/api/function/locale_language_url_rewrite_url/7
However, I can see nowhere in core where the *global* $language_url is ever given a value, unless it is done somehow that I can't find by grepping for the string language_url (i.e. without quotes or $) in the entire code base. That string only comes up a few other times: in function names, and also as a *local* variable in
http://api.drupal.org/api/function/locale_language_from_url/7
I am not exactly sure what these three functions are trying to do with $language_url, or which global they should be using (perhaps $language?)... Or else I'm missing something, which is entirely possible, and $language_url is being set somewhere?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | globals-724504-9.patch | 1.58 KB | plach |
| #3 | globals-724504-3.patch | 988 bytes | plach |
Comments
Comment #1
plach$language_urlis being initialized in http://api.drupal.org/api/function/drupal_language_initialize/7.See #282191-59: TF #1: Allow different interface language for the same path for details.
Comment #2
jhodgdonAh, thanks! These $language_* globals need to be documented in the globals.php file.
This will make them appear on http://api.drupal.org/api/globals/7
Comment #3
plachAttached you can find a patch for the current globals.php that adds the missing documentation. It already incorporates the changes that will get in with #282191: TF #1: Allow different interface language for the same path.
Comment #5
plachComment #6
jhodgdonA note: The globals.php file is in the contributions repository, so don't worry about the fact that the patch doesn't apply.
However, it needs work. For one thing, every doc header needs to start with a one-line description of the variable, less than 80 characters, ending with a period and followed by a blank line, rather than having a clump of several lines together at the top. See http://drupal.org/node/1354 for more information.
Secondly, the description of $language_url() is not complete. It is used in more functions than just url() [see original issue report above].
Third, I think there are other globals besides these two that are initialized in drupal_language_initialize(), aren't there? Maybe not...
Comment #7
plachI should know that, just forgot it :)
Actually there are three places it's used in: l(), theme_links() and locale_language_url_rewrite_url(). I wouldn't list them all, I'd just say "url-related functions", as it's used the same way by all of them.
No, just those three (in core). I.e. only the ones returned by http://api.drupal.org/api/function/language_types/7.
Comment #8
jhodgdonOK, sounds good.
The patch still needs reformatting... I think it would also be useful to explain what "interface language", "url language", and "content language" are, and put in a link to drupal_language_initialize() (the function that sets them up).
Comment #9
plachRevised patch.
Comment #11
jhodgdonLooks excellent. I have applied it to the actual globals.php file in the contrib repository. Thanks!