Ask Your Question
1

How to create localization language-specific css?

asked Dec 10 '11

piskvorky gravatar image piskvorky
330 2 16

updated Dec 10 '11

Evgeny gravatar image Evgeny flag of Chile
6715 31 49 96
http://askbot.org/

The navigation icons (tags, people, badges) combine sprites + text.

When the text gets sufficiently long, the sprite regions overlap, and the last one continues on to show white space. I think this is a bug. It happens with german words, which can get very long.

My fix was to set a fixed width, in skins/default/media/style/style.less:

#navTags{
    .sprites(-50px,-5px);
    width: 50px;
}

#navUsers{
    .sprites(-125px,-5px);
    width: 59px;
}

#navBadges{
    .sprites(-210px,-5px);
    width: 47px;
}

But I don't know much CSS... I guess there must be a better way to clip the visible sprite region, and fall back to the background color outside of it. Ideas?

1 Answer

Sort by ยป oldest newest most voted
1
piskvorky has selected this answer as correct

answered Dec 10 '11

Evgeny gravatar image Evgeny flag of Chile
6715 31 49 96
http://askbot.org/

updated Dec 10 '11

Now we have language code included as class on the html body element, so for languages other than english just add another class qualifier to the style source code.

For example:

body.lang-de #navBadges {
       width:   60px;
}

We should really have these fixes in the default skin.

link

Comments

but that's basically the same solution... isn't there a way to only show the image background with fixed width, and if the text is longer, leave transparent background? that would be more flexible.

piskvorky (Dec 11 '11)

Ah, ok, we should just restructure the sprites - probably should make them laid out vertically.

Evgeny (Dec 11 '11)

yes, that's also a solution :) to make the horizontal spacing between individual sprites larger, or even place them vertically

piskvorky (Dec 11 '11)

And don't forget about RTL, text should be able to fit on either side.

Basel Shishani (Jan 27)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Follow

subscribe to rss feed

Stats

Asked: Dec 10 '11

Seen: 54 times

Last updated: Dec 10 '11