Skip to content

Firefly III: a personal finances manager

Prep for translations in JS.

James Coled287ae97f87b
diff --git a/public/js/ff/import/status.js b/public/js/ff/import/status.js
index a312dd6b8c..5cb6abb39e 100644
--- a/public/js/ff/import/status.js
+++ b/public/js/ff/import/status.js
@@ -5,7 +5,7 @@
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
-/* globals $, jobImportUrl, jobStartUrl, token */
+/* globals $, jobImportUrl, jobStartUrl, token, langImportMultiError, langImportSingleError */
var startedImport = false;
@@ -57,13 +57,15 @@ function updateBar(data) {
function reportErrors(data) {
"use strict";
if (data.errors.length == 1) {
- $('#import-status-error-intro').text('An error has occured during the import. The import can continue, however.');
+ $('#import-status-error-intro').text(langImportSingleError);
+ //'An error has occured during the import. The import can continue, however.'
}
if (data.errors.length > 1) {
- $('#import-status-error-intro').text('Errors have occured during the import. The import can continue, however.');
+ // 'Errors have occured during the import. The import can continue, however.'
+ $('#import-status-error-intro').text(langImportMultiError);
}
- // fill the list:
+ // fill the list with error texts
$('#import-status-error-list').empty();
for (var i = 0; i < data.errors.length; i++) {
var item = $('<li>').text(data.errors[i]);
@@ -110,14 +112,11 @@ function failedJobImport(jqxhr, textStatus, error) {
"use strict";
// set status
+ // "There was an error during the import routine. Please check the log files. The error seems to be: '"
$('#import-status-txt').addClass('text-danger').text(
- "There was an error during the import routine. Please check the log files. The error seems to be: '" + textStatus + ' ' + error + "'."
+ langImportFatalError + textStatus + ' ' + error
);
// remove progress bar.
$('#import-status-holder').hide();
- console.log('failedJobImport');
- console.log(textStatus);
- console.log(error);
-
}
\ No newline at end of file
diff --git a/resources/views/import/status.twig b/resources/views/import/status.twig
index 97042f5141..1ccf7acd4e 100644
--- a/resources/views/import/status.twig
+++ b/resources/views/import/status.twig
@@ -57,6 +57,12 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
+
+ // some useful translations.
+ var langImportSingleError = '{{ 'import_error_single'|_ }}';
+ var langImportMultiError = '{{ 'import_error_multi'|_ }}';
+ var langImportFatalError = '{{ 'import_error_fatal'|_ }}';
+
var jobKey = '{{ job.key }}';
var jobImportUrl = '{{ route('import.json', [job.key]) }}';
var jobStartUrl = '{{ route('import.start', [job.key]) }}';