A place for users and developers of the Xataface to discuss and receive support.
by byNetMan » Tue Dec 04, 2007 9:38 am
I have setup english and french in my data tables.
Now I would like to see the translated data of current selected language when using valuelists.
At the moment, only the data from the original table is displayed.
Is this possible?
Thanks
André
-
byNetMan
-
- Posts: 6
- Joined: Mon Dec 03, 2007 5:51 pm
- Location: Ottawa, Canada
by shannah » Tue Dec 04, 2007 4:55 pm
Currently the only way to translate valuelists is to move them into the database. I.e. use __sql__ in the valuelist definition and make sure that the tables are set up with translations like the rest of the apps tables are.
Hope this makes sense...
Possibly future versions will support translating valuelists directly in the valuelists.ini file but for now ...
-Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by byNetMan » Tue Dec 04, 2007 5:41 pm
I am using database tables for my valuelists and they are all translated.
Is there a special way of formating the '__sql__' query in order for it to get the proper translation table?
André
-
byNetMan
-
- Posts: 6
- Joined: Mon Dec 03, 2007 5:51 pm
- Location: Ottawa, Canada
by shannah » Wed Dec 05, 2007 10:52 am
This should work. Let me review the source and test just to confirm. I'll get back to you later today..
-Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by shannah » Wed Dec 05, 2007 3:44 pm
Can you post relevant portions of your valuelists.ini file and describe your table structure a little so I can try to point out where the problem is?
-Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by byNetMan » Wed Dec 05, 2007 4:33 pm
Here are a couple of entries from my valuelists.ini
[SafetyFeatures]
__sql__ = "SELECT featureID, feaLabel FROM feature WHERE featureCat = 'S'"
[InteriorFeatures]
__sql__ = "SELECT featureID, feaLabel FROM feature WHERE featureCat = 'I'"
I have 3 feature tables:
feature
feature_en
feature_fr
My understanding is that when you have
multilingual_content=1
the __sql__ query should be reading the language specific table.
André
-
byNetMan
-
- Posts: 6
- Joined: Mon Dec 03, 2007 5:51 pm
- Location: Ottawa, Canada
by shannah » Wed Dec 05, 2007 5:01 pm
Yes.. that's right. Upon inspection of the code it looks there is a small bug in dataface You can fix it by doing the following:
Open the Dataface/ValuelistTool.php file
Find the line:
- Code: Select all
$res = mysql_query($value);
change it to - Code: Select all
$res = df_query($value);
Best regards
Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by byNetMan » Thu Dec 06, 2007 11:08 am
Hi Steve
I fixed the bug in ValuelistTool.php but it did not fix my problem.
In looking over your source code, now I believe that I must include the fields that use the valuelists into the language specific tables also.
If this is the case, then I need to find another solution since I don't want my clients to have to approve the translations every time they enter a new record.
Also, in looking at the source code, I've noticed that I can use the SET type of field for my data.
If you can confirm this, this will sove my problems.
Thanks for the help,
André
-
byNetMan
-
- Posts: 6
- Joined: Mon Dec 03, 2007 5:51 pm
- Location: Ottawa, Canada
by shannah » Thu Dec 06, 2007 11:36 am
Ok.. sorry. In 0.7.1 there is one other place you need to change it:
In Dataface/Tables.php, in the function _loadValuelistsIniFile(), there is a line:
- Code: Select all
$res = mysql_query($value, $this->db);
change it to - Code: Select all
$res = df_query($value);
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by byNetMan » Thu Dec 06, 2007 1:27 pm
Thanks Steve,
It works fine now.
I noticed that you are using Dataface_DB.cache for the sql queries but that it only holds the very latest queries.
You seem to have set a very short lifespan on the cache.
Is this intentional or is one of my settings not OK?
I'm being curious.
Thanks for the help.
André
-
byNetMan
-
- Posts: 6
- Joined: Mon Dec 03, 2007 5:51 pm
- Location: Ottawa, Canada
by shannah » Thu Dec 06, 2007 1:42 pm
Hi André,
Thanks for bringing this up. I have sort of been ignoring the cache as performance, by and large, has been pretty good, with or without the cache. There is most likely room for optimization and improvement. As we are currently revisiting the weblite translate service and modifying the business plan I will be doing another round of development on the translation components very soon and the caching will likely also be revisited.
Best regards
Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
Return to Xataface Users
Who is online
Users browsing this forum: No registered users and 28 guests
|