[TYPO3-english] lost in localization

Grégory Duchesnes g.duchesnes at free.fr
Mon Dec 8 16:51:20 CET 2008


Hi all,

I've read many docs, core API, Googled and i'm still stuck with the FE  
localization concepts in Typo3
I've build a extension that works like a charm, it fetches the right  
localized content and so on, my problem is how to count efficiently  
the number of records when using localization and hideNotTranslated  
feature?

the concept of localization as i understood it is the following :

- build a query that fetches all records in default (0) or all  
languages (-1)
- loop through records and get localized content if available (and  
unset record if not in my case).
- optionnally do a little bit of versioning overlay (to get thing a  
little more spicy).

The problematic scenario is the following :
- i have 34 records in default language but only 28 are localized
- i want 10 records per page
- i don't want not localized records to appear and therefore my page  
browser should display 3 pages instead of 4

 > problem :
- if i rely on the count of my first query, i will have 4 pages (since  
i have 34 records)
- if i want to have to have the right number, i MUST select all  
records, then localize them one by one and then count the number of  
elements in the array > THIS CAN LEAD TO TERRIBLE PERFORMANCE.


My question is :
Is there another way than this second method to get the right number  
of localized records?
Maybe i haven't understood anything...


Regards,
Duch



More information about the TYPO3-english mailing list