I just updated this module to 1.0 from dev and now I got this notice:

Notice: Undefined index: href in lang_dropdown_form() (line 169 of C:\xampp\htdocs\gpmg\sites\all\modules\lang_dropdown\lang_dropdown.module).

Comments

s@ilor’s picture

Yep! Me too.

Subscribing.

it-cru’s picture

Subscribing.

johnhanley’s picture

Ditto.

it-cru’s picture

Error message is only displayed if a translation of the node doesn't exists. When the node is translated in all active languages the error message isn't displayed any more.

marcred’s picture

+Subs.

matulis’s picture

If there is no translation, href is undefined. Set it's value to frontpage, so if node has no translation, user will be redirected to front page.

johnhanley’s picture

Status: Active » Needs review
it-cru’s picture

The patch from matulis in #6 removes the errors, but I think it isn't the right way to redirect to the front-page if the translation of this node doesn't exists. It would be better to display the node in its language source or side-wide default language.

matulis’s picture

IT-Cru,
if I have website with 2 languages, for example, English & Spanish, and there is node only in English, what would happen if user try to switch to Spanish? Nothing?

it-cru’s picture

I think it would be good to switch to the source node, because this node exists.

    Example (site with 3 languages [EN, DE, ES]):
  • node1 only in EN (source) -> switch in DE & ES to EN
  • node2 in EN (source), DE -> switch in ES to EN
  • node3 in DE (source), EN -> switch in ES to DE (because here DE is the translation source)
  • node4 in EN (source), DE, ES -> switch to selected translation
alexpls’s picture

Subscribing.

daniel wentsch’s picture

Subscribing

demoshane’s picture

I get Notice: Undefined index: href in lang_dropdown_form() error aswell, and page has been translated to all languages

nagiek’s picture

Any word from maintainers? The module isn't really usable now with the error message.

shabanbi’s picture

i added above patch in my code but it is not working ,

please can you give me solution front end dropdown select languages .

zoszabo’s picture

subscribe

torbjoernk’s picture

@matulis: I've got one question regarding your patch. Wouldn't it be more appropriate the user is redirected to the translation page of the node? What do one have to put instead of '' to link to 'node/#/translate' ? However, if the user is not allowed to translate a node, he would be shown an error page automatically.

dukem’s picture

StatusFileSize
new2.31 KB

Made this patch - when a user selects a language for which a translation does not exists it redirects to default or existing translation but with the selected language turned on.
For example from existing English translation of a node #9 it will redirect to /ru/node/9. The site is in Russian but node content is in English.

rtdean93’s picture

Patch in #18 worked.... however - it should have been generated from the module directory instead of your home directory....

$ patch -p1 < lang_dropdown.module_0.patch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- /home/dukem/work/icrypt/drupal/lang_dropdown.module 2011-10-06 15:53:18.000000000 +0300
|+++ /home/sites/icrypt/htdocs/sites/all/modules/lang_dropdown/lang_dropdown.module 2012-01-25 19:32
:42.000000000 +0200

grozozo’s picture

I manually applied the patch of #18 on my bilingual drupal and it work like a charm.
thx dukem!

dukem’s picture

StatusFileSize
new2.29 KB

My bad. Recreated patch with git.
Also added return '<front>'; if no translation was found (should not happen normally).

Sylvebois’s picture

Hello all,

I tried the patches but I wanted to add one thing : a warning message for the visitor. So, he will know what happen.

For that purpose, I reused the patch in #6, modified it and added some code. It's less elaborate than patch in #21 but it seems to work ...

I just hope I have created the patch the right way ...

dukem’s picture

I think that the patch at #22 is simpler and better.
Maybe make error message display configurable (show or not)?

webmaster-eddie’s picture

I have the same problem.
I applied the patch successfully. Thank you. Will I have to re-apply the patch every time the module is updated through drush up?

Is there some kind of super simple command line command that automatically applies the changes in the patch to the correct file? If so, would someone please tell me how to do this?

Thanks,

Eddie

manfer’s picture

Wouldn't it be just better to don't show in the switcher any language for which there is no translation available in current node?

manfer’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.