Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
How to have ONLY the language switcher block (no link or icon in the nodes) ?
Comment | File | Size | Author |
---|---|---|---|
#34 | i18n_node_links.patch | 2.45 KB | stella |
#32 | i18n_node_links.patch | 1.98 KB | catch |
#18 | fabio_helper.tar_.gz | 684 bytes | fax8 |
Comments
Comment #1
Frank Steiner CreditAttribution: Frank Steiner commentedWould be interested in that too. There's no sense in having both, a global and a per-node language switcher. Sounds like this is just a bug with the needed option still missing in the 6.x branch...?
Comment #2
Jose Reyero CreditAttribution: Jose Reyero commentedComment #3
drewish CreditAttribution: drewish commentedBasically you can add this to your custom module and it'll do the trick. Make sure to replace CUSTOMMODULE with your module's name.
Comment #4
Frank Steiner CreditAttribution: Frank Steiner commentedI hope that someone will that make that a configurable option in the i18n module before I've learned how to write a custom module, because that could take a little longer :-D
Comment #5
phicarre CreditAttribution: phicarre commentedI agree completely !!!
I can take the proposition as a temporary solution but it is preferable to have an option into the module.
If we (the users) must change the code ourself then I don't see the advantage of an CMS tool ...
It 's my opinion of course ;-)
Comment #6
x-tin CreditAttribution: x-tin commentedMuch nicer, just put this in your css file:
So you don't have to mess with the module itself!
Comment #7
Frank Steiner CreditAttribution: Frank Steiner commentedThat works fine! Thanks!
Comment #8
phicarre CreditAttribution: phicarre commentedExplain please !
The css file of the current theme ? if yes, I am using the DECO theme (style.css) and that doesn't work !
Comment #9
Frank Steiner CreditAttribution: Frank Steiner commentedI'm using the default Garland style and had to put it into files/garland-dd4bce3e/style.css because after I had configured the scheme in the drupal config menu, it created this subdirectory in files/ which would overrdige the style.css in /usr/share/drupal/themes/
Comment #10
fletchgqc CreditAttribution: fletchgqc commentedThanks Drewish,
Spent a while trying to figure out where they get added and how to override it... but your solution will work. Nonetheless I agree with the others, it would be great if some nice person created a configuration option for this.
If a config option is created, there should be an option for teaser view or page view. In my case I want the link flags on page view but not on teaser view.
It's conceivable that a user might want to switch the language of their page, but it's a bit ridiculous to look at teasers in English and then want to read the full article in German!
Comment #11
userid CreditAttribution: userid commentedcss trick works, thanks
Comment #12
phicarre CreditAttribution: phicarre commentedNot for me with Deco theme !
Comment #13
nilsja CreditAttribution: nilsja commentedi would like to not display the translation-link only in the teaser. In the complete view of the node the link should appear. is that also possible with css?
Comment #14
fletchgqc CreditAttribution: fletchgqc commentedThis might help. Otherwise I'm not sure. http://drupal.org/node/170065
Comment #15
ar-jan CreditAttribution: ar-jan commentedthe css display:none works for me too, but two elements remain, like >> and | items that previously separated the translation links.
They're called something like translation_links_en and translation_links_es.
How can I remove those wit CSS?
Comment #16
Siryugo CreditAttribution: Siryugo commentedWorks nice for me to:
Added "a.translation-link{display:none;}" in content section of style.css.
No elements remain.
I'm using admire_gray theme
Comment #17
keuvain33 CreditAttribution: keuvain33 commentedIf you doesn't want >>
Change just #main by your id
CSS
#main .node .links{
display:none;
}
Comment #18
fax8 CreditAttribution: fax8 commentedPlease note that css will only disable displaying. The links html will still be there and you might don't want it.
For example search engines or special css browsers ( browsers for blind persons ) will still show the links and follow them.
If you are concerned about SEO you might think that having two urls on your website which points to the same content (eg: it/node/25 and en/node/25 ) is not a good thing.
This is why I implemented the drewish solution above in a simple module which you find attached.
Hope this helps.
Fabio Varesano
Comment #19
Frank Steiner CreditAttribution: Frank Steiner commentedWhy don't you submit this as a configure option to the i18n module? That would be great :-)
Comment #20
fletchgqc CreditAttribution: fletchgqc commentedI think the cleanest solution would be to tackle this in core since that's where the links come from. Figure out where in core the links are being added and then enable a configuration variable that causes them to not be added, if set. It would have to be a 7.x feature request. Once we know it's in 7.x, we can settle for using custom modules to strip them out in the meantime.
Whether anyone has the time & motivation to go ahead and do this of course... is another issue.
Comment #21
Pepe Roni CreditAttribution: Pepe Roni commentedThe language switcher block should switch the interface language and with that, it should switch the content language, too. The language switcher at the bottom of the content should be used to switch the language of the current content only, and nothing else (but indeed it also changes the interface language). I think, that's what this thread is about.
So in short the links should read similar to this:
Language switcher block: mydomain/desired-lang/node/desired-lang-nid
Language switcher at node bottom: mydomain/current-lang/node/desired-lang-nid
where mydomain/lang could also be mylangdomain, depending on language configuration.
Comment #22
Manuel Garcia CreditAttribution: Manuel Garcia commentedUntil someone submits a patch to put this in core, the module approach is definitely the way to go, for a variety of reasons listed above this comment.
Thanks for the code !
-- @Themers -> it takes two seconds to implement this, and being able to do a module is surely a very powerful skill to be have - don't be scared of messing with it!
Comment #23
Tobbetobbe CreditAttribution: Tobbetobbe commentedThanks alot Fabio. I added your module and it works fine!
Comment #24
Frank Steiner CreditAttribution: Frank Steiner commented@#21: This wouldn't make any sense. You should not show a german page with a mydomain/en/blabla path. The lang prefix in a path must match the language of the current content for thinks like pathauto to work. And changing the content of the page without changing the interface language cannot work with user defined menus and localization etc.
Comment #25
Pepe Roni CreditAttribution: Pepe Roni commentedI don't understand your problem. For switching the interface language, the language switching is for. If I only want to see the translation of the node, I don't see any need to switch the interface language. I can manually enter the node ID in the URL and everything works well: The interface elements are displayed in the language determined by the path and the content elements (including menus) are displayed in the content's language.
What I can enter manually, I would expect the node's language links to do automatically.
Comment #26
Frank Steiner CreditAttribution: Frank Steiner commentedHmm, maybe I misunderstand some terms here. What do you consider the "interface" language? If I switch afrom english to german, I expect to change everything, i.e., the currently shown content, the (used defined) menue which has the menu entry for this content, stuff like the button texts ('search' -> 'Suche') that I use in html forms in the content. Even the primary links menu must localize if I linked the current content from the primary links.
What do you think should stay in english in this case? The administration pages for example?
I guess it was done like this in 5.x, but I'm not sure if this distinction wasn't dropped in 6.x. I think I read sth. like that in a thread, but I'm not sure...
Comment #27
Pepe Roni CreditAttribution: Pepe Roni commentedThe interface language is determined by the language prefix in the URL or by the domain. The node will be displayed in it's defined language. Thus you can display an English node while the interface language is set to German.
Comment #28
bchoc CreditAttribution: bchoc commentedPresuming the themer knows what languages the site will be using, couldn't the themer just add
if ($links[node_translation_en]) unset ($links[node_translation_en]);
for each language needed (this one is for English, obviously) to the top of an overridden theme_links() function?
This seems less work than creating a module to do about the same thing, but maybe I'm way off.
Comment #29
moritzz CreditAttribution: moritzz commentedYou can easily add the following code to your template.php to filter out all translation links from nodes:
This may not be the best practice because it senses for the class "translation-link" but it works fine for now.
Would be great to have an option in locale to hide these links.
Comment #30
eyalro CreditAttribution: eyalro commentedThanks Fabio! It seems to works.
I am new to this, so it took me a while to understand I need to delete the "_" from the downloaded file....Anyway I installed to my site/all/modules directory and it looks good.
Comment #31
catchI'll post a patch for the initial feature request later today.
Comment #32
catchHere's the patch. We add a new field on the i18n settings page, and hide the links if the variable is set.
Comment #33
stella CreditAttribution: stella commentedPatch looks good and works great!
Cheers,
Stella
Comment #34
stella CreditAttribution: stella commentedSlightly modified patch - it just adds in a call to
variable_del()
in hook_uninstall() on the new variable.Comment #35
catchThanks for review and the variable_del() addition, missed that one.
Comment #36
stella CreditAttribution: stella commentedComment #37
Jose Reyero CreditAttribution: Jose Reyero commentedCommitted the patch in #349193: additional language support level that also includes this feature
Comment #38
bbence CreditAttribution: bbence commentedDoesn't really work for me. I can still see the languange links under the node regardless of the Content Type settings. Any ideas why?
Thanks!
Bence
Comment #39
tina1 CreditAttribution: tina1 commentedComment #40
tommygun86 CreditAttribution: tommygun86 commentedu have an check box (Hide content translation links) in admin/settings/language/i18n for drupal 6 and it hide the language links
Comment #41
Manuel Garcia CreditAttribution: Manuel Garcia commentedReverting title... was assigned to catch also :Z
Comment #42
AnybodyBased on the idea from #29 here's the Drupal 7 Version:
You can find my blog article about it here: http://julian.pustkuchen.com/node/601
Comment #43
kingandy CreditAttribution: kingandy commentedAlternate ending: