Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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
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
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
Re: Add lang attribute to <txp:text />
Thanks for the update. That definitely sounds promising!
TXP Builders – finely-crafted code, design and txp
Offline