make personal settings translatable

This commit is contained in:
Robin Appelman 2011-06-20 14:51:33 +02:00
parent 76b12c4ae0
commit 4c1d3155a3
5 changed files with 109 additions and 16 deletions

View File

@ -3,33 +3,35 @@
// Init owncloud // Init owncloud
require_once('../../lib/base.php'); require_once('../../lib/base.php');
$l=new OC_L10N('settings');
// We send json data // We send json data
header( "Content-Type: application/jsonrequest" ); header( "Content-Type: application/jsonrequest" );
// Check if we are a user // Check if we are a user
if( !OC_USER::isLoggedIn()){ 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(); exit();
} }
// Get data // Get data
if( !isset( $_POST["password"] ) && !isset( $_POST["oldpassword"] )){ 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(); exit();
} }
// Check if the old password is correct // Check if the old password is correct
if( !OC_USER::checkPassword( $_SESSION["user_id"], $_POST["oldpassword"] )){ 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(); exit();
} }
// Change password // Change password
if( OC_USER::setPassword( $_SESSION["user_id"], $_POST["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{ 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") )));
} }
?> ?>

View File

@ -3,12 +3,14 @@
// Init owncloud // Init owncloud
require_once('../../lib/base.php'); require_once('../../lib/base.php');
$l=new OC_L10N('settings');
// We send json data // We send json data
header( "Content-Type: application/jsonrequest" ); header( "Content-Type: application/jsonrequest" );
// Check if we are a user // Check if we are a user
if( !OC_USER::isLoggedIn()){ 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(); exit();
} }
@ -16,9 +18,9 @@ if( !OC_USER::isLoggedIn()){
if( isset( $_POST['lang'] ) ){ if( isset( $_POST['lang'] ) ){
$lang=$_POST['lang']; $lang=$_POST['lang'];
OC_PREFERENCES::setValue( $_SESSION['user_id'], 'core', 'lang', $lang ); OC_PREFERENCES::setValue( $_SESSION['user_id'], 'core', 'lang', $lang );
echo json_encode( array( "status" => "success", "data" => array( "message" => "Language changed" ))); echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Language changed") )));
}else{ }else{
echo json_encode( array( "status" => "error", "data" => array( "message" => "Invalid request" ))); echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") )));
} }
?> ?>

View File

@ -0,0 +1,86 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-06-20 14:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../templates/index.php:3
msgid "Account information"
msgstr ""
#: ../templates/index.php:5
msgid "You're currently using"
msgstr ""
#: ../templates/index.php:5
msgid "of your"
msgstr ""
#: ../templates/index.php:5
msgid "space"
msgstr ""
#: ../templates/index.php:11
msgid "Change Password"
msgstr ""
#: ../templates/index.php:12
msgid "Your password got changed"
msgstr ""
#: ../templates/index.php:15
msgid "Old password:"
msgstr ""
#: ../templates/index.php:19
msgid "New password"
msgstr ""
#: ../templates/index.php:24
msgid "Show new password"
msgstr ""
#: ../templates/index.php:34
msgid "Language"
msgstr ""
#: ../ajax/changepassword.php:13 ../ajax/setlanguage.php:13
msgid "Authentication error"
msgstr ""
#: ../ajax/changepassword.php:19
msgid "You have to enter the old and the new password!"
msgstr ""
#: ../ajax/changepassword.php:25
msgid "Your old password is wrong!"
msgstr ""
#: ../ajax/changepassword.php:31
msgid "Password changed"
msgstr ""
#: ../ajax/changepassword.php:34
msgid "Unable to change password"
msgstr ""
#: ../ajax/setlanguage.php:21
msgid "Language changed"
msgstr ""
#: ../ajax/setlanguage.php:23
msgid "Invalid request"
msgstr ""

View File

@ -0,0 +1,3 @@
../templates/index.php
../ajax/changepassword.php
../ajax/setlanguage.php

View File

@ -1,27 +1,27 @@
<form id="quota"> <form id="quota">
<fieldset> <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> <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> </fieldset>
</form> </form>
<form id="passwordform"> <form id="passwordform">
<fieldset> <fieldset>
<legend>Change Password</legend> <legend><?php echo $l->t( 'Change Password' );?></legend>
<div id="passwordchanged">You're password got changed</div> <div id="passwordchanged"><?php echo $l->t( 'Your password got changed');?></div>
<div id="passworderror"></div> <div id="passworderror"></div>
<p> <p>
<label for="pass1">Old password:</label> <label for="pass1"><?php echo $l->t( 'Old password:' );?></label>
<input type="password" id="pass1" name="oldpassword" /> <input type="password" id="pass1" name="oldpassword" />
</p> </p>
<p> <p>
<label for="pass2">New password :</label> <label for="pass2"><?php echo $l->t( 'New password' );?></label>
<input type="password" id="pass2" name="password" /> <input type="password" id="pass2" name="password" />
</p> </p>
<p> <p>
<input type="checkbox" id="show" name="show" /> <input type="checkbox" id="show" name="show" />
<label for="show">Show new password</label> <label for="show"><?php echo $l->t( 'Show new password' );?></label>
</p> </p>
<p class="form_footer"> <p class="form_footer">
<input id="passwordbutton" class="prettybutton" type="submit" value="Save" /> <input id="passwordbutton" class="prettybutton" type="submit" value="Save" />
@ -31,7 +31,7 @@
<form id="languageform"> <form id="languageform">
<fieldset> <fieldset>
<legend>Language</legend> <legend><?php echo $l->t( 'Language' );?></legend>
<label for=''></label> <label for=''></label>
<select id="languageinput" name='lang'> <select id="languageinput" name='lang'>
<?php foreach($_['languages'] as $language):?> <?php foreach($_['languages'] as $language):?>