Commit 4f9bb883 authored by Yadd's avatar Yadd
Browse files

I18n in javascript (close #306564 / forge.objectweb.org)

parent 03d1ceaa
Revision history for Perl extension Lemonldap::NG::Manager.
0.41 Sun Jan 14 14:04:05 2007
- I18n in javascripts (close #306564 / forge.objectweb.org)
0.4 Sat Jan 13 20:23:18 2007
- New configuration parameter named 'macros'. It can be used to
declare new attributes (exported vars) calculated with Perl
......
......@@ -44,6 +44,7 @@ example/imgs/plus_ar.gif
example/imgs/tombs.gif
example/imgs/tombs_mag.gif
example/lemonldap-ng-manager.js
example/lmConfig.mysql
example/index.pl
lib/Lemonldap/NG/Manager.pm
lib/Lemonldap/NG/Manager/_HTML.pm
......
......@@ -12,7 +12,7 @@ require Lemonldap::NG::Manager::Help;
our @ISA = qw(Lemonldap::NG::Manager::Base);
our $VERSION = '0.4';
our $VERSION = '0.41';
sub new {
my ( $class, $args ) = @_;
......
......@@ -5,6 +5,7 @@ package Lemonldap::NG::Manager::_HTML;
# comes for the first time.
use AutoLoader qw(AUTOLOAD);
require Lemonldap::NG::Manager::_i18n;
our $VERSION = '0.1';
1;
......@@ -68,6 +69,12 @@ EOT
sub javascript {
my $self = shift;
Lemonldap::NG::Manager::_i18n::import( $ENV{HTTP_ACCEPT_LANGUAGE} );
my %text;
foreach(qw(newVirtualHost newMacro newGroup newVar newGSOpt saveConf
deleteNode rules unableToSave confSaved saveFailure)) {
$text{$_} = &$_;
}
print <<EOT;
var s3,s32;
window.onload=function(){
......@@ -122,7 +129,7 @@ function onNodeSelect(nodeId) {
}
var but='';
if(nodeIs(nodeId,"virtualHosts")){
but+=button('Nouvel Hte Virtuel','newVirtualHost',nodeId);
but+=button('$text{newVirtualHost}','newVirtualHost',nodeId);
if(nodeIs(nodeId,"virtualHost")){
but+=button('Nouvelle rgle','newRule',nodeId);
but+=button('Nouvel en-tte','newHeader',nodeId);
......@@ -130,11 +137,11 @@ function onNodeSelect(nodeId) {
help('virtualHosts');
}
else if(nodeIs(nodeId,"macros")){
but+=button('Nouvelle macro','newMacro',nodeId);
but+=button('$text{newMacro}','newMacro',nodeId);
help('macros');
}
else if(nodeIs(nodeId,"groups")){
but+=button('Nouveau groupe','newGroup',nodeId);
but+=button('$text{newGroup}','newGroup',nodeId);
help('groups');
}
else if(nodeIs(nodeId,"generalParameters")){
......@@ -142,18 +149,18 @@ function onNodeSelect(nodeId) {
help('ldap');
}
else if(nodeIs(nodeId,"exportedVars")){
but+=button('Nouvelle variable','newVar',nodeId);
but+=button('$text{newVar}','newVar',nodeId);
help('vars');
}
else if(nodeIs(nodeId,'sessionStorage')){
if(nodeIs(nodeId,"globalStorageOptions")){
but+=button('Nouvelle option','newGSOpt',nodeId);
but+=button('$text{newGSOpt}','newGSOpt',nodeId);
}
help('storage');
}
}
if(tree.getUserData(nodeId,"modif")=='both') but+=button("Supprimer",'deleteNode',nodeId);
but+=button('Sauvegarder','saveConf');
if(tree.getUserData(nodeId,"modif")=='both') but+=button('$text{deleteNode}','deleteNode',nodeId);
but+=button('$text{saveConf}','saveConf');
document.getElementById('buttons').innerHTML = but;
}
......@@ -189,7 +196,7 @@ function newVirtualHost() {
insertNewChild(rep+'_exportedHeaders',rep+'_exportedHeaders_1','Auth-User');
tree.setUserData(rep+'_exportedHeaders_1','modif','both');
tree.setUserData(rep+'_exportedHeaders_1','value','\$uid');
insertNewChild(rep,rep+'_locationRules','Rgles');
insertNewChild(rep,rep+'_locationRules','$text{rules}');
insertNewChild(rep+'_locationRules',rep+'_locationRules_default','default');
tree.setUserData(rep+'_locationRules_default','modif','value');
tree.setUserData(rep+'_locationRules_default','value','deny');
......@@ -241,7 +248,7 @@ if(window.XMLHttpRequest) // Firefox
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else { // XMLHttpRequest non support par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest: sauvegarde impossible.");
alert('$text{unableToSave}');
}
function help(s){
......@@ -263,13 +270,13 @@ function saveConf(){
var r=xhr_object.responseText;
if(r>0) {
tree.setItemText('root','Configuration '+r);
document.getElementById('help').innerHTML='<h3>Configuration sauvegarde sous le numro : '+r+'</h3>';
document.getElementById('help').innerHTML='<h3>$text{confSaved} : '+r+'</h3>';
}
else {
document.getElementById('help').innerHTML='<h3>chec de la sauvegarde</h3>';
document.getElementById('help').innerHTML='<h3>$text{saveFailure}</h3>';
}
}
else document.getElementById('help').innerHTML='<h3>chec de la sauvegarde</h3>';
else document.getElementById('help').innerHTML='<h3>$text{saveFailure}</h3>';
}
xhr_object.send(h);
}
......
......@@ -26,10 +26,12 @@ sub import {
*en_us = *en;
1;
__END__
=pod
=cut
sub fr {
return {
configuration => 'Configuration',
......@@ -40,7 +42,7 @@ sub fr {
globalStorageOptions => 'Param&egrave;tres du module Apache::Session',
authParams => "Param&egrave;tres d'authentification",
userGroups => "Groupes d'utilisateurs",
macros => "Macros",
macros => "Macros",
virtualHosts => "H&ocirc;tes virtuels",
authenticationType => "Type d'authentification",
securedCookie => 'Cookie s&eacute;curis&eacute; (SSL)',
......@@ -55,17 +57,17 @@ sub fr {
httpHeaders => 'En-t&ecirc;tes HTTP',
locationRules => 'R&egrave;gles',
newVirtualHost => 'Nouvel h&ocric;te virtuel',
newMacro => 'Nouvelle macro',
newGroup => 'Nouveau groupe',
newVar => 'Nouvelle variable',
newGSOpt => 'Nouvelle option',
saveConf => 'Sauvegarder',
deleteNode => 'Supprimer',
rules => 'R&egrave;gles',
unableToSave => 'Votre navigateur ne supporte pas les objets XMLHTTPRequest: sauvegarde impossible.'
confSaved => 'Configuration sauvegarde sous le num&eacute;ro',
saveFailure => '&Eacute;chec de la sauvegarde',
newVirtualHost => 'Nouvel h&ocirc;te virtuel',
newMacro => 'Nouvelle macro',
newGroup => 'Nouveau groupe',
newVar => 'Nouvelle variable',
newGSOpt => 'Nouvelle option',
saveConf => 'Sauvegarder',
deleteNode => 'Supprimer',
rules => 'R&egrave;gles',
unableToSave => 'Votre navigateur ne supporte pas les objets XMLHTTPRequest: sauvegarde impossible.',
confSaved => 'Configuration sauvegarde sous le num&eacute;ro',
saveFailure => '&Eacute;chec de la sauvegarde',
};
}
......@@ -93,16 +95,16 @@ sub en {
httpHeaders => 'HTTP Headers',
locationRules => 'Rules',
newVirtualHost => 'New Virtual Host',
newMacro => 'New Macro',
newGroup => 'New Group',
newVar => 'New Variable',
newGSOpt => 'New Option',
saveConf => 'Save',
deleteNode => 'Delete',
rules => 'Rules',
unableToSave => 'Your browser does not support XMLHTTPRequest objects: fail to save.'
confSaved => 'Configuration saved with number',
saveFailure => 'Save failure',
newVirtualHost => 'New Virtual Host',
newMacro => 'New Macro',
newGroup => 'New Group',
newVar => 'New Variable',
newGSOpt => 'New Option',
saveConf => 'Save',
deleteNode => 'Delete',
rules => 'Rules',
unableToSave => 'Your browser does not support XMLHTTPRequest objects: fail to save.',
confSaved => 'Configuration saved with number',
saveFailure => 'Save failure',
};
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment