After translating 'thumbnail' and 'preview' from /?q=node/add/image, the preview/thumbnails stop working. This seems to be caused by a side-effect of thumnail/preview file names also being renamed using translated strings while in other situations they are not requested using translated strings (e.g. files are creating using the translated 'preview' string and requested using the untranslated string).

This prevents me from translating the strings properly.

Comments

mfb’s picture

Assigned: Unassigned » mfb
mfb’s picture

I could not replicate this bug (using cvs HEAD).

Anonymous’s picture

Anonymous’s picture

ergophobe’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

rjung’s picture

Could this be related to the bug of losing thumbnails/previews when editing a node? (http://drupal.org/node/25465)

--R.J.

syllance’s picture

Status: Fixed » Active

i'm facing the same issue with the use of translation and image/img_assist module. could not list all related issues, but i'm facing inconsistent behavior. in my case, thumbnail is translated, while preview is not. this leads to strange behavior using thumbnails, and to file being named with _0 as the preview term is not translated.

this is due to the function _image_get_sizes(), which initially return translated terms for thumbnail and preview while these terms are used untranslated in the image module code, and at least the img_assist module. for example on 4.6, line 182 (same place in HEAD) :

foreach (_image_get_sizes() as $size) {
if ($size['label'] && !in_array($size['label'], array('thumbnail', '_original'))) {
$sizes[] = $size;

_image_get_sizes will return translated terms, so the in_array test using english terms won't work.

in the img_assist module, thumbnails simply cannot be used because thumbnails are retrieved using SQL and english term 'thumbnail', while the stored database records store the translated filename.

simple fix would be to remove the t() calls, as it seems at least one module (img_assist) is using english term. but that should be discussed.

syllance’s picture

Version: » 4.6.x-1.x-dev
Priority: Critical » Normal
Status: Active » Needs review
StatusFileSize
new927 bytes

here's a patch that removes the t() calls on default image sizes, for 4.6 version of the module.

this is causing unexpected behavior when the default sizes indeed gets translated, and prevent the module to work correctly, at least on my setup.

syllance’s picture

Version: 4.6.x-1.x-dev » 6.x-1.x-dev
StatusFileSize
new915 bytes

here's the same patch for current head version.

Stefan Nagtegaal’s picture

Syllance, i'm not getting your point here. Why did you removed the t()'s?
It's ony the label which was translatable, NOT the height/width itself..

Please explain your problems a little more specfic please..

syllance’s picture

the problem is precisely with the fact that labels for image sizes are translated by default.

i have nothing against this. but labels names are tested against untranslated terms ('thumbnail','preview') in several places of the code, and in other module (img_assist). so once your default sizes labels are created with the translated terms, then you're facing some troubles because 'thumbnail' or 'preview' does not exists.

in my case, 'thumbnail' has become 'vignette'. so when i'm creating an image, a file with ".vignette." gets created for the thumbnail view, but the module does not identify this 'vignette' image size as the thumbnail one, so the picture has no thumbnail, 'vignette' is considered as an additionnal image size. and this is normal as the code search for 'thumbnail', not t('thumbnail').

note that this happens when you first use the image module with a translated drupal. if you start creating images with an english drupal, then it's fine as default sizes are created with the english term.

this is not really a big or critical problem, but i don't think the module should use translated default values while testing these values untranslated elsewhere. so either we have to remove default translation (what does my patches), or make the code use translated terms.

let me know if i'm wrong. and sorry for my english. i hope you now understand my point.

zoo33’s picture

Seems to me that each image size should have two labels: one which is only used in file names/paths and remains untranslated, and one which is the actual label that gets displayed on the pages.

syllance’s picture

indeed, that would be nice. that could also enable labels with fancy names that won't risk to break the file storage.

note that my small patch does not prevent the sizes to be translated when displayed, it just fixes an issue when you initially start with a translated drupal before using the image module. sizes label still gets translated when displayed.

drewish’s picture

Version: 6.x-1.x-dev » 4.6.x-1.x-dev
Status: Needs review » Fixed

this has been fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)