summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
Diffstat (limited to 'settings')
-rw-r--r--settings/ajax/changepassword.php12
-rw-r--r--settings/ajax/setlanguage.php26
-rw-r--r--settings/index.php7
-rw-r--r--settings/js/main.js14
-rw-r--r--settings/l10n/da.php19
-rw-r--r--settings/l10n/de.php19
-rw-r--r--settings/l10n/nl.php19
-rw-r--r--settings/l10n/pl.php19
-rw-r--r--settings/l10n/xgettextfiles3
-rw-r--r--settings/templates/index.php52
10 files changed, 165 insertions, 25 deletions
diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php
index 1a9ad73610e..f568d3ef876 100644
--- a/settings/ajax/changepassword.php
+++ b/settings/ajax/changepassword.php
@@ -3,33 +3,35 @@
// Init owncloud
require_once('../../lib/base.php');
+$l=new OC_L10N('settings');
+
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_USER::isLoggedIn()){
- echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t( "Authentication error" ) )));
exit();
}
// Get data
if( !isset( $_POST["password"] ) && !isset( $_POST["oldpassword"] )){
- echo json_encode( array( "status" => "error", "data" => array( "message" => "You have to enter the old and the new password!" )));
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t( "You have to enter the old and the new password!" ) )));
exit();
}
// Check if the old password is correct
if( !OC_USER::checkPassword( $_SESSION["user_id"], $_POST["oldpassword"] )){
- echo json_encode( array( "status" => "error", "data" => array( "message" => "Your old password is wrong!" )));
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Your old password is wrong!") )));
exit();
}
// Change password
if( OC_USER::setPassword( $_SESSION["user_id"], $_POST["password"] )){
- echo json_encode( array( "status" => "success", "data" => array( "message" => "Password changed" )));
+ echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Password changed") )));
}
else{
- echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to change password" )));
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Unable to change password") )));
}
?>
diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php
new file mode 100644
index 00000000000..bc467fb9004
--- /dev/null
+++ b/settings/ajax/setlanguage.php
@@ -0,0 +1,26 @@
+<?php
+
+// Init owncloud
+require_once('../../lib/base.php');
+
+$l=new OC_L10N('settings');
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+// Check if we are a user
+if( !OC_USER::isLoggedIn()){
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Authentication error") )));
+ exit();
+}
+
+// Get data
+if( isset( $_POST['lang'] ) ){
+ $lang=$_POST['lang'];
+ OC_PREFERENCES::setValue( OC_USER::getUser(), 'core', 'lang', $lang );
+ echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Language changed") )));
+}else{
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") )));
+}
+
+?>
diff --git a/settings/index.php b/settings/index.php
index 1a442eca811..07adba142d6 100644
--- a/settings/index.php
+++ b/settings/index.php
@@ -18,11 +18,18 @@ $free=OC_FILESYSTEM::free_space();
$total=$free+$used;
$relative=round(($used/$total)*100);
+$lang=OC_PREFERENCES::getValue( OC_USER::getUser(), 'core', 'lang', 'en' );
+$languages=OC_L10N::findAvailableLanguages();
+//put the current language in the front
+unset($languages[array_search($lang,$languages)]);
+array_unshift($languages,$lang);
+
// Return template
$tmpl = new OC_TEMPLATE( "settings", "index", "admin");
$tmpl->assign('usage',OC_HELPER::humanFileSize($used));
$tmpl->assign('total_space',OC_HELPER::humanFileSize($total));
$tmpl->assign('usage_relative',$relative);
+$tmpl->assign('languages',$languages);
$tmpl->printPage();
?>
diff --git a/settings/js/main.js b/settings/js/main.js
index e05fc68743c..010225bcb27 100644
--- a/settings/js/main.js
+++ b/settings/js/main.js
@@ -18,4 +18,18 @@ $(document).ready(function(){
});
return false;
});
+
+ $("#languageinput").change( function(){
+ // Serialize the data
+ var post = $( "#languageinput" ).serialize();
+ // Ajax foo
+ $.post( 'ajax/setlanguage.php', post, function(data){
+ if( data.status == "success" ){
+ }
+ else{
+ $('#passworderror').html( data.data.message );
+ }
+ });
+ return false;
+ });
} );
diff --git a/settings/l10n/da.php b/settings/l10n/da.php
new file mode 100644
index 00000000000..37a56f2f64c
--- /dev/null
+++ b/settings/l10n/da.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"Account information" => "Konto information",
+"You're currently using" => "Du udnytter i øjeblikket",
+"of your" => "af din",
+"space" => "plads",
+"Change Password" => "Ændre adgangskode",
+"Your password got changed" => "Din adgangskode er ændret",
+"Old password:" => "Gamle adgangskode",
+"New password" => "Nye adgangskode",
+"Show new password" => "Vis den nye adgangskode",
+"Language" => "Sprog",
+"Authentication error" => "Godkendelsesfejl",
+"You have to enter the old and the new password!" => "Du skal indtaste din gamle og nye adganskode",
+"Your old password is wrong!" => "Din gamle adgangskode er forkert!",
+"Password changed" => "Adgangskoden er ændret",
+"Unable to change password" => "Kan ikke ændre din adgangskode",
+"Language changed" => "Sprog ændret",
+"Invalid request" => "Invalid forespørgsel"
+);
diff --git a/settings/l10n/de.php b/settings/l10n/de.php
new file mode 100644
index 00000000000..e3be20de33e
--- /dev/null
+++ b/settings/l10n/de.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"Account information" => "Konto-Information",
+"You're currently using" => "Du benutzt gerade",
+"of your" => "von deinem",
+"space" => "Speicherplatz",
+"Change Password" => "Passwort ändern",
+"Your password got changed" => "Dein Passwort wurde geändert.",
+"Old password:" => "Aktuelles Passwort:",
+"New password" => "Neues Passwort:",
+"Show new password" => "Neues Passwort anzeigen",
+"Language" => "Sprache",
+"Authentication error" => "Berechtigungsfehler",
+"You have to enter the old and the new password!" => "Du musst das aktuelle und ein neues Passwort angeben!",
+"Your old password is wrong!" => "Du hast dein aktuelles Passwort falsch eingegeben!",
+"Password changed" => "Passwort geändert",
+"Unable to change password" => "Passwort konnte nicht geändert werden",
+"Language changed" => "Sprache geändert",
+"Invalid request" => "Ungültige Anfrage"
+);
diff --git a/settings/l10n/nl.php b/settings/l10n/nl.php
new file mode 100644
index 00000000000..3c2f3dbd271
--- /dev/null
+++ b/settings/l10n/nl.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"Account information" => "Gebruikersgegevens",
+"You're currently using" => "U gebruikt momenteel",
+"of your" => "van de",
+"space" => "beschikbare ruimte.",
+"Change Password" => "Wachtwoord aanpassen",
+"Your password got changed" => "Uw wachtwoord is aangepast",
+"Old password:" => "Oud wachtwoord:",
+"New password" => "Nieuw wachtwoord",
+"Show new password" => "Toon nieuw wachtwoord",
+"Language" => "Taal",
+"Authentication error" => "Authenticatiefout.",
+"You have to enter the old and the new password!" => "U moet het oude en nieuwe wachtwoord invullen.",
+"Your old password is wrong!" => "Het oude wachtwoord is verkeerd.",
+"Password changed" => "Wachtwoord aangepast",
+"Unable to change password" => "Wachtwoord aanpassen is niet mogelijk",
+"Language changed" => "Taal aangepast",
+"Invalid request" => "Ongeldig verzoek"
+);
diff --git a/settings/l10n/pl.php b/settings/l10n/pl.php
new file mode 100644
index 00000000000..b65fdd15b4d
--- /dev/null
+++ b/settings/l10n/pl.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"Account information" => "Dane konta",
+"You're currently using" => "Obecnie używasz",
+"of your" => "ze swoich",
+"space" => "przestrzeni",
+"Change Password" => "Zmień hasło",
+"Your password got changed" => "Twoje hasło zostało zmienione",
+"Old password:" => "Stare hasło",
+"New password" => "Nowe hasło",
+"Show new password" => "Pokaż nowe hasło",
+"Language" => "Język",
+"Authentication error" => "Błąd uwierzytelniania",
+"You have to enter the old and the new password!" => "Musisz wprowadzić zarówno stare, jak i nowe hasło!",
+"Your old password is wrong!" => "Twoje stare hasło jest błędne!",
+"Password changed" => "Hasło zmienione",
+"Unable to change password" => "NIe można zmienić hasła",
+"Language changed" => "Język zmieniony",
+"Invalid request" => "Nieprawidłowe żądanie"
+);
diff --git a/settings/l10n/xgettextfiles b/settings/l10n/xgettextfiles
new file mode 100644
index 00000000000..8a2f185f230
--- /dev/null
+++ b/settings/l10n/xgettextfiles
@@ -0,0 +1,3 @@
+../templates/index.php
+../ajax/changepassword.php
+../ajax/setlanguage.php \ No newline at end of file
diff --git a/settings/templates/index.php b/settings/templates/index.php
index 2d5e9d9140f..761289acefa 100644
--- a/settings/templates/index.php
+++ b/settings/templates/index.php
@@ -1,30 +1,42 @@
<form id="quota">
<fieldset>
- <legend>Account information</legend>
+ <legend><?php echo $l->t( 'Account information' );?></legend>
<div id="quota_indicator"><div style="width:<?php echo $_['usage_relative'] ?>%;">&nbsp;</div></div>
- <p>You're currently using <?php echo $_['usage_relative'] ?>% (<?php echo $_['usage'] ?>) of your <?php echo $_['total_space'] ?> space.</p>
+ <p><?php echo $l->t( 'You\'re currently using' );?> <?php echo $_['usage_relative'] ?>% (<?php echo $_['usage'] ?>) <?php echo $l->t( 'of your' );?> <?php echo $_['total_space'] ?> <?php echo $l->t( 'space' );?>.</p>
</fieldset>
</form>
<form id="passwordform">
<fieldset>
- <legend>Change Password</legend>
- <div id="passwordchanged">You're password got changed</div>
- <div id="passworderror"></div>
- <p>
- <label for="pass1">Old password:</label>
- <input type="password" id="pass1" name="oldpassword" />
- </p>
- <p>
- <label for="pass2">New password :</label>
- <input type="password" id="pass2" name="password" />
- </p>
- <p>
- <input type="checkbox" id="show" name="show" />
- <label for="show">Show new password</label>
- </p>
- <p class="form_footer">
- <input id="passwordbutton" class="prettybutton" type="submit" value="Save" />
- </p>
+ <legend><?php echo $l->t( 'Change Password' );?></legend>
+ <div id="passwordchanged"><?php echo $l->t( 'Your password got changed');?></div>
+ <div id="passworderror"></div>
+ <p>
+ <label for="pass1"><?php echo $l->t( 'Old password:' );?></label>
+ <input type="password" id="pass1" name="oldpassword" />
+ </p>
+ <p>
+ <label for="pass2"><?php echo $l->t( 'New password' );?></label>
+ <input type="password" id="pass2" name="password" />
+ </p>
+ <p>
+ <input type="checkbox" id="show" name="show" />
+ <label for="show"><?php echo $l->t( 'Show new password' );?></label>
+ </p>
+ <p class="form_footer">
+ <input id="passwordbutton" class="prettybutton" type="submit" value="Save" />
+ </p>
+ </fieldset>
+</form>
+
+<form id="languageform">
+ <fieldset>
+ <legend><?php echo $l->t( 'Language' );?></legend>
+ <label for=''></label>
+ <select id="languageinput" name='lang'>
+ <?php foreach($_['languages'] as $language):?>
+ <option value='<?php echo $language;?>'><?php echo $language;?></option>
+ <?php endforeach;?>
+ </select>
</fieldset>
</form>