Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#11 2019-01-24 11:15:35
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 8,524
- Website
Re: smd_babel: Manage string translations from the admin side
Pat64 wrote #316271:
It’s very useful for… themes! And I love it ;)
Great!
Could you add a lang attribute to the
<txp:text item="" />
Core tag in order to retrieve the corresponding string associated to a lang iso code?
It’s something I’ve considered before but talked myself out of it. Currently that tag will output whatever item
it is given in the current language. On the public site that’s the public language. In theory – though I’ve never tried it – if you used the tag on a dashboard / admin-theme / plugin it would show you the string in your admin-side language. All automatic. As far as I can tell, that’s exactly what the tag was designed for: to offer a translated text string in the current local context.
With that in mind, under what circumstances would you need to override the item and display it in a specific, fixed language for everyone?
EDIT: Oh, besides perhaps in a language switcher context: that’s a good example, jakob thanks.
Last edited by Bloke (2019-01-24 11:17:36)
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
#12 2019-01-24 12:18:20
- Pat64
- Plugin Author
- From: France
- Registered: 2005-12-12
- Posts: 1,237
- Website
Re: smd_babel: Manage string translations from the admin side
Yes, that’s work!
Stef: you are a master!
Patrick.
G+
Github | CodePen | Simplr theme
Offline
#13 2019-01-24 12:41:56
- Pat64
- Plugin Author
- From: France
- Registered: 2005-12-12
- Posts: 1,237
- Website
Re: smd_babel: Manage string translations from the admin side
@Jakob:
However, I can imagine a lang attribute would be useful to show another language, for example for a language switcher where you explicitly say lang=“fr” or when using a variable that holds the current language of a multi-language site […]
That’s exactly what I’m doing on my website with the help of my tiny plugins: pat_text
and pat_lang_detect
.
Patrick.
G+
Github | CodePen | Simplr theme
Offline
#14 2019-01-24 12:55:20
- Bloke
- Developer
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 8,524
- Website
Re: smd_babel: Manage string translations from the admin side
Slightly OT but I think a language switcher might be better solved with a language container tag:
<txp:langs wraptag="ul" break="li">
<a href="<txp:site_url/>/<txp:lang />"><txp:text item="lang_name" /></a>
</txp:langs>
We might decide to add a lang
attribute to the container that would permit a selection of languages to be offered, e.g. lang="en,fr,de"
.
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
#15 2019-01-24 13:27:10
- Pat64
- Plugin Author
- From: France
- Registered: 2005-12-12
- Posts: 1,237
- Website
Re: smd_babel: Manage string translations from the admin side
Better, sure!
Patrick.
G+
Github | CodePen | Simplr theme
Offline