kinyelo / vosao

Automatically exported from code.google.com/p/vosao
GNU Lesser General Public License v2.1
1 stars 2 forks source link

How can I get full url address? #393

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I want to configure vocao: when use .ru domain get a russian language page, 
when use .com domain, get a english language  page. So I need get a full url 
address with a domain name. 

Original issue reported on code.google.com by tech%mop...@gtempaccount.com on 17 Dec 2010 at 10:22

GoogleCodeExporter commented 9 years ago
Ok, I found the  command  $config.siteDomain. 
My site have a two domain: XXxx.ru and XXxx.org. So, it return XXxx.org always! 
And when I try XXxx.ru,  $config.siteDomain return XXxx.org anyway. 

Original comment by tech%mop...@gtempaccount.com on 17 Dec 2010 at 12:05

GoogleCodeExporter commented 9 years ago
If you need to get URL you can use $request.getRequestURL() 
(HttpServletRequest) 

I think you need functionality which is not exist:

- Selecting default language by domain: for xxx.org - english, xxx.ru - russian

In existing implementation site language is selected by user locale. So if user 
will come to your xxx.org site having russian locale on his computer - content 
will be in russian if it was created for this page. 
If there is no page for current user language then default language will be 
used.

Could you please explain what is the benefit of having several sites in x.org, 
x.ru instead of having only one fully localized x.org?

Original comment by kinyelo@gmail.com on 17 Dec 2010 at 12:29

GoogleCodeExporter commented 9 years ago
Also you can have different applications running on x.org, x.org each of them 
having english and russian default languages respectively.

Original comment by kinyelo@gmail.com on 17 Dec 2010 at 12:31

GoogleCodeExporter commented 9 years ago
by lisit...@mopsproject.org
Thanks for the quick response!
We specifically bought a domain for segmentation by language. I think it's more 
convenient.
That I want to make the cunning plan:
Suppose, if a user go to the link xxx.org, Vosao redirect him to 
xxx.org/?language=en. And if user go to xxx.ru, Vosao redirect him to the 
xxx.org/?language=ru.
It's real to do?
I have not found the command to redirect, yet.

Original comment by tomclanc...@gmail.com on 20 Dec 2010 at 8:07

GoogleCodeExporter commented 9 years ago
for xxx.ru I suppose your domain provider can offer you with such a service. Or 
deploy application to xxx.ru with single index.html page redirecting to 
xxx.org?language=ru

Original comment by kinyelo@gmail.com on 20 Dec 2010 at 11:36

GoogleCodeExporter commented 9 years ago
ok, I try to setup DNS server in order to redirect from xxx.org to 
xxx.org/?language=en and from xxx.ru to xxx.org?language=ru. And it's working, 
but without www only .
So, I add some vosao code to my template, and it is solved all the problems:

<head>

-------------
head parametrs
-------------

#set($checklocal = "1")
#if (($request.getRequestURL().indexOf("xxx.org") > -1) && ($language.code == 
"ru"))
<meta HTTP-EQUIV="REFRESH" content="0; 
url=$request.getRequestURL()?language=en">
#set($checklocal = "0")
#end

#if (($request.getRequestURL().indexOf("xxx.ru") > -1) && ($language.code == 
"en"))
<meta HTTP-EQUIV="REFRESH" content="0; 
url=$request.getRequestURL()?language=ru">
#set($checklocal = "0")
#end

</head>

<body>
#if ($checklocal == "1")
----------
BODY HTML TEXT
---------

<!-- change language with hyperlinks -->
#set ($changeUrl = $request.getRequestURL())
#if ($language.getCode()=="ru")
   <u>Русский</u> |  <a href="$changeUrl.toString().replaceAll("xxx.ru","xxx.org")?language=en" class="">English</a>
     #else
     <u>English</u> | <a href="$changeUrl.toString().replaceAll("xxx.org","xxx.ru")?language=ru" class="">Русский</a>
     #end    

<!-- end -->

#end

</body>

So, if user  by any_location_in_browser  go to www.xxx.ru/any_page/ -   then 
opening russian language. And if user go to www.xxx.org/any_page/ - then 
opening english language in any case. What I sought!
Thank you for your help and attention.

Original comment by tomclanc...@gmail.com on 22 Dec 2010 at 4:12