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

Type: Pre-Sale
Status: Resolved
madesimplemedia
View Replies:
Mainio replied on at Permalink Reply
Mainio
What does your code look like?

In which folder have you stored this code?
madesimplemedia replied on at Permalink Reply
madesimplemedia
It has created the following file and I can see the translation in there:
\languages\site\de_DE.po
Mainio replied on at Permalink Reply
Mainio
I mean the code where your button is?
madesimplemedia replied on at Permalink Reply
madesimplemedia
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.
Mainio replied on at Permalink Reply
Mainio
There is an echo statement missing from your button's code.

Please update the code:

<li><a href="" class="btn request-quote"><?php echo t('Request a Quote'); ?></a></li>
madesimplemedia replied on at Permalink Reply
madesimplemedia
Agh how silly of me, thanks that has sorted it!
madesimplemedia replied on at Permalink Reply
madesimplemedia
Sorry one more thing, is it possible to translate the value of a variable?

echo t($val);

It doesn't seem to work.
Mainio replied on at Permalink Reply
Mainio
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:

<?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"
madesimplemedia replied on at Permalink Reply
madesimplemedia
Thanks Manio, I will do that.

concrete5 Environment Information

# concrete5 Version
5.6.3.2

# concrete5 Packages
Advanced Page List (1.0.3), Area Splitter (2.1), Basic Forum (1.0), Chemicals (1.0.1), Designer Content (3.1.1), Distributor Directory (1.0.0), Dynamic Iframe (1.61), Fabrics (1.0.3), Flipping Brochure (0.0.1), Form Tableless Layout (1.2.1), Internationalization (1.4.1), Invisible reCAPTCHA (0.9.3), Localizer (1.0.0), Manual Nav (1.3), Page List+ (6.0.0), Pro Blog (6.0.3), Product By Application (1.0), Seo Manager (2.5.4), SQL Buddy (1.0), Translations Manager (1.3.4).

# concrete5 Overrides
blocks/switch_language, blocks/form, blocks/file, blocks/ctm_page_list, blocks/banner_image, blocks/problog_list, blocks/distributor_search, blocks/test_image, blocks/slideshow, blocks/dynamic_iframe, blocks/article_selector, blocks/multilingual_content, blocks/vimeo_video, blocks/product_features, blocks/login, blocks/test_block, blocks/content, blocks/search, blocks/page_list, blocks/htmlfive_video, blocks/team_member, blocks/multilingual_stack, blocks/chemical_tabs, blocks/chemical_table_row, blocks/autonav, blocks/manual_nav, controllers/dashboard, controllers/page_types, elements/header_required.php, elements/footer_required.php, elements/profile, elements/editor_config_blog.php, helpers/translate.php, helpers/common.php, helpers/distributor_countries.php, helpers/distributor_states_provinces.php, languages/es_ES, languages/de_DE, languages/fr_FR, languages/site, models/distributor_list.php, models/product_image.php, single_pages/dashboard, single_pages/register.php, single_pages/login.php, single_pages/profile, single_pages/page_not_found.php, themes/respirex, tools/problog, tools/setVideoThumb.php, tools/deletePost.php, tools/distributor_directory

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.6.36

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, fileinfo, filter, ftp, gd, hash, iconv, imap, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, sockets, SPL, sqlite3, standard, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 64M
sql.safe_mode - Off
upload_max_filesize - 64M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.