Drupal 4.5.1., using the new i18n module.
I have a site that needs to be both in French and in English, and the anonymous user should be able to switch during a session.
The user must get a user menu, based on the language he is using at that point in time.
The i18n module makes it possible to use en/about and fr/about for the French and the English version of the about us page.
The blocks module has the possibility of having a block active based on the path for the node we're currently viewing. So, if the path starts with fr/ the French menu shows, and if it starts as en/ the english menu shows.
i18n also makes it possible to have two frontpages, differing by their language code.
Now the problem : when one goes to the page without any ?q, the standard home page,
the correct path to the frontpage is created in the $_GET[q].
But the blocks module does not use $_GET[q] , probably not to be misled by path mapping, and ( in function block_list) opts for using request_uri() in order to get back at the original URL.
The use of this function means that frontpage node rewriting and the blocks module do no go well together.
Drupal has a multi stage process in order to get to the right node, and one should have a standard way of getting at them
- The original URL as typed by the user, or followed as link
- The node as found by variable_get('front page') in common.inc, and on a per language base in i18n_init()
- The node as found by drupal_get_normal_path() / i18n_get_normal_path
Should I be patching blocks to use the second path, or would that break the code of other people / other sites? Or should I try something in i18n?
Comments
you should not bother too much
Eventhough some people seem to disagree, the old (thats the one you are using) i18n is very much broken in drupal 4.5. It is not so much that it contains bugs, but its methods are incompatible with lots of other drupal menus and settings.
Thus The original author decided to move in a new direction, the resulkts can be found in the CVS. http://cvs.drupal.org/viewcvs/drupal/contributions/modules/i18n/ I suggest you try this system (on a test site, please ;) ) and see if the problem occurs there too. But it should not.
[Ber | Drupal Services webschuur.com]
using new i18n
I'm new to drupal, so I've never known the old version. I downloaded i18n v1.11 a week ago.
Arie Dirk Schenkeveld - http://www.combraillesreseaux.biz
then I suggest you file issues
the project can be foudn at i18n. please file your issues theree, so that we can track them.
thatks a lot for your effort.
[Ber | Drupal Services webschuur.com]
What module is wrong
The problem is that I'm not sure whether it's a i18n issue, or a blocks issue, uncoverd by the use of the new i18n. So I'm not sure whether to raise a core issue, or a module specific one. Advice please.
Arie Dirk Schenkeveld - http://www.combraillesreseaux.biz
certainly not blocks
I found some more minor issues with the lc/* (cl= language code) paths. I was very happy with the old system of adding the language /after/ the url instead of before, since it does not break (mass) aliassing.
The old system used thesite.com/?q=the/normal/path?lang=foo
Can we not re-implement that method, and do away with all the alias/url difficulties?
[Ber | Drupal Services webschuur.com]
PHP code solution
I've managed to get the following to work when adding a new block:
if ( _i18n_get_lang() == 'fr') {} else {}It's not very elegant, but the only other solution I've seen by translating the strings that are in the block and running them through t().
Mike
--
Mike Gifford, OpenConcept Consulting
Free Software for Social Change -> http://www.openconcept.ca
I'm really sorry for my
I'm really sorry for my question, but where should I put this code?
Thank you to be patient :-)
Danilo
This is for use in php block....
This would be to put in a php block. i.e. the block figures out what language the interface is being viewed in and then picks what content to send to the user.
One of the disadvantages of this approach is that is does not work well for creating dynamic menus i.e. that are aware of what page is being viewed and expand/contract accordingly.
The new i18n has a submodule associated to it to handle translation of menus although there are still some issues to resolve.... For more details