Now, using Internationalization module CSS classes for sections are taken from language prefix, instead from real path. This patch solve the issue using _i18n_get_original_path() function.

Maybe the same control statement could be used to add a new CSS class for language (e.g. "lang-en") using the i18n_get_lang() function. This will provide a backward compatibility for those are still using classes like section-en for their pages.

CommentFileSizeAuthor
#3 patch2.txt906 bytespoiu
#1 patch.txt849 bytespoiu
zen_i18n_sections.patch650 byteschirale

Comments

poiu’s picture

Category: feature » bug
StatusFileSize
new849 bytes

This patch fails for me if there's a lang prefix in the path. _i18n_get_original_path() returns the path with the prefix. I had to strip it off with i18n_get_lang_prefix.

I also added a 'lang-'. i18n_get_lang() class.

Note: this *will* break sites relying on the old, buggy behaviour (i.e. the section-en class).

poiu’s picture

Status: Active » Needs review

forgot to change status...

poiu’s picture

StatusFileSize
new906 bytes

Slight problem, the lang-XX class won't be added to the front page if it's inside the !is_front conditional block. Moved it out.

johnalbin’s picture

Version: 5.x-1.1 » 6.x-1.x-dev
Category: bug » feature
Status: Needs review » Needs work

Poiu, yeah, breaking existing sites is a no-go. Actually we could prevent breakage by providing: .section-LANG, .lang-LANG, and .section-CORRECTED-SECTION. i.e. we provide the old-style i18n-uncorrected section class along with the new ones.

Can you re-roll?

Also, I would love something for 6.x-1.x. But from a glance at i18n 6.x, it looks like the API has changed. Can someone let me know the 6.x equivalent to the i18n functions used in this patch?

johnalbin’s picture

Version: 6.x-1.x-dev » 5.x-1.x-dev

Whoops. Pre-maturely bumped version. Need patches for both versions, really.

johnalbin’s picture

Component: Code » layout.css
Status: Needs work » Closed (won't fix)