This patch allows the administrator to set different text for the 'Save' and 'Quote' buttons.

CommentFileSizeAuthor
yh.patch2.49 KByhager
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kbahey’s picture

Status: Needs review » Needs work

How does this work in a multilingual site? Now that the value is stored in a variable, it will appear in all languages, and becomes untranslatable.

Other approaches:

1. Use a theme function for the button, and people can override it with what they want.

2. Use the strings override module.

yhager’s picture

There are a few methods to solve these issues, let me know your preference.

How does this work in a multilingual site? Now that the value is stored in a variable, it will appear in all languages, and becomes untranslatable.

Maybe we can use

t(variable_get('stock_save', 'Save'));

instead? It will use a localized string when available.

1. Use a theme function for the button, and people can override it with what they want.
That's right, but it's very nice to have the admin set the button text and not the themer/developer.

2. Use the strings override module.
That was my first attempt, but 'Save' is such a popular string, I was getting 'Add to portfolio' in the nodequeue pages, and many others..:)

Let me know which approach you prefer, I'll reroll the patch.

yhager’s picture

Taking another look at the code, I see that 'stock_description' has the same issues you mentioned, but for 'stock_block_title' and 'stock_overview_title', you use the t() function on the result of variable_get() - so I suggest to do the same, for consistency.

kbahey’s picture

Actually, using t() on stuff that is not a constant is a mistake. The reason is that it cannot be translated using POT tools, since the constant cannot be extracted using these tools, since it is in the database.

So we need to correct the ones that use this method rather than use new ones.

yhager’s picture

Yes, you're right about t() usage.

Let me know if I can help making this patch acceptable, or you prefer to do the modifications yourself.

kbahey’s picture

If you can fix these problems with wrong t() and have the time, please do so via a patch.

yhager’s picture

If you can fix these problems with wrong t()
Well, these problems are unrelated to the original patch, so let's use a different issue for those.

Let me know what else needs to be done with this patch.