mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 15:27:17 +00:00

There are certain application messages that should be re-used between the CLI and the GUI. In order to allow such re-usability, we extract out the application messages used in JavaScript into `lib/shared/messages.js` as a collection of Lodash `_.template` templates. Notice this file doesn't include application messages included in Angular templates directly since it'd be hard to refactor all of them. We plan to move to React soon, which will allow moving the remaining messages very easily. Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
87 lines
2.1 KiB
JavaScript
87 lines
2.1 KiB
JavaScript
/*
|
|
* Copyright 2016 resin.io
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
|
|
/**
|
|
* @summary Application messages
|
|
* @namespace messages
|
|
* @public
|
|
*/
|
|
module.exports = {
|
|
|
|
/**
|
|
* @summary Informational messages
|
|
* @namespace info
|
|
* @memberof messages
|
|
*/
|
|
info: {
|
|
|
|
flashComplete: _.template('Your flash is complete!')
|
|
|
|
},
|
|
|
|
/**
|
|
* @summary Warning messages
|
|
* @namespace warning
|
|
* @memberof messages
|
|
*/
|
|
warning: {
|
|
|
|
unrecommendedDriveSize: _.template([
|
|
'This image recommends a <%= image.recommendedDriveSize %>',
|
|
'bytes drive, however <%= drive.device %> is only <%= drive.size %> bytes.'
|
|
].join(' ')),
|
|
|
|
exitWhileFlashing: _.template([
|
|
'You are currently flashing a drive. Closing Etcher may leave',
|
|
'your drive in an unusable state.\n\n',
|
|
'Are you sure you want to close Etcher?'
|
|
].join(' '))
|
|
|
|
},
|
|
|
|
/**
|
|
* @summary Error messages
|
|
* @namespace error
|
|
* @memberof messages
|
|
*/
|
|
error: {
|
|
|
|
notEnoughSpaceInDrive: _.template([
|
|
'Not enough space on the drive.',
|
|
'Please insert larger one and try again.'
|
|
].join(' ')),
|
|
|
|
genericFlashError: _.template('Oops, seems something went wrong.'),
|
|
|
|
validation: _.template([
|
|
'Your removable drive may be corrupted.',
|
|
'Try inserting a different one and try again.'
|
|
].join(' ')),
|
|
|
|
invalidImage: _.template('<%= image.path %> is not a supported image type.'),
|
|
|
|
elevationRequired: _.template('This should should be run with root/administrator permissions.'),
|
|
|
|
flashFailure: _.template('Looks like your flash has failed!')
|
|
|
|
}
|
|
|
|
};
|