Closed (fixed)
Project:
Custom Breadcrumbs
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2007 at 07:22 UTC
Updated:
25 Nov 2012 at 18:53 UTC
Jump to comment: Most recent file
Comments
Comment #1
bobject commentedMultilanguage would indeed be nice. I'm looking at a breadcrumbtrail that looks like this:
Home › englishMainCategory › englishSubCategory › germanMainCategory › germanSubCategory
Any suggestions?
thanx, bobject
p.s. for my case Taxonomy Breadcrumb seems to work perfectly out of the box.
Comment #2
david lesieur commentedThe attached patch provides this feature.
This language support completely behaves like path.module does for URL aliases:
Comment #3
david lesieur commentedMarked #219289: Multilingual support as a duplicate.
Comment #4
thepanz commentedMaybe in the install file must use new Drupal6 schema API for DB editing: db_add_field() may be usefull...
Regards
Comment #5
david lesieur commentedCould you be more precise and/or update the patch if needed? What field needs to be added?
Comment #6
thepanz commentedI mean: in the .install file instead using SQL to create new "install" field in {custom_breadcrumbs} table, you should use db_add_field() (my 2 cents :-) )
I don't have a multi-language D6 site to test it..
Regards
Comment #7
david lesieur commentedAh, got it! Updated the patch to properly use Schema API in the update hook.
I hope this can be committed soon. Without this patch, Custom Breadcrumbs is not usable on many multilingual sites.
Comment #8
david lesieur commentedMarked #310757: Custom Breadcrumb not translating titles as duplicate.
Comment #9
MGN commentedThe patch seems to work fine with 6.x-1.4, but I am wondering if this is the best approach for multilingual sites.
This patch requires manual configuration of all custom breadcrumbs into each desired language, and a new database entry for each language and node type. Rather than translating the breadcrumb trail into the correct language, an alternative breadcrumb is pulled from the database, according to the value of $language->language. This provides a solution, and has advantages and disadvantages.
I suppose this approach would work well if you wanted to provide different (i.e. not just translated) content and breadcrumbs for different languages. But this patch isn't really needed in that case. If you want to do this you can just duplicate content type (english page, spanish page, french page, etc.) and use a different custom breadcrumb for each language.
The primary disadvantage is the effort needed to duplicate all the custom breadcrumbs on a site for each language that you want to serve....with many content types it adds up fast. Personally, its enough for me to simply have a correct translation of the breadcrumb trail. I think this should be possible without duplication of breadcrumbs, and without the new field (language) that this patch adds to the custom_breadcrumbs table.
Also, there is one small typo that I noticed. In the languages section of the admin form
<am> should be <em>.Before thinking of committing this patch, those who are interested should discuss this approach and consider if there aren't better alternatives. Just my opinion.
Comment #10
david lesieur commentedAs I have mentioned in #2, this patch implements the same approach taken by Drupal core for multilingual URL aliases. It also satisfies many use cases—one might just use different breadcrumb titles for each language, use different titles and paths, or even have a different breadcrumb structure depending on language.
I don't think that using a different content type for each language as you suggest is a very common configuration for multilingual sites. By doing that, you wouldn't be able to use the i18n module's translation workflows (which only allows to translate a source node to nodes of the same type). Although it is easy to duplicate a content type, you'd then have to maintain separate content types for each language, and with CCK fields that could mean a lot more work than just managing separate breadcrumbs for each type and each language.
I'm also interested in hearing what others think, but so far I still stand by my solution. ;-)
In the meantime, here's an updated patch to fix the typo.
Comment #11
chapo commentedI'm exactly looking for this feature... using a 5.x drupal website with custom breadcrumb installed (5.x-1.2).
Do you think your patch will work for the 5.x-1.2 release of custom breadcrumb ? Or are there so many changes in the code between the 2 versions ?
Thanks.
Comment #12
MGN commented@chapo: the patch won't work with 5.x because it uses some 6.x specific code. The changes are small enough, though, that it wouldn't be hard to modify it and make a new 5.x patch. see http://drupal.org/node/114774 for guidance.
Comment #13
MGN commentedSo after working with this for a while now and looking at other options, I agree with David's solution - it fits the way Internationalization is currently being done.
Another small suggestion for the patch would be to set the #default value. Otherwise you are continually forced to reset it when you edit the breadcrumb.
Comment #14
david lesieur commentedRe-rolled for the latest version of the module, and made sure that #default_value is now set properly.
Comment #15
MGN commentedThanks for the update. In reading through the code I noticed that the changes to the install file don't match the Drupal 6 schema. In particular
See http://drupal.org/node/114774#schema-api for more information.
Comment #16
david lesieur commentedFixed. Thanks for the quick review and the keen eyes!
Comment #17
MGN commentedI found another problem with this after disabling locale. When I went to edit custom breadcrumbs, I got a wsod with the error "Call to undefined function: locale_language_list()"
This is happening because of the or clause in the following function...
I think its sufficient to use
return module_exists('locale'). Can you explain why the db_query is needed?Thanks.
Comment #18
david lesieur commentedWow, good catch. The rationale behind this was to avoid offering a choice of language when only a single language has been enabled and no language-specific custom breadcrumb has been created. However, once that custom breadcrumbs have been created with a specific language, that leads to the problem you have found.
The path module uses a similar logic (see path_admin_overview()), but I guess they have been careful to avoid this kind of problem. Still, I think it would be reasonable to use just module_exists() as you suggest.
Comment #19
avpadernoComment #20
david lesieur commentedMade changes to only check module_exists('locale'), avoiding the mostly useless logic that was provided by the query.
Comment #21
david lesieur commentedComment #22
twodThis patch looks like it's been made against 6.x-1.4, while the version mark on this issue states 6.x-1.x-dev.
I'm a bit confused about the branches and tags here and which version this patch was made for.
I could apply it to 1.4 (1-8 rows offset depending on file), but a hunk in the custom_breadcrumbs.install file failed for 1.x-dev, so I'm assuming 1.4.
It seems to do its job though. Did not test disabling locale module, only set my language on my existing breadcrumbs and made some new ones for my second language.
Thanks for this patch, my breadcrumbs looked really weird without it!
Comment #23
Roi Danton commentedWell, it seems as it is against 6.x-1.x-dev branch since the 6.x-1.4 tag contains the module file version 1.6.2.4 while the patch is against 1.6.2.5. Furthermore all files of the dev branch still have the same version as this patch is against.
Therefore it would make sense to apply this patch and commit the other pending patches against the new patched dev version.
Comment #24
MGN commentedI've implemented this patch in custom_breadcrumbs 6.x.2.x. See #372648: Custom Breadcrumbs 2.x for a discussion of this development...
Comment #25
MGN commentedcommitted to 6.x.2.x-dev
Comment #27
greg.harveyLooks like this was never committed to 6.x-1.x ... is that correct? Trying to work out how to do multilingual breadcrumbs with the current recommended D6 version. =/
Edit: Seems not. Anyone mind if this is marked for needing a back-port? Most of the work is done as the original patch was for 6.x-1.4 - it just needs re-rolling against the latest 6.x-1.x-dev code.
Comment #28
greg.harveyFor the record, the patch in #20 doesn't quite work. It doesn't seem to save the language in the custom_breadcrumb table - just an empty string. If I manually put the language in there it all works fine, so the front of it works. Just the admin page not saving the language. I'll try and fix this and post a patch in the coming weeks.
Comment #29
MGN commentedFor 6.x-1.x, Eaton expressed a desire to avoid "incremental feature creep" See #357367-8: Custom Breadcrumbs has additional maintainers - planning for cb 2.0 and surrounding context for an explanation. So at this time, this feature (and other new features) is only implemented in 6.x-2.x. At this point it would be helpful if you could test the 6.x-2.x-dev version so the next beta version can be released. That will help move toward a stable release of cb 6.x-2.0.
Thanks.
Comment #30
greg.harveyHi, ok - I understand. Won't be able to test the beta on this project though, because it's production and we only use recommended versions (which is 6.x-1.5, obviously). If I get chance to try it out in my sandbox later on, I will. =)
Comment #31
danny_joris commentedI need to translate my breadcrumb strings as well, but unfortunately I can't use version 6.x-2.0 because this conflicts with the language switcher block: #980040: Conflict with language switcher (locale).
Would I be able to get this working in 6.x-1.5 with this patch? Or is there a way to work around the other issue I have?
+1 for backporting this. 6.x-1.5 is the "stable" version after all.
Comment #32
LTech commentedI'm using 7.x-1.0-alpha1 how do I make this multi-lingual? Is this patch adaptable?
Comment #33
stilllife00 commentedSame question here...
I just want to see
home-> events in english site and
home-> eventi in italian site
Comment #34
ranx commentedsub
Comment #35
amitkeret commentedI realize it's been quite some time since comment #13, but...
Back then you've chosen to take the route of adding multiple DB entries for every language-breadcrumb combination.
Have you given some thought to the other solution? Seeing there'a a pretty comprehensive i18n module, wouldn't it be right to try and implement a system in which strings are tested against i18n module to check for translations?
(also, seeing as I've found ~5 different issues opened on this, and people's solution of adding a t() is obviously not appropriate, but raises the issue that a translation might be better than per-language data)
Comment #36
amitkeret commentedI found a temporary compromise:
It's so people requiring translation can get t() on their strings, but without hacking the entire module.
How about adding an identifier to Custom Breadcrumbs Identifiers, that looks something like this (sorry, failed to create a patch file):
Comment #37
colan@amitkeret: Please discuss that in another issue. This one is fixed.
For D7, this is a duplicate of #1320056: A small patch to add the home variable to i18n variables for Administrator translation.