Added translations (en+fr)

This commit is contained in:
colymba 2013-06-23 19:10:22 +03:00
parent 9bc46687b1
commit 88cf826322
10 changed files with 58 additions and 17 deletions

View File

@ -166,8 +166,7 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
}
$bulkUploadBtn = new ArrayData(array(
'Link' => $gridField->Link('bulkimageupload'),
'Label' => 'Bulk Upload',
'Link' => $gridField->Link('bulkimageupload')
));
return array(

View File

@ -190,7 +190,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
$actions = new FieldList();
$actions->push(
FormAction::create('Finish', 'Finish')
FormAction::create('Finish', _t('GridFieldBulkTools.FINISH_BTN_LABEL', 'Finish'))
->setAttribute('id', 'bulkImageUploadFinishBtn')
->addExtraClass('cms-panel-link')
->setAttribute('data-icon', 'accept')
@ -200,7 +200,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
);
$actions->push(
FormAction::create('SaveAll', 'Save All')
FormAction::create('SaveAll', _t('GridFieldBulkTools.SAVE_BTN_LABEL', 'Save All'))
->setAttribute('id', 'bulkImageUploadUpdateBtn')
->addExtraClass('ss-ui-action-constructive')
->setAttribute('data-icon', 'accept')
@ -210,7 +210,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
);
$actions->push(
FormAction::create('Cancel', 'Cancel & Delete All')
FormAction::create('Cancel', _t('GridFieldBulkTools.CANCEL_BTN_LABEL', 'Cancel & Delete All'))
->setAttribute('id', 'bulkImageUploadUpdateCancelBtn')
->addExtraClass('ss-ui-action-destructive')
->setAttribute('data-icon', 'decline')
@ -297,6 +297,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload.js');
Requirements::css(BULK_EDIT_TOOLS_PATH . '/css/GridFieldBulkImageUpload.css');
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload_downloadtemplate.js');
Requirements::add_i18n_javascript(BULK_EDIT_TOOLS_PATH . '/javascript/lang');
if($request->isAjax())
{

View File

@ -170,19 +170,23 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkManager.js');
$dropDownActionList = DropdownField::create('bulkActionName', '')
->setSource( array('edit' => 'Edit','unlink' => 'UnLink','delete' => 'Delete') )
->setSource( array(
'edit' => _t('GridFieldBulkTools.EDIT_SELECT_LABEL', 'Edit'),
'unlink' => _t('GridFieldBulkTools.UNLINK_SELECT_LABEL', 'UnLink'),
'delete' => _t('GridFieldBulkTools.DELETE_SELECT_LABEL', 'Delete')
))
->setAttribute('class', 'bulkActionName')
->setAttribute('id', '');
$templateData = new ArrayData(array(
'Menu' => $dropDownActionList->FieldHolder(),
'Button' => array(
'Label' => 'Go',
'Label' => _t('GridFieldBulkTools.ACTION_BTN_LABEL', 'Go'),
'Link' => $gridField->Link('bulkediting').'/edit',
'DataURL' => $gridField->Link('bulkediting')
),
'Select' => array(
'Label' => 'Select all'
'Label' => _t('GridFieldBulkTools.SELECT_ALL_LABEL', 'Select all')
)
));

View File

@ -68,7 +68,7 @@ class GridFieldBulkManager_Request extends RequestHandler {
$actions = new FieldList();
$actions->push(
FormAction::create('SaveAll', 'Save All')
FormAction::create('SaveAll', _t('GridFieldBulkTools.SAVE_BTN_LABEL', 'Save All'))
->setAttribute('id', 'bulkEditingUpdateBtn')
->addExtraClass('ss-ui-action-constructive cms-panel-link')
->setAttribute('data-icon', 'accept')
@ -90,7 +90,7 @@ class GridFieldBulkManager_Request extends RequestHandler {
} */
$actions->push(
FormAction::create('Cancel', 'Cancel & Delete All')
FormAction::create('Cancel', _t('GridFieldBulkTools.CANCEL_BTN_LABEL', 'Cancel & Delete All'))
->setAttribute('id', 'bulkEditingUpdateCancelBtn')
->addExtraClass('ss-ui-action-destructive cms-panel-link')
->setAttribute('data-icon', 'decline')

View File

@ -95,10 +95,7 @@
if ( formsWithUpadtes > 0 )
{
confirmed = confirm(
"You have unsaved changes. Continuing will loose all unsaved data.\n\n" +
"Do your really want to continue?"
);
confirmed = confirm( ss.i18n._t('GridFieldBulkTools.FINISH_CONFIRM') );
}
if (confirmed)
@ -139,7 +136,7 @@
$(this).addClass('hasUpdate');
}
$(itemStatus).removeClass('updated').addClass('dirty').html('Changed');
$(itemStatus).removeClass('updated').addClass('dirty').html(ss.i18n._t('GridFieldBulkTools.EDIT_CHANGED'));
if ( $(itemInfo).hasClass('updated') ) $(itemInfo).removeClass('updated');
if ( !$(itemInfo).hasClass('dirty') ) $(itemInfo).addClass('dirty');
@ -228,7 +225,7 @@
$(btn).data('completedForms', counter);
$(this).removeClass('hasUpdate');
$(this).parents('li').find('.ss-uploadfield-item-status').removeClass('dirty').addClass('updated').html('Updated');
$(this).parents('li').find('.ss-uploadfield-item-status').removeClass('dirty').addClass('updated').html(ss.i18n._t('GridFieldBulkTools.EDIT_UPDATED'));
$(this).parents('li').find('.ss-uploadfield-item-info').removeClass('dirty').addClass('updated');
$(this).parents('li').find('.ss-uploadfield-item-editform').css('display', 'none');

9
javascript/lang/en_US.js Normal file
View File

@ -0,0 +1,9 @@
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
console.error('Class ss.i18n not defined');
} else {
ss.i18n.addDictionary('en_US', {
'GridFieldBulkTools.FINISH_CONFIRM': "You have unsaved changes. Continuing will loose all unsaved data.\n\nDo your really want to continue?",
'GridFieldBulkTools.EDIT_CHANGED': 'Modified',
'GridFieldBulkTools.EDIT_UPDATED': 'Saved'
});
}

9
javascript/lang/fr_FR.js Normal file
View File

@ -0,0 +1,9 @@
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
console.error('Class ss.i18n not defined');
} else {
ss.i18n.addDictionary('fr_FR', {
'GridFieldBulkTools.FINISH_CONFIRM': "Vous avez des changements non enregistrés. En continuant vous allez perdre toutes vos données non enregistrées.\n\nVoulez-vous vraiment continuer?",
'GridFieldBulkTools.EDIT_CHANGED': 'Changé',
'GridFieldBulkTools.EDIT_UPDATED': 'Enregisté'
});
}

11
lang/en.yml Normal file
View File

@ -0,0 +1,11 @@
en:
GridFieldBulkTools:
BULK_UPLOAD_BTN_LABEL: Bulk Upload
FINISH_BTN_LABEL: Finish
SAVE_BTN_LABEL: Save All
CANCEL_BTN_LABEL: Cancel & Delete All
EDIT_SELECT_LABEL: Edit
UNLINK_SELECT_LABEL: Unlink
DELETE_SELECT_LABEL: Delete
ACTION_BTN_LABEL: Go
SELECT_ALL_LABEL: Select all

11
lang/fr.yml Normal file
View File

@ -0,0 +1,11 @@
fr:
GridFieldBulkTools:
BULK_UPLOAD_BTN_LABEL: Upload groupé
FINISH_BTN_LABEL: Terminer
SAVE_BTN_LABEL: Enregistrer tout
CANCEL_BTN_LABEL: Annuler & supprimer tout
EDIT_SELECT_LABEL: Editer
UNLINK_SELECT_LABEL: Retirer
DELETE_SELECT_LABEL: Supprimer
ACTION_BTN_LABEL: Go
SELECT_ALL_LABEL: Sélectionner tout

View File

@ -1,3 +1,3 @@
<a id="bulkImageUploadGFButton" href="$Link" class="cms-panel-link ss-ui-action-constructive ss-ui-button" data-icon="drive-upload">
$Label
<%t GridFieldBulkTools.BULK_UPLOAD_BTN_LABEL "Bulk Upload" %>
</a>