Hi All!
I'm wondering what is the correct way in Mason2 to achieve the following:
- The site should have one default language, without any language codes
in urls, and English as the second language, with urls starting with /en/
- The components are the same for both languages, i.e. content is chosen
inside the same component based perhaps on some global variable that is
set within each request depending on the language code in the url.
- Except for these language codes, the urls generally map to physical
component files, so /contact and /en/contact should both map to real
file contact.mc
This is how I have done it so far:
- Created a component (en.mp) that sets a request variable:
$m->request_args->set(lang=>'en');
Then it does an internal redirect with modified request_args:
$m->visit($m->path_info, $m->request_args);
However I don't like this solution because:
- don't like messing up request_args which can later cause some problems
(e.g. unintended args passed to the form processing code and generally
to all the components)
- suppose that visit() isn't meant to be used like that and may have
some performance impact here
So my questions are:
- what is the correct way to set a global variable changing its value
per request?
- how could I hack the path_info so that /en/ prefix could be just
dropped and the request processing simply continued as if there were no
this prefix in the path?
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users