Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2015-07-16 12:14:10

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Add lang attribute to <txp:text />

Bloke wrote #293277:

But we have a unique opportunity here with the next batch of 4.x upgrades.

Quite agree, multilingualism is a major change, it needs some thoughts. And since you are I am well behind me you (pardon my English!) in this area, there is no point that I make changes now that couldn’t fit later the general framework. We can share jelly beans, though. :)

Last edited by etc (2015-07-16 12:27:45)

Offline

#14 2015-07-16 12:50:31

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Add lang attribute to <txp:text />

FWIW, on my db server, loading ~20 strings takes roughly the same time that the whole public-side package (~350 strings). There is a unique index on lang, name, which is used, but doesn’t help much. So, reducing the overall number of strings could be more efficient than selecting only the used ones.

Offline

#15 2015-07-16 13:01:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Add lang attribute to <txp:text />

etc wrote #293332:

reducing the overall number of strings could be more efficient than selecting only the used ones.

I agree. So how to do that then, for the best? Some kind of versioning / tag system so we know which belong to which releases of Txp? Any ideas?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#16 2015-07-16 13:15:11

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Add lang attribute to <txp:text />

Probably separate public and admin tables? The ratio is about 1:5, and only few strings of the common part seem to be useful on the public side.

Offline

#17 2018-02-11 14:10:09

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

Re: Add lang attribute to <txp:text />

I’m out of touch here: did this progress further since these last promising-sounding discussions?

If not, firstly: is there a potential alternative one could use now? Perhaps even with txp 4.6?

And secondly: I recently had the “pleasure” of shifting a WP site over to a new theme and made a child theme for it. The language strings for a plugin or theme have their own ‘text-domain’ (link). Might that approach in combination with the new themes facility work as a way of limiting the number of public strings? One could then supply a textpack folder with a theme with custom strings in different languages.

FWIW: I liked Pete’s original suggestion with the lang attribute for txp:text. Far more compact for inline-stuff than wrapping every tag. The other txp:lang / if_lang tags also sound good.

makss wrote #293306:

<txp:text item="older" lang="es-ca" />...

… a simple wrapper was written which makes replacing {{some_words}} to the desired language. That is, the page template and the forms used simple {{older}}. For explicit language, I would suggest {{older:es}} or {{older:es-ca}}

@makss, is this something you could show or share?


TXP Builders – finely-crafted code, design and txp

Offline

#18 2018-02-11 23:18:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Add lang attribute to <txp:text />

I’d forgotten all about this discussion. Thanks for finding it again. That probably answers your first question about progress in this area :-]

Multi-linguality on the public side is on the hit list for (probably) next version-or-two-ish, seeing as we’ve made a start with language improvements in 4.7.x. The good news is that all strings now have an “owner” (equivalent to ‘text-domain’ in a way). Core strings have no owner set (owner=""). So if you insert a custom Textpack you can nominate an owner, which allows it to easily be attributed to a plugin, author, whatever you want. It’s just a freeform column in the txp_lang table.

Should be a cinch to pull out strings of a certain owner via a tag in a plugin. Since we’ve also separated the admin language from the public language, this is even more achievable now as a halfway house – in a sort of DIY-lang-strings capacity, as long as you don’t mind grabbing strings by hand based on the currently set public language. You could make your own simple <txp:text> tag that could take an owner and lang attributes, with lang defaulting to the current public language.

What it won’t do, however, is permit you to tie the language to the URL and translate content types – articles, links, image captions, etc. That’d have to be a whole new arena that we’ll need to figure out somehow.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#19 2018-02-12 13:19:01

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

Re: Add lang attribute to <txp:text />

Thanks for the update. That definitely sounds promising!


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB