Skip to content

Commit 8ab7cb9

Browse files
committed
(2) Add alias for text in Localizations.php #194452744474995
1 parent 4c3076f commit 8ab7cb9

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

public/bundle-update-main.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import './sources/less/wpupdates/init.less'
2-
import { default as PostUpdater } from './editor/modules/backendSettings/postUpdate'
2+
import {default as PostUpdater} from './editor/modules/backendSettings/postUpdate'
33

44
(($) => {
55
$(() => {
66
const localizations = window.VCV_I18N && window.VCV_I18N()
77
const bundleUpdateFailed = localizations ? localizations.bundleUpdateFailed : 'Bundle update failed... Please try again.'
88
const downloadingAssetsText = localizations ? localizations.downloadingAssets : 'Downloading assets {i} of {cnt}'
99
const savingResultsText = localizations ? localizations.savingResults : 'Saving Results'
10+
const postUpdateText = localizations ? localizations.postUpdateText : 'Update posts {i} in {cnt}: {name}'
1011

1112
let $loader = $('[data-vcv-loader]')
1213
let $errorPopup = $('.vcv-popup-error')
@@ -105,17 +106,17 @@ import { default as PostUpdater } from './editor/modules/backendSettings/postUpd
105106
let requestFailed = false
106107

107108
function doAction (i, finishCb) {
108-
let action = actions[ i ]
109+
let action = actions[i]
109110
const testPattern = new RegExp('^updatePosts$')
110111
if (action.action && testPattern.test(action.action)) {
111112
const postUpdater = new PostUpdater(window.vcvElementsGlobalsUrl, window.vcvVendorUrl, window.vcvUpdaterUrl)
112-
const postUpdateText = 'Update posts {i} in {cnt}: {name}'
113113
const doUpdatePostAction = async (posts, postsIndex, finishCb) => {
114-
const postData = posts[ postsIndex ]
114+
const postData = posts[postsIndex]
115115
$heading.text(postUpdateText.replace('{i}', postsIndex + 1).replace('{cnt}', posts.length).replace('{name}', postData.name || 'No name'))
116116
try {
117117
await postUpdater.update(postData)
118-
} catch (e) {}
118+
} catch (e) {
119+
}
119120
if (postsIndex + 1 < posts.length) {
120121
return doUpdatePostAction(posts, postsIndex + 1, finishCb)
121122
} else {

public/editor/modules/backendSettings/actions.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {showError} from './errors'
22
import {showFirstScreen, loadLastScreen, showLoadingScreen, showOopsScreen} from './screens'
3-
import { default as PostUpdater } from './postUpdate'
3+
import {default as PostUpdater} from './postUpdate'
44

55
(($) => {
66
let doneActions = (requestFailed, $heading, downloadingInitialExtensionsText, savingResultsText, $errorPopup, activationFailedText, $popup, loadAnimation) => {
@@ -84,17 +84,19 @@ import { default as PostUpdater } from './postUpdate'
8484
}
8585

8686
function doAction (i, finishCb) {
87-
let action = actions[ i ]
87+
let action = actions[i]
8888
const testPattern = new RegExp('^updatePosts$')
8989
if (action.action && testPattern.test(action.action)) {
9090
const postUpdater = new PostUpdater(window.vcvElementsGlobalsUrl, window.vcvVendorUrl, window.vcvUpdaterUrl)
91-
const postUpdateText = 'Update posts {i} in {cnt}: {name}'
91+
const localizations = window.VCV_I18N && window.VCV_I18N()
92+
const postUpdateText = localizations ? localizations.postUpdateText : 'Update posts {i} in {cnt}: {name}'
9293
const doUpdatePostAction = async (posts, postsIndex, finishCb) => {
93-
const postData = posts[ postsIndex ]
94+
const postData = posts[postsIndex]
9495
$heading.text(postUpdateText.replace('{i}', postsIndex + 1).replace('{cnt}', posts.length).replace('{name}', postData.name || 'No name'))
9596
try {
9697
await postUpdater.update(postData)
97-
} catch (e) {}
98+
} catch (e) {
99+
}
98100
if (postsIndex + 1 < posts.length) {
99101
return doUpdatePostAction(posts, postsIndex + 1, finishCb)
100102
} else {
@@ -169,5 +171,5 @@ import { default as PostUpdater } from './postUpdate'
169171
}
170172
}
171173

172-
module.exports = { doneActions: doneActions, processActions: processActions }
174+
module.exports = {doneActions: doneActions, processActions: processActions}
173175
})(window.jQuery)

visualcomposer/Helpers/Localizations.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public function getLocalizations()
155155
'hideOn' => __('Hide: On', 'vcwb'),
156156
'downloadingInitialExtensions' => __('Downloading initial extensions', 'vcwb'),
157157
'downloadingAssets' => __('Downloading assets {i} of {cnt}: {name}', 'vcwb'),
158+
'postUpdateText' => __('Updating posts {i} in {cnt}: {name}', 'vcwb'),
158159
];
159160

160161
return $locale;

0 commit comments

Comments
 (0)