Problem/Motivation

Sometimes, breadcrumbs does not have to use the same behavior in different languages.
For example, you can have a different menu by enabled language and some pages (probably from Views) could be in each of these menus. In this case the breadcrumb will always be in the main website language and never really translated.

Proposed resolution

Internationalization module offers the ability to translate Drupal variables using the Variable API. This would allow to change the Crumbs' components weights to be language dependant.

Remaining tasks

  • Declare crumbs_weights in the hook_variable_info from the Variable module
  • Interface crumbs_get_weights with i18n_variable
  • Interface crumbs_admin_form_submit with i18n_variable
  • Adapt the Crumbs' UI to allow to switch language quickly

User interface changes

Add a language switcher like shown in the attached picture.

API changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuaelFr’s picture

Status: Active » Needs work
FileSize
1.93 KB

Remaining tasks

  • Declare crumbs_weights in the hook_variable_info from the Variable module
  • Interface crumbs_get_weights with i18n_variable
  • Interface crumbs_admin_form_submit with i18n_variable
  • Adapt the Crumbs' UI to allow to switch language quickly

This patch allow you to define language related settings by switching the backoffice language.
The remaining task would allow to make this easier.

DuaelFr’s picture

Fix a bug when i18n_variable is enabled but crumbs_weight is not set as a multilingual variable.

donquixote’s picture

Hi,
I think that's a good idea, but I'd like to brainstorm a bit before we add this.
Probably the suggested solution is indeed the easiest one, while my ideas just suck, so please be nice :)

Does this only apply to menus, or do we have other examples?
If it is only for menus, I had some idea that already exists in menupoly:
If you name your menus like
primary-links-fr, primary-links-de, etc, then it can automatically pick the correct one.

Do we have another way to know which language a menu is in?

Can users still do their language-neutral default settings, and only override for some languages?

Would it make sense to have something like this instead?
menu.hierarchy.primary_links[lang=fr]
(Probably a bad idea, because it would make the entire thing even more cryptic, and a move to a graphic UI more difficult)

DuaelFr’s picture

All this is open to discussion but I had a major problem so I solved it the easiest way I found.

I don't think this is only usefull for menus but maybe for taxonomies too, it was just an example.

The fact is that the main (huge) i18n module has defined a way to handle localized settings so I think we should not reinvent the wheel and try to use what exists.

Here is a new patch working with the last versions of i18n and variable.

donquixote’s picture

Ok, here is a plan:
1. We implement the solution you suggested, but make sure that people can still define a language-neutral setting as a fallback.
(or fallback to the default language?)
2. In the future we might add other solutions where they make sense. E.g. a technique to automatically pick the correct menu for a language. This needs further thinking, so we don't do this now.

Does your solution allow a default / language-neutral / fallback setting?

DuaelFr’s picture

Status: Needs work » Needs review
FileSize
3.42 KB

Remaining tasks

  • Declare crumbs_weights in the hook_variable_info from the Variable module
  • Interface crumbs_get_weights with i18n_variable
  • Interface crumbs_admin_form_submit with i18n_variable
  • Adapt the Crumbs' UI to allow to switch language quickly

It seems that the i18n module take the default language setting as the default so I would say "yes".

This last patch adds to the form the language selector as it is set on the other translatable settings forms. It is made in a dirty way because the crumbs module does not just use drupal_setting_form but it works well.

candelas’s picture

thanks for making it translatable.
dont forget, please, views titles (i am having this problem).

donquixote’s picture

@DualFr,
thanks for the patch!
I'm a bit afraid it will conflict with recent work over here,
#1404018: Better UI for hierarchical prioritization form

Might be a good idea to fix that other thing first?
It also means we move to drupal_settings_form(), which might make things a bit easier :)

donquixote’s picture

Btw, checking the module with your patch, I have a little issue.
When I visit the configuration form, it doesn't say in which language it will save the new config. I think we should be absolutely transparent about this. And maybe the drupal_settings_form() will give us some of this for free?

donquixote’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Configuration forms have changed a lot in 7.x-2.x
Re-roll? Or rethink?

donquixote’s picture

Does this only apply to menus, or do we have other examples?
If it is only for menus, I had some idea that already exists in menupoly:
If you name your menus like
primary-links-fr, primary-links-de, etc, then it can automatically pick the correct one.

I don't think this is only usefull for menus but maybe for taxonomies too, it was just an example.

I'd like to put this question back on the table..
Both for menus and taxonomies, the usual use case I can think of is that some menus and vocabularies are for all languages, while some are for a specific language only.
For this kind of scenario I imagine it quite unpractical having to maintain completely independent priority settings for each language.

donquixote’s picture

(The only) two issues I could find on drupal.stackexchange:
http://drupal.stackexchange.com/questions/62568/multilingual-breadcrumb-...
http://drupal.stackexchange.com/questions/59930/how-can-i-add-multilingu...

I would like to know a lot more about the use cases..

Status: Needs review » Needs work

The last submitted patch, crumbs-add-i18n-variable-support-1848610-6.patch, failed testing.

donquixote’s picture

This could be one of the things to discuss on DrupalCon.
#2094933: Crumbs BoF/meeting on DrupalCon Prague 2013?

donquixote’s picture

Issue summary: View changes

Correcting little mistakes

Bertjuh’s picture

Issue summary: View changes

Any update? Is there any way to have the following:

in: admin/structure/crumbs/entity-parent/user

For the "Crumbs parent path for users with role x"
Dutch: over-ons
English about-us