logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Can I change the language of a vhost domain?
Author
Jordo



Joined: 18 Sep 2012
Posts: 2
Location: CAnada, Montreal

PostPosted: Tue 18 Sep '12 18:12    Post subject: Can I change the language of a vhost domain? Reply with quote

English is the default language of my apache install.
I would like to know if I could change the language of a vhost domain, so that the language used for server messages is French (just for that domain).

Example: I have enabled directory listing for a domain (using .htaccess).
When Apache list the contents of that directory, English is used.
"Index of, Name, Last modified, Size, Description" etc.....

I would like it to be in French and use French formatting for the dates
(only for that domain).

Is this possible?

Thanks,
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 18 Sep '12 20:07    Post subject: Reply with quote

As far as I know it is hardcoded and can't get changed. That is why I made a script for myself to do that for me. See http://pastebin.com/raw.php?i=Aa7tWQMp

it might help
Back to top
maba



Joined: 05 Feb 2012
Posts: 64
Location: Germany, Heilbronn

PostPosted: Tue 18 Sep '12 21:48    Post subject: Reply with quote

As far as I know you can use the
Code:
ErrorDocument

directive inside a virtual host context. The built in messages (if some severe error gets logged to the log file for example) are still in English but the error replies which are sent to the users can be customized that way.

So if you have a typical "You are not authorized" reply (Error 403), then you can create a French localized version like this

Code:

ErrorDocument 403 "Accès interdit"
# or
ErrorDocument 403 "/mon_erreur_403_FR.html"


You would have to do this for all the possible error codes. A full set of these HTML files is in the error subdirectory of the server.

Maba
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 19 Sep '12 10:19    Post subject: Reply with quote

I found a way.

in the vhost

Code:

<VirtualHost *:80>
   IndexOptions +XHTML
   HeaderName /HEADER.html


The HEADER.html
Code:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
   $('body table tbody tr th a').each(function(i){
      $(this).html($(this).html().replace('Last modified','&Auml;nderungsdatum'));
      $(this).html($(this).html().replace('Size','Gr&ouml;&szlig;e'));
      $(this).html($(this).html().replace('Description','Beschreibung'));
   });
});
</script>


have fun!
Back to top
Jordo



Joined: 18 Sep 2012
Posts: 2
Location: CAnada, Montreal

PostPosted: Fri 21 Sep '12 17:55    Post subject: Thanks for ALL the replies. Much appreciated! Reply with quote

James, your first suggestion made me realize my approach was overkill for what I wanted to do.
And your second suggestion seems to be the answer.
I will definitely try it this weekend.

I will post what approach I used.

Thanks again Maba & James!!!
Back to top


Reply to topic   Topic: Can I change the language of a vhost domain? View previous topic :: View next topic
Post new topic   Forum Index -> Apache