Merge pull request #1526 from owncloud/l10n-support-master

L10n support master
This commit is contained in:
Lukas Reschke 2013-02-07 12:38:36 -08:00
commit c0154558c7
7 changed files with 25 additions and 14 deletions

View File

@ -18,6 +18,7 @@ if ($path_parts['dirname'] == '.') {
if (OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp)) {
OCP\JSON::success(array("data" => array("filename" => $file)));
} else {
OCP\JSON::error(array("data" => array("message" => "Couldn't delete ".$file. " permanently")));
$l = OC_L10N::get('files_trashbin');
OCP\JSON::error(array("data" => array("message" => $l->t("Couldn't delete %s permanently", array($file)))));
}

View File

@ -37,8 +37,10 @@ if ( $error ) {
foreach ( $error as $e ) {
$filelist .= $e.', ';
}
OCP\JSON::error(array("data" => array("message" => "Couldn't restore ".rtrim($filelist,', '), "success" => $success, "error" => $error)));
$l = OC_L10N::get('files_trashbin');
$message = $l->t("Couldn't restore %s", array(rtrim($filelist,', ')));
OCP\JSON::error(array("data" => array("message" => $message,
"success" => $success, "error" => $error)));
} else {
OCP\JSON::success(array("data" => array("success" => $success)));
}

View File

@ -11,6 +11,7 @@ $revision=(int)$_GET['revision'];
if(OCA\Files_Versions\Storage::rollback( $file, $revision )) {
OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
}else{
OCP\JSON::error(array("data" => array( "message" => "Could not revert:" . $file )));
$l = OC_L10N::get('files_versions');
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) ))));
}

View File

@ -24,6 +24,7 @@
OCP\User::checkLoggedIn( );
OCP\Util::addStyle('files_versions', 'versions');
$tmpl = new OCP\Template( 'files_versions', 'history', 'user' );
$l = OC_L10N::get('files_versions');
if ( isset( $_GET['path'] ) ) {
@ -36,15 +37,21 @@ if ( isset( $_GET['path'] ) ) {
if( $versions->rollback( $path, $_GET['revert'] ) ) {
$tmpl->assign( 'outcome_stat', 'success' );
$tmpl->assign( 'outcome_stat', $l->t('success') );
$tmpl->assign( 'outcome_msg', "File {$_GET['path']} was reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) );
$message = $l->t('File %s was reverted to version %s',
array($_GET['path'], OCP\Util::formatDate( doubleval($_GET['revert']) ) ) );
$tmpl->assign( 'outcome_msg', $message);
} else {
$tmpl->assign( 'outcome_stat', 'failure' );
$tmpl->assign( 'outcome_stat', $l->t('failure') );
$tmpl->assign( 'outcome_msg', "File {$_GET['path']} could not be reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) );
$message = $l->t('File %s could not be reverted to version %s',
array($_GET['path'], OCP\Util::formatDate( doubleval($_GET['revert']) ) ) );
$tmpl->assign( 'outcome_msg', $message);
}
@ -58,12 +65,12 @@ if ( isset( $_GET['path'] ) ) {
}else{
$tmpl->assign( 'message', 'No old versions available' );
$tmpl->assign( 'message', $l->t('No old versions available') );
}
}else{
$tmpl->assign( 'message', 'No path specified' );
$tmpl->assign( 'message', $l->t('No path specified') );
}

View File

@ -17,7 +17,7 @@ if( isset( $_['message'] ) ) {
}
echo( '<strong>Versions of '.$_['path'] ).'</strong><br>';
echo('<p><em>Revert a file to a previous version by clicking on its revert button</em></p><br />');
echo('<p><em>'.$l->t('Revert a file to a previous version by clicking on its revert button').'</em></p><br />');
foreach ( $_['versions'] as $v ) {
echo ' ';

View File

@ -34,7 +34,7 @@ debug(print_r($category, true));
$categories = new OC_VCategories($type);
if($categories->hasCategory($category)) {
bailOut(OC_Contacts_App::$l10n->t('This category already exists: '.$category));
bailOut($l->t('This category already exists: %s', array($category)));
} else {
$categories->add($category, true);
}

View File

@ -27,12 +27,12 @@ if(is_null($type)) {
}
if(is_null($id)) {
bailOut($l->t('%s ID not provided.', $type));
bailOut($l->t('%s ID not provided.', array($type)));
}
$categories = new OC_VCategories($type);
if(!$categories->removeFromFavorites($id, $type)) {
bailOut($l->t('Error removing %s from favorites.', $id));
bailOut($l->t('Error removing %s from favorites.', array($id)));
}
OC_JSON::success();