Problem/Motivation

When building multilingual sites, the section classes (e.g. 'section-contact', 'section-blog') added to the <body> tag in html.preprocess.inc currently depend in the localized path, causing different classes in different languages (or no classes if there is no path alias for a path).

Proposed resolution

Always use the default language when generating section classes.

CommentFileSizeAuthor
#1 omega4-localize-section-classes-1.patch851 bytesry5n
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ry5n’s picture

Initial patch

fubhy’s picture

I was actually considering removing those section classes entirely as using path based section classes for styling your side is something that one should actually never do... How do you feel about that? I mean... Regardless of that your patch is absolutely right... I am just thinking here if we should remove it entirely now that we are heading towards 4.1

ry5n’s picture

In theory, I completely agree. In practice, all of my projects end up containing shameful CSS because Drupal makes it impractical (in terms of time/skill) for me to alter the markup to what I would write by hand. Some contrib modules make modular front-end architecture flat-out impossible. So, I personally would be fine with removing these classes, but I may end up adding this feature back in myself. :( [Insert rant about Drupal’s theme system here]

fubhy’s picture

Status: Active » Fixed

Agreed... It does not hurt too much for now... Committed, thanks.

Status: Fixed » Closed (fixed)

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

ljcarnieri’s picture

Issue summary: View changes

I see one problem in this solution, probably your translation is by field because not created other node for other language.
When your site create one node for each language and you use the function "drupal_get_path_alias" with language default that is different language node, the return will always "node/nid" and always set "section-node" for other languages because are nodes different. :/

Is better revert this solution and overwrite with your hook preprocess custom.