Closed (fixed)
Project:
Image
Version:
4.6.x-1.x-dev
Component:
image.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
21 Apr 2005 at 19:56 UTC
Updated:
15 Mar 2007 at 18:45 UTC
Jump to comment: Most recent file
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.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | image-sizetranslate-fix_0.patch | 915 bytes | syllance |
| #11 | image-sizestranslation-fix-46_0.patch | 927 bytes | syllance |
Comments
Comment #1
mfbComment #2
mfbI could not replicate this bug (using cvs HEAD).
Comment #3
(not verified) commentedComment #4
(not verified) commentedComment #5
ergophobe commentedComment #6
(not verified) commentedComment #7
(not verified) commentedComment #8
(not verified) commentedComment #9
rjung commentedCould this be related to the bug of losing thumbnails/previews when editing a node? (http://drupal.org/node/25465)
--R.J.
Comment #10
syllance commentedi'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.
Comment #11
syllance commentedhere'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.
Comment #12
syllance commentedhere's the same patch for current head version.
Comment #13
Stefan Nagtegaal commentedSyllance, 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..
Comment #14
syllance commentedthe 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.
Comment #15
zoo33 commentedSeems 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.
Comment #16
syllance commentedindeed, 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.
Comment #17
drewish commentedthis has been fixed.
Comment #18
(not verified) commented