Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation support to enforce-macos-app-location module #439

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions build/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@
"confirmButtonText": "OK",
"cancelButtonText": "Cancel"
}
},
"enforceMacOSAppLocation": {
"appLocationModalDialog": {
"message": "Move to Applications folder?",
"detail": "{{productName}} must live in the Applications folder to be able to run correctly",
"confirmButtonText": "Move to Applications folder",
"cancelButtonText": "Quit {{productName}}"
},
"loadingWindow": {
"description": "Moving the app..."
},
"appRunningModalDialog": {
"message": "Another version of {{productName}} is currently running. Quit it, then launch this version of the app again",
"confirmButtonText": "OK"
}
}
},
"menu": {
Expand Down
15 changes: 15 additions & 0 deletions build/locales/ru/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@
"confirmButtonText": "OK",
"cancelButtonText": "Отмена"
}
},
"enforceMacOSAppLocation": {
"appLocationModalDialog": {
"message": "Переместить в папку Приложения?",
"detail": "{{productName}} должен находиться в папке Приложения для корректной работы",
"confirmButtonText": "Переместить в папку Приложения",
"cancelButtonText": "Выйти из {{productName}}"
},
"loadingWindow": {
"description": "Перемещение приложения..."
},
"appRunningModalDialog": {
"message": "В настоящее время запущена другая версия {{productName}}. Закройте ее, затем снова запустите эту версию приложения",
"confirmButtonText": "OK"
}
}
},
"menu": {
Expand Down
26 changes: 19 additions & 7 deletions src/enforce-macos-app-location.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const { app, dialog } = require('electron')
const i18next = require('i18next')

const productName = require('./helpers/product-name')
const {
Expand All @@ -22,11 +23,18 @@ module.exports = async () => {

const clickedButtonIndex = dialog.showMessageBoxSync({
type: 'error',
message: 'Move to Applications folder?',
detail: `${productName} must live in the Applications folder to be able to run correctly.`,
message: i18next
.t('common.enforceMacOSAppLocation.appLocationModalDialog.message'),
detail: i18next.t(
'common.enforceMacOSAppLocation.appLocationModalDialog.detail',
{ productName }
),
buttons: [
'Move to Applications folder',
`Quit ${productName}`
i18next.t('common.enforceMacOSAppLocation.appLocationModalDialog.confirmButtonText'),
i18next.t(
'common.enforceMacOSAppLocation.appLocationModalDialog.cancelButtonText',
{ productName }
)
],
defaultId: 0,
cancelId: 1
Expand All @@ -39,7 +47,8 @@ module.exports = async () => {
}

await showLoadingWindow({
description: 'Moving the app...',
description: i18next
.t('common.enforceMacOSAppLocation.loadingWindow.description'),
isRequiredToCloseAllWins: true,
isIndeterminateMode: true
})
Expand All @@ -49,9 +58,12 @@ module.exports = async () => {
if (conflict === 'existsAndRunning') {
dialog.showMessageBoxSync({
type: 'error',
message: `Another version of ${productName} is currently running. Quit it, then launch this version of the app again.`,
message: i18next.t(
'common.enforceMacOSAppLocation.appRunningModalDialog.message',
{ productName }
),
buttons: [
'OK'
i18next.t('common.enforceMacOSAppLocation.appRunningModalDialog.confirmButtonText')
]
})

Expand Down