Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1969 2012-06-19 20:17:45
- jeroen
- Member
- From: brussels.be
- Registered: 2012-06-15
- Posts: 16
Re: MLP - The Multi-Lingual Publishing Pack
Hello all,
New to txp, even newer to mlp…
Is there a way to display a list of all articles in a section (without filtering a specific language).
My Google skills don’t seem up to par with this feature.
Cheers,
Jeroen
Offline
#1970 2012-06-19 20:41:06
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: MLP - The Multi-Lingual Publishing Pack
Hi Jeroen, welcome to Textpattern and MLP! The first thing that comes to my mind is to create a specific section for this and exclude it from URL rewriting (in MLP preferences). Using <txp:article_custom section="yoursection" />
there should produce a list of all articles in ‘yoursection’. But I’ve never tested this.
There may be other ways to achieve what you want, but I’d need to think about it a bit longer ;)
There is a way to show all articles in one language and with them their renditions, but I don’t think that is exactly what you want? (Like this.)
Offline
#1971 2012-06-19 22:00:05
- jeroen
- Member
- From: brussels.be
- Registered: 2012-06-15
- Posts: 16
Re: MLP - The Multi-Lingual Publishing Pack
Hello Els,
You’re fast :)
I don’t know if section exclusion would do the trick.
I hadn’t thought about it yet, but I’ll have to test. I don’t think it will work, but that’s just based on my limited knowledge of txp, mlp and some crude logic.
— Edit (when I was almost done writing the reply)
I think I’ll probably just clone every entry, leave the contents in it’s orignal language and use a custom field to be able to filter for that language.
I just re-realized that the title (genre: “a family of 4, summer 2010” vs “een familie van 4, zomer 2010” vs “une famille de 4, été 2010”) of each rendition should be translated.
— /Edit
Here’s what Im trying to do:
I’m going for a digital rendition of a physical guestbook of a couple of holiday apartments.
Each entry is in a specific language and would not be translated The site owners will copy over the entries from the physical book as articles in the guestbook section.
I grab a random entry in the user’s language now and then on a few pages in other sections of the site, on the guestbook page I would show all entries in their language but I would like to give them the option to view all entries in all languages (or provide a customizable filter of some kind).
— This is where I deleted a bunch and put in the edit above
If however you come up with other ideas, I’ll be more than happy to read about them!
Thank you for thinking with me so far!
Cheers,
Jeroen
Offline
#1972 2012-06-19 22:27:45
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: MLP - The Multi-Lingual Publishing Pack
Ah, now I understand what you want to do. If you want to use a custom field for the language and suppose your custom field is named ‘taal’ you could use something like this
<txp:article_custom section="guestbook" taal="nl" />
to display only Dutch entries. If you want to give the visitors the option to view a specific language or all languages, have a look at adi_gps. I think you can use it to fill the ‘taal’ attribute’s value.
If you don’t exclude the section from MLP I think it’s not so simple to show articles in other languages on a specific language page, especially not when these are not renditions of the current language. So I still think it would be better to exclude it, and just use the custom field. It makes more sense to me because those articles won’t have renditions.
Offline
#1973 2012-06-20 02:28:08
Re: MLP - The Multi-Lingual Publishing Pack
Hi Jeroen. I was coming to post some suggestions and also to tell you to wait for Els, queen of TXP tags and Guardian Angel of the MLP.
She’s already here, and if what she suggested about excluding a specific section from URL rewriting works, then, she deserves a prize for an amazing discovery.
That said, there is a “secret” (not documented, more info here and here) tag: l10n_get_rendition_id
.
Although I don’t think you would be able to achieve your goal with that one alone…
But then, I was looking into the plugin code and there is a function (that, i think, it could be exposed as txp tag) which may help you to achieve the goal:
_l10n_get_alternate_mappings
I think you could expose it as a tag, in a similar fashion as l10n_get_rendition_id
is just a wrapper around _l10n_get_rendition_id
.
Offline
#1974 2012-06-20 20:17:26
- jeroen
- Member
- From: brussels.be
- Registered: 2012-06-15
- Posts: 16
Re: MLP - The Multi-Lingual Publishing Pack
I still need the rest of the guestbook section page in the user’s selected laguage (header, menus, footer, …).
So I thought to put all guestbook entries in a new section ‘guestbook_entry’ and exclude that section.
I was hoping to be able to filter out the posts using something like <txp:article_custom section="guestbook_entry" taal='<txp:l10n_get_lang />' />
In the MLP article tab in the backend, the articles still show up as if they are missing a rendition and calling them from a non excluded page will still only display those articles with the same renditions available.
Logical, when I think about it and probably not what you suggested.
But I don’t really see how I would be able to exclude my entire guestbook section without then having to jump through hoops to get the rest of that page in the correct language.
Creating renditions in all languages and filtering through custom fields still seems like my only option. (an entry in English would have renditions in en, nl and fr, all with the same English content except for the title (eg “a familie of 4, last summer” which would be translated)
But I lack both queen and guardian angel credentials, besides the fact that I’m a total newbie, so I’m still open to suggestion.
Cheers,
Jeroen
Last edited by jeroen (2012-06-20 20:34:28)
Offline
#1975 2012-06-20 20:26:44
- jeroen
- Member
- From: brussels.be
- Registered: 2012-06-15
- Posts: 16
Re: MLP - The Multi-Lingual Publishing Pack
Hello maniqui,
I’m having trouble wrapping my head around the usefulness of those tags in my case though.
To get the rendition id’s of all articles I would still need to be able to get that list of all articles, from a “languified” page before I could use those id’s in the _l10n_get_alternate_mappings
function, no?
But like I said, I’m having trouble wrapping my head around it (and I’m not even talking about exposing functions as tags yet ;))
Cheers,
Jeroen
Offline
#1976 2012-06-20 20:51:52
Re: MLP - The Multi-Lingual Publishing Pack
I guess you are right.
When you say “the rendition id’s of all articles”, what does all exactly mean?
<txp:article_custom id="" />
will return all articles of a website, if I recall correctly (I’d say it’s not a bug, but an unplanned/undesired feature).
In the case of a MLP website, I’m not sure if <txp:article_custom id="" />
will return all_articles or all articles in _current language.
In any case, you could get the id’s of all articles that way.
Regarding exposing function as tags, I think it’s pretty simple: a function is a tag :) (afaik).
In this particular case, I’d suggest you to take <txp:l10n_get_rendition_id />
as an example of how to do it. You will find a function l10n_get_rendition_id
(the function that is exposed as a tag), which is somewhat a wrapper around another function: _l10n_get_rendition_id
.
So, for _l10n_get_alternate_mappings
, you could create a l10n_get_alternate_mappings
(start by using the function l10n_get_rendition_id
as example), that ends up calling the former one.
Offline
#1977 2012-06-20 21:39:41
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: MLP - The Multi-Lingual Publishing Pack
Hi both, I had been thinking about l10n_get_rendition_id, somewhere in this thread is a post of mine with an example (it’s the code I used for the site I linked to as an example). I’ll try and find it, but I’m still not sure if it would help Jeroen…
Julián, I need to take a more thorough look at your post to see if I understand what you mean, and it will have to wait for another day. It’s getting late over here ;)
Last edited by els (2012-06-20 21:40:31)
Offline
#1978 2012-06-20 21:46:10
- jeroen
- Member
- From: brussels.be
- Registered: 2012-06-15
- Posts: 16
Re: MLP - The Multi-Lingual Publishing Pack
Hey maniqiu,
Well at least I’m learning something :).
Today it was exposing plugin functions as tags (thanks for the quick writeup!) and the tag trace mentioned in Els’ signature.
Turns out
<txp:article_custom section='guestbook_entry' id='' />
does
[SQL: select *, ... from l10n_txp_nl_nl where ... IN ('guestbook_entry') ...]
Looks like it is really hard to get out of MLP once you’re in it…
Cheers,
Jeroen
Offline
#1979 2012-06-20 21:55:59
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: MLP - The Multi-Lingual Publishing Pack
jeroen wrote:
Looks like it is really hard to get out of MLP once you’re in it…
Hotel California ;) I know of one case where a section is excluded, but the article in that section does have renditions in all three languages (don’t ask me why). When you navigate to that section it will show the rendition in the language of the previously visited page…
Offline
#1980 2012-06-21 18:31:44
- jeroen
- Member
- From: brussels.be
- Registered: 2012-06-15
- Posts: 16
Re: MLP - The Multi-Lingual Publishing Pack
I’m giving smd_query and some raw php a try.
More code but it should get the job done.
Still open for suggestions :)
Cheers,
Jeroen
Offline