From 488ab0dba2bc6d48968255943edaef7174757308 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Thu, 7 Feb 2013 16:17:54 +0100 Subject: [PATCH 1/4] l10n support enhanced in files_version --- apps/files_versions/ajax/rollbackVersion.php | 3 ++- apps/files_versions/history.php | 19 +++++++++++++------ apps/files_versions/templates/history.php | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php index dc5a59cb4a..216051dbcb 100644 --- a/apps/files_versions/ajax/rollbackVersion.php +++ b/apps/files_versions/ajax/rollbackVersion.php @@ -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", $file )))); } diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php index 1bd5cde44b..437a3fec06 100644 --- a/apps/files_versions/history.php +++ b/apps/files_versions/history.php @@ -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') ); } diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php index cc5a494f19..850ece89c9 100644 --- a/apps/files_versions/templates/history.php +++ b/apps/files_versions/templates/history.php @@ -17,7 +17,7 @@ if( isset( $_['message'] ) ) { } echo( 'Versions of '.$_['path'] ).'
'; - echo('

Revert a file to a previous version by clicking on its revert button


'); + echo('

'.$l->t('Revert a file to a previous version by clicking on its revert button').'


'); foreach ( $_['versions'] as $v ) { echo ' '; From 18a288a3c3612db731e13d38da5786e622d6e9ec Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Thu, 7 Feb 2013 16:31:04 +0100 Subject: [PATCH 2/4] l10n support enhanced in files_trashbin --- apps/files_trashbin/ajax/delete.php | 3 ++- apps/files_trashbin/ajax/undelete.php | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php index 7ea0155724..7a6bd1342e 100644 --- a/apps/files_trashbin/ajax/delete.php +++ b/apps/files_trashbin/ajax/delete.php @@ -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))))); } diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php index a118d003de..cc010979c5 100644 --- a/apps/files_trashbin/ajax/undelete.php +++ b/apps/files_trashbin/ajax/undelete.php @@ -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))); } - From e0212c11747423abc3720901cf69e69171aa5f9d Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Thu, 7 Feb 2013 16:34:57 +0100 Subject: [PATCH 3/4] l10n support enhanced in files_versions --- apps/files_versions/ajax/rollbackVersion.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php index 216051dbcb..2970915ac6 100644 --- a/apps/files_versions/ajax/rollbackVersion.php +++ b/apps/files_versions/ajax/rollbackVersion.php @@ -12,6 +12,6 @@ if(OCA\Files_Versions\Storage::rollback( $file, $revision )) { OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file ))); }else{ $l = OC_L10N::get('files_versions'); - OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", $file )))); + OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) )))); } From 5f92d269dc83762bbf200158149eec1e605c98a6 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Thu, 7 Feb 2013 16:49:36 +0100 Subject: [PATCH 4/4] l10n support enhanced in core --- core/ajax/vcategories/add.php | 2 +- core/ajax/vcategories/removeFromFavorites.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/ajax/vcategories/add.php b/core/ajax/vcategories/add.php index 23d00af70a..16a1461be0 100644 --- a/core/ajax/vcategories/add.php +++ b/core/ajax/vcategories/add.php @@ -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); } diff --git a/core/ajax/vcategories/removeFromFavorites.php b/core/ajax/vcategories/removeFromFavorites.php index ba6e95c249..78a528caa8 100644 --- a/core/ajax/vcategories/removeFromFavorites.php +++ b/core/ajax/vcategories/removeFromFavorites.php @@ -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();