[TYPO3-dev] EXT-DEV - Translation of Selectbox Items in BE.

Felix Griesser feelx at shinternet.ch
Sun Nov 19 22:28:43 CET 2006


Hello List

I just begun to (try to..) develop typo3-Extensions :) I struggled on 
the problem: Imagine an extension with a "product" and a "category" - 
Let's say you have the product "book" and a category "novel" which is 
chosen from a seperate table with a 'selector box'. 
When I translate the category-items into German it would be "Novelle" - 
When I want to assign those categories - i have both entries in the 
selectbox - the "original" one and the localized one;
 [novel Novelle] Of course this MAY be wanted but it's not in every case.
After some searching I found an change in tca.php of the extension as 
follows:
      
search for the table "product" as example and look fruther for category 
in this case. In the config Array modify the 'foreign_table_where' as shown:
 "category" => Array (       
               ..
               ..
            "config" => Array (
                 ..
                "foreign_table" => "user_test_productcategory",   
                "foreign_table_where" => "AND 
user_test_productcategory.pid=###CURRENT_PID### AND
sys_language_uid=###REC_FIELD_sys_language_uid### ORDER BY 
user_test_productcategory.uid",

The important part is "AND 
sys_language_uid=###REC_FIELD_sys_language_uid###"  but I have two small 
issues with that.

1) When I have two fields where I need to change that I get a 
*mysql_assoc Error* in Backend! When I change it to
    "AND sys_language_uid=0" it works fine. Is there a solution for this?

2) When I want make the language selection depending of the current 
users BE-Language I don't know how...? Something like this, doesn't work:
    "foreign_table" => "user_test_productcategory,be_users",   
                    "foreign_table_where" => "AND 
user_test_productcategory.pid=###CURRENT_PID### AND   
                    sys_language_uid=###REC_FIELD_be_users.lang### ORDER 
BY user_test_productcategory.uid",

How can I make the display of the field-items depending on the 
BE-language of current user?

Thank you in advance and
best wishes
felix




More information about the TYPO3-dev mailing list