Hello Drupal community,
please, could you consider/criticize?
Yesterday, I have finished with synchronization bugs in i18n module, and today morning there came to me an idea on how to build true multi-language support in Drupal. It is a fresh idea, may be stupid.
shortly spoken - we can translate queries, not tables
You see, the approach of i18n module is to translate tables prepending language code. What worries me, is the number of things it affects. For example, menus module - i18n makes an array of $db_prefix and this produces PHP notice and this produces error in menus module; the i18n module synchronization had some bugs itself see - http://drupal.org/node/view/10708 and you may find probably more bugs here, at Drupal's.
And again, what is probably worse, is the approach of i18n module - we are duplicating objects. Instead of having one document with language versions, we are having two or more versions of tables that should contain the same objects. But this is true only at the beginning, later, the objects will start to live their own life making synchronization difficult.
my point is this - we do not need to create different tables for different languages, we need only some content to be translated and therefore we can manage to alter queries before they are executed.
instead of
cz_node
=======
nid | type | title | story | score | created ...
------------------------------------------------
1 | story| můj-X | tady..| 5245 | 101245
en_node
=======
nid | type | title | story | score | created ...
------------------------------------------------
1 | story| myX | text | 1255 | 101245
we could have
node
=======
nid | type | title | cz_title | story | cz_story | score | created ...
------------------------------------------------
1 | story| myX | můj-X | text | tady... |1255 | 101245
Doing this we will keep our objects un-duplicated, they will share the same administrative data and they will be updated properly. User can choose what he/she wants to translate -(exactly, what columns of the table should be translated) and for other modules? The other modules will be totally unaware that something was changed - nothing changes for them.
Consider this query - it creates new vocabulary:
INSERT INTO vocabulary (name, nodes, description, multiple,
required, hierarchy, relations, weight, vid) VALUES ('New vocabulary',
'page', '', '0', '1', '2', '0', '0', '88')
before it is issued (that means - somewhere before _db_query() ) it may be altered to this
INSERT INTO vocabulary (name, nodes, en_description, multiple,
required, hierarchy, relations, weight, vid) VALUES ('New vocabulary',
'page', '', '0', '1', '2', '0', '0', '88')
Do you see "en_description"? Only one column needs to be translated - not the whole table, we can change original query, we do not need to make separate tables. Of course, the colums must exist, but this would be task for administrative part of module - in administration stage, when user enables multi-language versions of something, the columns will be created created automatically and their names stored.
the problem is: