Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2021-04-06 13:26:26

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,218
Website GitHub

Re: Multi-Lingual Site

demoncleaner wrote #329690:

Hehe, you write more quickly than I can type :-)

I am curious for the image captions now. Did you manage to get it working with the help of your unpublished plugin?

That was just using jcr_image_custom (see above and the linked thread for a screenshot).

I include them like this now: <txp:output_form form='language_<txp:variable name="lang"/>'/>...

Yes, that’s what I meant with the lang_prefix as tag-in-tag. If you name your other fields e.g. your image custom fields, your language snippets (and parallel section custom fields if using them) to include the prefix, you can avoid all the if_this_language then show this else show that.

I tried <txp::language_<txp:variable name="lang"/>/>... … but it was not working.

I don’t think you can construct an actual tag like that. If you make your shortcode accept an attribute, e.g. <txp::language lang='<txp:variable name="lang"/>' /> you can include variable as an attribute, but it’s then almost the same as the output_form tag above. Or you assume the default to be the current variable and your shortcode will always output the current page-language’s snippet form based on that with no attribute required.

So one last thing about the use of smd_query. Maybe I will find a way around it but is it really a no go in terms of performance to have 1 or 2 more DB selects running in the back?

No, it’s not a problem at all. Only if it gets out of hand and sometimes there’s no other way. If you are worried that your page has too many queries, you can also use a caching plugin to save the pre-rendered page output.

And what if I would use jcr_section_custom to detect the sister section of my current section? Wouldn´t that also mean there is an extra select going on in the back?

Yes, of course, with jcr_section_custom there’s also a database query. I don’t think the current txp:section tag gets all the fields and there’s not txp:section_info tag like there is for image_info.


TXP Builders – finely-crafted code, design and txp

Offline

#32 2021-04-06 16:09:42

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 228
Website

Re: Multi-Lingual Site

I don’t think the current txp:section tag gets all the fields and there’s not txp:section_info tag like there is for image_info.

But there is one for the adi_menu.
adi_menu_info and adi_menu_if_info do quite a good job here.

Give me some days to improve the current setup.

Last edited by demoncleaner (2021-04-06 16:10:06)

Offline

#33 2021-04-07 06:44:10

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 228
Website

Re: Multi-Lingual Site

Just a thought that popped up this morning …
I am pretty sure you guys have been there already but I wanna make sure.

What if we would call the sections like:

services_de
services_en 

Like that we would know already the current language through the sections names.
I am sure this is more or less what jakob was doing with the unpublished plugin.
That would also help in the backend chosing the correct section for an article. Because if you have sections called:

Leistungen
Services

They won´t be listed up nicely underneath in a later state. And it won´t be easy to find the right sister-section.
Whereas

services_de
services_en 

would be.

Also the potential duplicate plugin could list the installed/needed languages and could ask you up front into which language you want to duplicate an article. Let´s say you have written an article for service_de and want to write the english version next, you would just have to click duplicate (selectbox to “en”) and it will put it to services_en. It then could also check if for this article(_id) in this language (section group e.g. “services”_xx) another article exist and only allow you to duplicate it if not.

I just definitely think that speaking urls is the only way.
So somehow www.domain.de/services_de/ would have to be rewritten to www.domain.de/leistungen/

Or what would be wonderful if adi_menu could get a feature in the backend (like the indent feature) that let´s you see “alternative titles” (idealy in combination with their parent sections) instead of titles. That would solve a lot! And you would have get the best for the urls and the handeling in the backend.

Meanwhile I managed to improve my first setup.
Now pages can be used as usual!

I also found a way to potentially get rid of the htaccess entry by using virtual sections in adi_menu but I did not follow this road any futher. Because having your languages as REAL “root” sections gives you the benefit on having the sections nicely displayed in the backend. That could be obsolete if adi_menu would be tweaked like described above.

Last edited by demoncleaner (2021-04-07 06:49:37)

Offline

#34 2021-05-10 09:21:40

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 228
Website

Re: Multi-Lingual Site

Just for completeness:
Here is plugin (dem_clone) and a tutorial on how to setup adi_menu and deal with the multi-lingual approach.

Offline

Board footer

Powered by FluxBB