Multilingual web site home page with t() function
Permalink
Is it possible in some way to utilize the t() function for for a string to be translated on the home page and other pages.
I’m utilizing Concrete5’s latest version 8.4.4.
I’m utilizing Concrete5’s latest version 8.4.4.
What I need is something like what's included in the add-on named PHP Code Block. That add-on doesn't seem to be compatible with latest Concrete5 version 8.4.4. Is it possible in some way to arrange for the same as the add-on mechanism in some way?
You can use the t() with either text or variables, e.g.
t("Text String")
t($text_string)
where you have to translate the latter on the multilingual interface translation page in the Dashboard. But it's going to work if the multilingual setup is done correctly.
t("Text String")
t($text_string)
where you have to translate the latter on the multilingual interface translation page in the Dashboard. But it's going to work if the multilingual setup is done correctly.
The home page is no single page but a standard page established and maintained in Dashboard.
There is no PHP code block available for Concrete5’s latest version 8.4.4.
So how then let multiple PHP code sections including that t() function be inserted for that home page?
There is no PHP code block available for Concrete5’s latest version 8.4.4.
So how then let multiple PHP code sections including that t() function be inserted for that home page?
https://www.concrete5.org/marketplace/addons/php-code-block
On the marketplace, I previosly found that add-on named Php Code Block.
But is it compatible with latest Concrete5 version 8.4.4?
The add-on homepage doesn't include a descriptive text about the compatibilities.
But is it compatible with latest Concrete5 version 8.4.4?
The add-on homepage doesn't include a descriptive text about the compatibilities.
Whilst php blocks are in the marketplace, they are marked developer and bleeding edge for a reason. Any developer that knows enough to use them should also be wise enough to not use them. If you need to develop blocks and cant do so from scratch, then use an addon like block designer to get started.
But you shouldn't be approaching this as a coding problem. Its an organizational problem. The t() function is for interface strings, not for content. Whilst it could be hacked onto content, you would be creating a mechanism that would be fragile, difficult to work with and expensive to maintain.
As @mlocati notes, there is a lot more to a multilingual site than translating a few words of content. The site structure and navigation needs to be translated. Hence the c5 system of separate branches.
If you don't want to go that far and can accept a site infrastructure in a single language with some translated content, then have a look at c5DK's multilingual content block.https://www.concrete5.org/marketplace/addons/c5dk-multilingual-conte...
But you shouldn't be approaching this as a coding problem. Its an organizational problem. The t() function is for interface strings, not for content. Whilst it could be hacked onto content, you would be creating a mechanism that would be fragile, difficult to work with and expensive to maintain.
As @mlocati notes, there is a lot more to a multilingual site than translating a few words of content. The site structure and navigation needs to be translated. Hence the c5 system of separate branches.
If you don't want to go that far and can accept a site infrastructure in a single language with some translated content, then have a look at c5DK's multilingual content block.https://www.concrete5.org/marketplace/addons/c5dk-multilingual-conte...
I don't think this should be the way to go.
Sure, you may use an add-on that lets you add PHP code to the page (so that you can use t() calls).
BTW, t() is used to translate a string to the page language. Because concrete5 pages are always defined in a language tree (except for single pages), that wouldn't solve your problem: if a page is part of the English section, t() will translate strings to English. If a page is part of the Italian section, t() will translate strings to Italian.
So, t() is absolutely useless, unless you are working with single pages.
Sure, you may use an add-on that lets you add PHP code to the page (so that you can use t() calls).
BTW, t() is used to translate a string to the page language. Because concrete5 pages are always defined in a language tree (except for single pages), that wouldn't solve your problem: if a page is part of the English section, t() will translate strings to English. If a page is part of the Italian section, t() will translate strings to Italian.
So, t() is absolutely useless, unless you are working with single pages.
I don't like the Concrete5's multilingual concept.
For my new international web site to be established, there will be a need for multiple languages.
For the 20 languages web site as an example then, I would need 20 duplicated pages to be created and maintained. That's just too stupid.
What I need for the Home page as an example, is a 1 Page only to maintain for the 20 languages in total.
For my new international web site to be established, there will be a need for multiple languages.
For the 20 languages web site as an example then, I would need 20 duplicated pages to be created and maintained. That's just too stupid.
What I need for the Home page as an example, is a 1 Page only to maintain for the 20 languages in total.
I'm maintaining a site with 13 languages, and I really like the way concrete5 lets me manage it.
If you have just one page:
- how would you let users choose the language?
- how would you translate non-content texts (like for example the page title)?
If you have content shared across different languages, you can use stacks: just define your content in a stack, then add that stack to every page you want.
Furthermore, having different pages lets you give write access to specific pages/languages to specific translators.
If you have just one page:
- how would you let users choose the language?
- how would you translate non-content texts (like for example the page title)?
If you have content shared across different languages, you can use stacks: just define your content in a stack, then add that stack to every page you want.
Furthermore, having different pages lets you give write access to specific pages/languages to specific translators.
I do now realize the standard concept with the various language trees required.
What I need consequently is to let home page and all other pages be based on a single page.
Has anyone succeeded in making such a single page based web site with a language selector for the site guests to appear in global area?
What I need consequently is to let home page and all other pages be based on a single page.
Has anyone succeeded in making such a single page based web site with a language selector for the site guests to appear in global area?
Please delete this post admin, as I do now realize the multilingual concept hence this post becomes just stupid. Thanks!