Text in t() blank
Permalink Browser Info Environment
Hi
I have added German and translated a button, but there is no text where it should be in the t() function.
What do I need to check please?
Thanks
Dave
I have added German and translated a button, but there is no text where it should be in the t() function.
What do I need to check please?
Thanks
Dave
Type: | Pre-Sale |
---|---|
Status: | Resolved |
It has created the following file and I can see the translation in there:
\languages\site\de_DE.po
\languages\site\de_DE.po
I mean the code where your button is?
Here is the code:
<li><a href="" class="btn request-quote"><?php t('Request a Quote'); ?></a></li>
It is in a page template in the sites' theme.
<li><a href="" class="btn request-quote"><?php t('Request a Quote'); ?></a></li>
It is in a page template in the sites' theme.
There is an echo statement missing from your button's code.
Please update the code:
Please update the code:
<li><a href="" class="btn request-quote"><?php echo t('Request a Quote'); ?></a></li>
Agh how silly of me, thanks that has sorted it!
Sorry one more thing, is it possible to translate the value of a variable?
echo t($val);
It doesn't seem to work.
echo t($val);
It doesn't seem to work.
No, the system cannot recognize the text inside the variable because it does not do any PHP processing, it is just a parser that searches for t() strings.
You can add e.g. at the top of that file the following lines where you define all instances that can be inside the $val variable:
If these variables are loaded from the database, you need to know how to create concrete5 packages in order to tell Translations Manager about those strings.
Creating packages for the legacy concrete5 versions:
https://legacy-documentation.concrete5.org/developers/system/package...
How to return dynamic strings from the package to Translations Manager:
https://www.concrete5.org/marketplace/addons/translations-manager/do...
=> "Extra dynamic database strings from packages"
You can add e.g. at the top of that file the following lines where you define all instances that can be inside the $val variable:
<?php // Define all possible translatable values for $val t("First String"); t("Second String"); t("Third String"); ?>
If these variables are loaded from the database, you need to know how to create concrete5 packages in order to tell Translations Manager about those strings.
Creating packages for the legacy concrete5 versions:
https://legacy-documentation.concrete5.org/developers/system/package...
How to return dynamic strings from the package to Translations Manager:
https://www.concrete5.org/marketplace/addons/translations-manager/do...
=> "Extra dynamic database strings from packages"
Thanks Manio, I will do that.
In which folder have you stored this code?