Easy mod idea (multi language support stuff)

Started by Antechinus, June 17, 2014, 06:37:35 PM

Previous topic - Next topic

Antechinus

Topic today gave me an idea:

Quote from: Illori on June 17, 2014, 02:20:55 PM
this is not a theme specific issue... the new.gif is specific to each language installed and needs to be created for each additional language installed as well as put in a folder of that language name.

thankfully this has been resolved in 2.1.

I'm not up for writing it myself (doing other stuff) but someone else might feel like it. All you'd have to do is take the following code in BoardIndex.template.php, MessageIndex.template.php and Recent.template.php (much the same in all three):

<a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"><img src="', $settings['lang_images_url'], '/new.gif" alt="', $txt['new'], '" /></a>';


And replace it with something like this in the template:

<a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '" class="new_posts">', $txt['new'], '</a>';

And this in the CSS:

/* New post indicators (replaces old new.gif) */
.new_posts:link {
padding: 1px 4px;
background: orange;
border-radius: 2px;
color: #fff;
font-size: 9px;
font-family: verdana, 'dejavu sans', sans-serif;
font-weight: bold;
}
.new_posts:hover {
background: #5a6c85;
text-decoration: none;
}


Voila. Instant all languages support for all themes. Easy. :)

It's so easy I'm going to add it to a theme I'm currently working on, but I think it would make a good mod too.

ETA: Added better CSS for default Curve theme. May also want to play with vertical-align CSS attribute (look it up).

kat

A question, if I may...?

With custom themes, if files are missing, they get pulled from the default theme. How come that one doesn't, out of curiosity?

Antechinus


kat


Antechinus

Well there's no way of checking for missing images in the PHP logic. You can set it to call every image from default, or use default images on default templates, or never use default images.

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';


Obviously you don't want to always use default images on custom themes, because they will look like rubbish (ie: they will replace every custom image if the images share the same name). Same problem with default images on default templates.

So, in practice, no custom themes ever use the first two options. That leaves you with the third, which everyone uses. This is why I suggested these options be dropped from 2.1. ;)

kat

Ah. No "Only use the default, if there aren't any in this one".

Would it be difficult to do that, then? I kinda assume it must be, or it'd've been done that way.

Be best if it's dumped for 1.2, then, I'd say.

Ta, for explaining that, doooood! :)

Antechinus

Yeah it would be difficult to do. You'd have to cross check every image on every page load, to see if it existed or not, so it'd be a large performance hit.

kat

Had a feeling it'd be a performance thing.

Ta, again, mate! :)

Advertisement: