alphabar instructions won't translate

suit4 - July 25, 2008 - 09:12
Project:Glossary
Version:5.x-2.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active (needs more info)
Description

Due to the way, the alphabar instructions are implemented, they will never translate in localisation mode.

Currently, line 579 in glossary.module reads

<?php
$output
.= variable_get('glossary_alphabar_instruction', _alphabar_instruction_default());
?>

As far as the alphabar instruction is not translated when installing the module, the gloabl variable 'glossary_alphabar_instruction' is filled with the default english value.

Translations are ment to be dynamically implemented. Pushing the translation into the global variables makes this value static.
Due to the functionality of variable_get(), a value is returned from the global variables, if it is already set. As it *is* already filled with the default value, there is no way to get the translated value ....

... except using my patch, which makes line 579 read

<?php
$output
.= _alphabar_instruction_default();
?>

AttachmentSize
glossary_translation.patch501 bytes

#1

NancyDru - September 3, 2008 - 18:14
Status:patch (code needs review)» patch (code needs work)

You can set whatever you want on the settings page - and it can be any language. You are correct that this value will not be translated after it is entered.

Translations are ment to be dynamically implemented.

I suppose this is a matter of semantics. The "t()" function will only translate a string that was defined in the translation template. I would not consider this to be dynamic.

Your patch bypasses the text as entered by the admin. I cannot apply that as this feature was requested by another user some time ago.

#2

suit4 - September 5, 2008 - 17:22

This indeed seems to be a matter of semantics.

In my case, the Glossary module is used on a multilingual page, so I have to consider that value as dynamic.

So, maybe something like

<?php
$output
.= t(variable_get('glossary_alphabar_instruction', _alphabar_instruction_default()));
?>

would do both our jobs without bypassing the text entered by the admin.

#3

NancyDru - September 5, 2008 - 23:32

That would be considered an incorrect use of t(). It has to be something like t('a !type to translate', array('!type' => $type)). And even with that whatever the value of "$type" is will not be translated.

#4

NancyDru - October 2, 2008 - 20:55
Status:patch (code needs work)» active (needs more info)

Any other suggestions? Does i18n provide anything?

 
 

Drupal is a registered trademark of Dries Buytaert.