This is line 33 of swftools.module:

define('SWFTOOLS_DEFAULT_HTML_ALT', '<p>You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.</p>');

The error message is not wrapped in the t() function, and cannot be translated (I am building Japanese sites). Can you please update this in the next version of the module? I have already updated it to this in my own module:

define('SWFTOOLS_DEFAULT_HTML_ALT', '<p>' . t('You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.') . '</p>');

note: By taking the

tags out of the t() function, it removes the need to include them in the translation. Thank you very much!

Comments

Stuart Greenfield’s picture

I think you are right the default alternate text needs to be translatable, but I'm not sure if we should translate it at the point of definition, or at the point(s) where it is placed on the page.

If the site owner changed the alternate content on the admin page, but is running a multi-lingual site, then the translation of the alt string would break as there would no be opportunity to translate later.

Is the better fix is to run through each module that actually outputs code and translate the string at the point of use. However, will need to ensure that the default string is included in a t() call once to make sure it is picked up by the translation system, per http://api.drupal.org/api/function/t.

I'll do some checks to double check the right approach here, but in the short term I'll add the translation function as suggested above for a starter!

Stuart Greenfield’s picture

Status: Active » Fixed

The default text is now translated prior to output.

For now we don't run the variable through t() again as in most cases we would translate once in to the constant, and then again in swf().

I can go back and add an extra t() call if we need it / someone requests it.

Anonymous’s picture

If anyone ever wonders: "Constants shoud be translated prior to output only!"
Reason:

The Most Common mistakes: Usage of t() in a global context, such as define('CONST', t('...')); The locale system is not yet initialised at that time, so this usage is incorrect and also leads to nasty performance problems. Never do it.

found it in Localization API

Stuart Greenfield’s picture

Status: Fixed » Active

Oops! I think I did this once before and fixed it, and now I've put it back!

I'll reverse it again and translate in the proper place :-)

Stuart Greenfield’s picture

Status: Active » Needs review

Now translated at the start of swf() function. It means that translations (if anyone ever writes one!) will need to be aware that this string needs to be translated since the raw text is no longer wrapped, but it means we don't execute a translation in a global context.