Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

etc
Developer
Registered: 2010-11-11
Posts: 5,689
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: 5,218
Website GitHub

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: 12,497
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.

Hire 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: 5,218
Website GitHub

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