Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I could not find a way to translate the search label (Where are you?) in a multilingual website (not a string, neither a variable).
Is there a way to fix it?
Thanks for help.
Comments
Comment #1
davidts CreditAttribution: davidts commentedSo I have the same problem. If you have a solution, please tell me.
Comment #2
dgtlmoon CreditAttribution: dgtlmoon commentedProbably best to follow this instructions https://www.drupal.org/node/1835940
Comment #3
John Carbone CreditAttribution: John Carbone commented"Where are you?" and filter labels are not placeholders so instructions in #2 don't apply.
Patch attached. The strings need to be translatable with t(). Once translatable (and encountered in a non-default language) the strings will appear in the translate interface and translations will work.
Comment #4
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedComment #5
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedI think a better solution would be integrating with i18n module (https://www.drupal.org/project/i18n)
A how-to is available here: https://www.drupal.org/node/1113374
Also, because the string is "dynamic" (it can be changed in admin interface), the function t() is not the best solution, because if the English version is changed, you will have to translate it all again.
This new patch adds all variables with text that can be translated to hook_variable_info() .
Comment #6
das-peter CreditAttribution: das-peter at Cando commentedEdit: Oops wrong issue - give me a second will come back to this one too :D
Comment #7
das-peter CreditAttribution: das-peter at Cando commentedI strongly agree with @rodrigoeg that this should be solved using i18n!
From the t() API doc:
That said I overhauled the patch to:
Drupal.t()
in JS.storeLocator.Panel.NO_STORES_HTML_
/storeLocator.Panel.NO_STORES_IN_VIEW_HTML_
empty_stores_msg
.That are quite some additions but nothing to complex.
Comment #8
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedThanks for the enhancements in the previous patch.
Some small comments I would like to add in the latest patch.
What does "e.h." it mean?
Sorry if this is a common English abbreviation, but I don't know its meaning (English is not my native language).
Maybe it is a typo and in fact you were going to use e.g. instead.
Do the variables need to have default values here? I think they will always have a value at this point, because variable_get will take care of getting the default value.
Comment #10
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedChanges applied in 7.x-1.x-dev branch