]> source.dussan.org Git - nextcloud-server.git/commitdiff
make personal settings translatable
authorRobin Appelman <icewind1991@gmail.com>
Mon, 20 Jun 2011 12:51:33 +0000 (14:51 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Mon, 20 Jun 2011 12:51:33 +0000 (14:51 +0200)
settings/ajax/changepassword.php
settings/ajax/setlanguage.php
settings/l10n/messages.pot [new file with mode: 0644]
settings/l10n/xgettextfiles [new file with mode: 0644]
settings/templates/index.php

index 1a9ad73610eea2aceb7ff66a8da6248b83f7b308..f568d3ef876c4b2158169201ba44220e5553dab6 100644 (file)
@@ -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") )));
 }
 
 ?>
index 672836afe0f4fbefd48fae0c8b62078e97443786..f971806f4c6f28a0da66437078ce9f4f429e31f2 100644 (file)
@@ -3,12 +3,14 @@
 // 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();
 }
 
@@ -16,9 +18,9 @@ if( !OC_USER::isLoggedIn()){
 if( isset( $_POST['lang'] ) ){
        $lang=$_POST['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{
-       echo json_encode( array( "status" => "error", "data" => array( "message" => "Invalid request" )));
+       echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") )));
 }
 
 ?>
diff --git a/settings/l10n/messages.pot b/settings/l10n/messages.pot
new file mode 100644 (file)
index 0000000..705d583
--- /dev/null
@@ -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 ""
diff --git a/settings/l10n/xgettextfiles b/settings/l10n/xgettextfiles
new file mode 100644 (file)
index 0000000..8a2f185
--- /dev/null
@@ -0,0 +1,3 @@
+../templates/index.php
+../ajax/changepassword.php
+../ajax/setlanguage.php
\ No newline at end of file
index f8ef9faf1d7f891f4943c397cca2d5c3fdf35410..761289acefaaf9a9564a20028b2588595187b5e4 100644 (file)
@@ -1,27 +1,27 @@
 <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>
+               <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">Old password:</label>
+                       <label for="pass1"><?php echo $l->t( 'Old password:' );?></label>
                        <input type="password" id="pass1" name="oldpassword" />
                </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" />
                </p>
                <p>
                        <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 class="form_footer">
                        <input id="passwordbutton" class="prettybutton" type="submit" value="Save" />
@@ -31,7 +31,7 @@
 
 <form id="languageform">
        <fieldset>
-               <legend>Language</legend>
+               <legend><?php echo $l->t( 'Language' );?></legend>
                <label for=''></label>
                <select id="languageinput" name='lang'>
                        <?php foreach($_['languages'] as $language):?>