Lightweight API for localization of images, icons, etc.

Chusslove Illich caslav.ilic at
Fri Jan 18 21:25:54 GMT 2008

> [: Hans Meine :]
> It occurs to me that a language specific theme (e.g. oxygen-de) with a
> fallback of oxygen would partially solve the problem with the existing
> infrastruture, no? [...]

Perhaps, but... :)

First, in all likelyhood, it would be slower than the l10n-subdir scheme.
Because the partial "language" theme would be a first-class member in the
icon selection process, i.e. not only looked for once in the final instance
as with l10n-subdir.

Second, it would require specific build-system structure; I'm just writing a
script by which translators will be able to "track" all localized resources
based on l10n-subdir scheme (has the original changed? when, how?), so any
specificity for icon's sake only is an organizational disadvantage. And it
would definitely need some new code to "insert" partial themes based on
selected languages, and there it's hard to beat the current one-line-extra
of l10n-subdir :)

> [: Hans Meine :]
> [...] However, I would say David has a point that this could & should be
> skipped for many resource types.

If a particular resource is indeed not used, with indiscriminate resolution
the only extra cost to that resource is assertion of non-existance of one
more directory. Given that for the original resource several directories may
have already been checked up to that point, and that the resource must be
actually loaded after that, for anything but the tiniest resource file I
expect that the extra directory-check is going to be swamped in the rest of
the activity.

As witnessed by the other batch of tests, loading of ~200 byte file already
halved the relative performance loss. And that for a resource for which
there were improbably high number of localized versions and improbably bad
language fallback, as per the test setup.

                                   * * *

And oh, once I've gotten to writting out the static KLocale::i18nFilePath()
right below the non-static KLocale::localizedFilePath(), with the
appropriate doxygen comments, the point-blank uglyness of such lineup proved
unbearable to me, so I've dumped the static wrapper; as David had suggested
in the first place :)

The new patch is attached (albeit, I'd of course commit it as three separate

Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs-locfpath-02.diff
Type: text/x-diff
Size: 5422 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the kde-core-devel mailing list