Allow language selection (#191)

* Add dropdown for language

* Use vue-i18n to translate strings

* Tweak header styling

* Add Chinese languages in

* Typo

* Get language from browser (#193)

* adaptive system language

* Modify the adaptive system language

* Remove dead code

* Delete lang default values

* Move browser language detection to util

* Remove todos

* Fix global PHP dropdown

Co-authored-by: 墨娘 <61287199+moniang@users.noreply.github.com>
This commit is contained in:
Matt (IPv4) Cowley
2020-12-11 16:54:12 +00:00
committed by GitHub
parent 7d3290d850
commit ff88e2f322
53 changed files with 539 additions and 434 deletions

View File

@@ -28,7 +28,7 @@ THE SOFTWARE.
<div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.common.docker }}</label>
<label class="label">{{ $t('common.docker') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -36,7 +36,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="dockerfile" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.docker.dockerfile }}
{{ $t('templates.globalSections.docker.dockerfile') }}
</PrettyCheck>
</div>
</div>
@@ -45,7 +45,7 @@ THE SOFTWARE.
</div>
<div v-if="dockerfile" class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.common.dockerCompose }}</label>
<label class="label">{{ $t('common.dockerCompose') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -53,7 +53,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="dockerCompose" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.docker.dockerCompose }}
{{ $t('templates.globalSections.docker.dockerCompose') }}
</PrettyCheck>
</div>
</div>
@@ -64,10 +64,9 @@ THE SOFTWARE.
</template>
<script>
import i18n from '../../i18n';
import PrettyCheck from 'pretty-checkbox-vue/check';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
import PrettyCheck from 'pretty-checkbox-vue/check';
const defaults = {
dockerfile: {
@@ -82,7 +81,7 @@ THE SOFTWARE.
export default {
name: 'GlobalDocker', // Component name
display: i18n.common.docker, // Display name for tab
display: 'common.docker', // Display name for tab (i18n key)
key: 'docker', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -91,11 +90,6 @@ THE SOFTWARE.
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: computedFromDefaults(defaults, 'docker'), // Getters & setters for the delegated data
watch: {
// Disable docker-compose if dockerfile is disabled

View File

@@ -28,13 +28,13 @@ THE SOFTWARE.
<div>
<div v-if="!sslProfileEnabled" class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.https.sslProfile }}</label>
<label class="label">{{ $t('templates.globalSections.https.sslProfile') }}</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<label class="text">
{{ i18n.templates.globalSections.https.httpsMustBeEnabledOnOneSite }}
{{ $t('templates.globalSections.https.httpsMustBeEnabledOnOneSite') }}
</label>
</div>
</div>
@@ -44,7 +44,7 @@ THE SOFTWARE.
<template v-else>
<div class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.https.sslProfile }}</label>
<label class="label">{{ $t('templates.globalSections.https.sslProfile') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -55,7 +55,7 @@ THE SOFTWARE.
<div class="radio">
<PrettyRadio v-model="sslProfile" :value="value" class="p-default p-round p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ name }}
{{ $t(name) }}
</PrettyRadio>
</div>
</div>
@@ -66,7 +66,7 @@ THE SOFTWARE.
<div class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.https.ocspDnsResolvers }}</label>
<label class="label">{{ $t('templates.globalSections.https.ocspDnsResolvers') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -74,7 +74,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="ocspCloudflare" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.https.cloudflareResolver }}
{{ $t('templates.globalSections.https.cloudflareResolver') }}
</PrettyCheck>
</div>
</div>
@@ -85,7 +85,7 @@ THE SOFTWARE.
<div class="radio">
<PrettyRadio v-model="ocspCloudflareType" :value="value" class="p-default p-round p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ name }}
{{ $t(name) }}
</PrettyRadio>
</div>
</div>
@@ -95,7 +95,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="ocspGoogle" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.https.googlePublicDns }}
{{ $t('templates.globalSections.https.googlePublicDns') }}
</PrettyCheck>
</div>
</div>
@@ -106,7 +106,7 @@ THE SOFTWARE.
<div class="radio">
<PrettyRadio v-model="ocspGoogleType" :value="value" class="p-default p-round p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ name }}
{{ $t(name) }}
</PrettyRadio>
</div>
</div>
@@ -116,7 +116,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="ocspOpenDns" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.https.openDns }}
{{ $t('templates.globalSections.https.openDns') }}
</PrettyCheck>
</div>
</div>
@@ -127,7 +127,7 @@ THE SOFTWARE.
<div class="radio">
<PrettyRadio v-model="ocspOpenDnsType" :value="value" class="p-default p-round p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ name }}
{{ $t(name) }}
</PrettyRadio>
</div>
</div>
@@ -137,7 +137,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="ocspQuad9" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.https.quad9 }}
{{ $t('templates.globalSections.https.quad9') }}
</PrettyCheck>
</div>
</div>
@@ -148,7 +148,7 @@ THE SOFTWARE.
<div class="radio">
<PrettyRadio v-model="ocspQuad9Type" :value="value" class="p-default p-round p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ name }}
{{ $t(name) }}
</PrettyRadio>
</div>
</div>
@@ -158,7 +158,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="ocspVerisign" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.https.verisign }}
{{ $t('templates.globalSections.https.verisign') }}
</PrettyCheck>
</div>
</div>
@@ -169,7 +169,7 @@ THE SOFTWARE.
<div class="radio">
<PrettyRadio v-model="ocspVerisignType" :value="value" class="p-default p-round p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ name }}
{{ $t(name) }}
</PrettyRadio>
</div>
</div>
@@ -180,7 +180,7 @@ THE SOFTWARE.
<div v-if="letsEncryptRootEnabled" class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.https.letsEncryptWebroot }}</label>
<label class="label">{{ $t('templates.globalSections.https.letsEncryptWebroot') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -197,7 +197,7 @@ THE SOFTWARE.
<div v-if="letsEncryptCertRootEnabled" class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.https.letsEncryptCertRoot }}</label>
<label class="label">{{ $t('templates.globalSections.https.letsEncryptCertRoot') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -219,16 +219,15 @@ THE SOFTWARE.
import PrettyCheck from 'pretty-checkbox-vue/check';
import PrettyRadio from 'pretty-checkbox-vue/radio';
import clone from 'clone';
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
const ipType = {
default: 'ipv4',
options: {
ipv4: i18n.templates.globalSections.https.ipv4Only,
ipv6: i18n.templates.globalSections.https.ipv6Only,
both: i18n.templates.globalSections.https.ipv4AndIpv6,
ipv4: 'templates.globalSections.https.ipv4Only', // i18n key
ipv6: 'templates.globalSections.https.ipv6Only', // i18n key
both: 'templates.globalSections.https.ipv4AndIpv6', // i18n key
},
enabled: true,
};
@@ -243,9 +242,9 @@ THE SOFTWARE.
sslProfile: {
default: 'intermediate',
options: {
modern: i18n.templates.globalSections.https.mozillaModern,
intermediate: i18n.templates.globalSections.https.mozillaIntermediate,
old: i18n.templates.globalSections.https.mozillaOld,
modern: 'templates.globalSections.https.mozillaModern', // i18n key
intermediate: 'templates.globalSections.https.mozillaIntermediate', // i18n key
old: 'templates.globalSections.https.mozillaOld', // i18n key
},
enabled: true,
},
@@ -286,7 +285,7 @@ THE SOFTWARE.
export default {
name: 'GlobalHTTPS', // Component name
display: i18n.common.https, // Display name for tab
display: 'common.https', // Display name for tab (i18n key)
key: 'https', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -296,11 +295,6 @@ THE SOFTWARE.
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: computedFromDefaults(defaults, 'https'), // Getters & setters for the delegated data
watch: {
// Check SSL profile is valid

View File

@@ -70,7 +70,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="logNotFound" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.enableFileNotFoundErrorLogging }} error_log
{{ $t('templates.globalSections.logging.enableFileNotFoundErrorLogging') }} error_log
</PrettyCheck>
</div>
</div>
@@ -80,7 +80,7 @@ THE SOFTWARE.
<div class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.logging.logformat }}</label>
<label class="label">{{ $t('templates.globalSections.logging.logformat') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -88,7 +88,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="cloudflare" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.enableCloudflare }}
{{ $t('templates.globalSections.logging.enableCloudflare') }}
</PrettyCheck>
</div>
</div>
@@ -96,7 +96,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="cfRay" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.cfRay }}
{{ $t('templates.globalSections.logging.cfRay') }}
</PrettyCheck>
</div>
</div>
@@ -104,7 +104,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="cfConnectingIp" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.cfConnectingIp }}
{{ $t('templates.globalSections.logging.cfConnectingIp') }}
</PrettyCheck>
</div>
</div>
@@ -112,7 +112,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="xForwardedFor" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.xForwardedFor }}
{{ $t('templates.globalSections.logging.xForwardedFor') }}
</PrettyCheck>
</div>
</div>
@@ -120,7 +120,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="xForwardedProto" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.xForwardedProto }}
{{ $t('templates.globalSections.logging.xForwardedProto') }}
</PrettyCheck>
</div>
</div>
@@ -128,7 +128,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="trueClientIp" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.trueClientIp }}
{{ $t('templates.globalSections.logging.trueClientIp') }}
</PrettyCheck>
</div>
</div>
@@ -136,7 +136,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="cfIpCountry" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.cfIpCountry }}
{{ $t('templates.globalSections.logging.cfIpCountry') }}
</PrettyCheck>
</div>
</div>
@@ -144,7 +144,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="cfVisitor" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.cfVisitor }}
{{ $t('templates.globalSections.logging.cfVisitor') }}
</PrettyCheck>
</div>
</div>
@@ -152,7 +152,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="cdnLoop" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.logging.cdnLoop }}
{{ $t('templates.globalSections.logging.cdnLoop') }}
</PrettyCheck>
</div>
</div>
@@ -164,7 +164,6 @@ THE SOFTWARE.
<script>
import PrettyCheck from 'pretty-checkbox-vue/check';
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
@@ -221,7 +220,7 @@ THE SOFTWARE.
export default {
name: 'GlobalLogging', // Component name
display: i18n.common.logging, // Display name for tab
display: 'common.logging', // Display name for tab (i18n key)
key: 'logging', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -230,11 +229,6 @@ THE SOFTWARE.
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: computedFromDefaults(defaults, 'logging'), // Getters & setters for the delegated data
watch: {
// Show Cloudflare header options if Cloudflare is enabled

View File

@@ -28,7 +28,7 @@ THE SOFTWARE.
<div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.nginx.nginxConfigDirectory }}</label>
<label class="label">{{ $t('templates.globalSections.nginx.nginxConfigDirectory') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -110,7 +110,7 @@ THE SOFTWARE.
</div>
<div class="control">
<a class="button is-static">
{{ i18n.templates.globalSections.nginx.mb }}
{{ $t('templates.globalSections.nginx.mb') }}
</a>
</div>
</div>
@@ -121,7 +121,6 @@ THE SOFTWARE.
<script>
import VueSelect from 'vue-select';
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
@@ -155,7 +154,7 @@ THE SOFTWARE.
export default {
name: 'GlobalNGINX', // Component name
display: i18n.common.nginx, // Display name for tab
display: 'common.nginx', // Display name for tab (i18n key)
key: 'nginx', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -164,11 +163,6 @@ THE SOFTWARE.
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: computedFromDefaults(defaults, 'nginx'), // Getters & setters for the delegated data
watch: {
// Clean nginx directory of trailing slashes

View File

@@ -28,7 +28,7 @@ THE SOFTWARE.
<div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.performance.gzipCompression }}</label>
<label class="label">{{ $t('templates.globalSections.performance.gzipCompression') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -36,7 +36,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="gzipCompression" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.performance.enableGzipCompression }}
{{ $t('templates.globalSections.performance.enableGzipCompression') }}
</PrettyCheck>
</div>
</div>
@@ -46,7 +46,7 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.performance.brotliCompression }}</label>
<label class="label">{{ $t('templates.globalSections.performance.brotliCompression') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -54,7 +54,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="brotliCompression" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.performance.enableBrotliCompression }}
{{ $t('templates.globalSections.performance.enableBrotliCompression') }}
</PrettyCheck>
</div>
</div>
@@ -64,7 +64,7 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.performance.expirationForAssets }}</label>
<label class="label">{{ $t('templates.globalSections.performance.expirationForAssets') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -81,7 +81,7 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.performance.expirationForMedia }}</label>
<label class="label">{{ $t('templates.globalSections.performance.expirationForMedia') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -98,7 +98,7 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.performance.expirationForSvgs }}</label>
<label class="label">{{ $t('templates.globalSections.performance.expirationForSvgs') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -115,7 +115,7 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.performance.expirationForFonts }}</label>
<label class="label">{{ $t('templates.globalSections.performance.expirationForFonts') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -134,7 +134,6 @@ THE SOFTWARE.
<script>
import PrettyCheck from 'pretty-checkbox-vue/check';
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
@@ -167,7 +166,7 @@ THE SOFTWARE.
export default {
name: 'GlobalPerformance', // Component name
display: i18n.templates.globalSections.performance.performance, // Display name for tab
display: 'templates.globalSections.performance.performance', // Display name for tab (i18n key)
key: 'performance', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -176,11 +175,6 @@ THE SOFTWARE.
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: computedFromDefaults(defaults, 'performance'), // Getters & setters for the delegated data
};
</script>

View File

@@ -28,13 +28,13 @@ THE SOFTWARE.
<div>
<div v-if="!phpServerEnabled" class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.php.phpServer }}</label>
<label class="label">{{ $t('templates.globalSections.php.phpServer') }}</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<label class="text">
{{ i18n.templates.globalSections.php.phpMustBeEnabledOnOneSite }}
{{ $t('templates.globalSections.php.phpMustBeEnabledOnOneSite') }}
</label>
</div>
</div>
@@ -44,7 +44,7 @@ THE SOFTWARE.
<template v-else>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.php.phpServer }}</label>
<label class="label">{{ $t('templates.globalSections.php.phpServer') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -61,12 +61,13 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.php.phpBackupServer }}</label>
<label class="label">{{ $t('templates.globalSections.php.phpBackupServer') }}</label>
</div>
<div class="field-body">
<div class="field">
<div :class="`control${phpBackupServerChanged ? ' is-changed' : ''}`">
<VueSelect v-model="phpBackupServer"
<VueSelect ref="phpBackupServerSelect"
v-model="phpBackupServer"
:options="phpBackupServerOptions"
:clearable="false"
:reduce="s => s.value"
@@ -81,22 +82,22 @@ THE SOFTWARE.
<script>
import VueSelect from 'vue-select';
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
// Value -> i18n key
const serverOptions = {
'127.0.0.1:9000': `${i18n.templates.globalSections.php.tcp}: 127.0.0.1:9000`,
'/var/run/hhvm/sock': `${i18n.templates.globalSections.php.hhvmSocket}: /var/run/hhvm/sock`,
'/var/run/hhvm/hhvm.sock': `${i18n.templates.globalSections.php.hhvmSocket}: /var/run/hhvm/hhvm.sock`,
'/var/run/php5-fpm.sock': `${i18n.templates.globalSections.php.php5Socket}: /var/run/php5-fpm.sock`,
'/var/run/php/php7.1-fpm.sock': `${i18n.templates.globalSections.php.php71Socket}: /var/run/php/php7.1-fpm.sock`,
'/var/run/php/php7.2-fpm.sock': `${i18n.templates.globalSections.php.php72Socket}: /var/run/php/php7.2-fpm.sock`,
'/var/run/php/php7.0-fpm.sock': `${i18n.templates.globalSections.php.php70Socket}: /var/run/php/php7.0-fpm.sock`,
'/var/run/php/php7.3-fpm.sock': `${i18n.templates.globalSections.php.php73Socket}: /var/run/php/php7.3-fpm.sock`,
'/var/run/php/php7.4-fpm.sock': `${i18n.templates.globalSections.php.php74Socket}: /var/run/php/php7.4-fpm.sock`,
'/var/run/php/php8.0-fpm.sock': `${i18n.templates.globalSections.php.php80Socket}: /var/run/php/php8.0-fpm.sock`,
'/var/run/php/php-fpm.sock': `${i18n.templates.globalSections.php.phpSocket}: /var/run/php/php-fpm.sock`,
'127.0.0.1:9000': 'templates.globalSections.php.tcp',
'/var/run/hhvm/sock': 'templates.globalSections.php.hhvmSocket',
'/var/run/hhvm/hhvm.sock': 'templates.globalSections.php.hhvmSocket',
'/var/run/php5-fpm.sock': 'templates.globalSections.php.php5Socket',
'/var/run/php/php7.1-fpm.sock': 'templates.globalSections.php.php71Socket',
'/var/run/php/php7.2-fpm.sock': 'templates.globalSections.php.php72Socket',
'/var/run/php/php7.0-fpm.sock': 'templates.globalSections.php.php70Socket',
'/var/run/php/php7.3-fpm.sock': 'templates.globalSections.php.php73Socket',
'/var/run/php/php7.4-fpm.sock': 'templates.globalSections.php.php74Socket',
'/var/run/php/php8.0-fpm.sock': 'templates.globalSections.php.php80Socket',
'/var/run/php/php-fpm.sock': 'templates.globalSections.php.phpSocket',
};
const defaults = {
@@ -107,14 +108,14 @@ THE SOFTWARE.
},
phpBackupServer: {
default: '',
options: { '': i18n.templates.globalSections.php.disabled, ...serverOptions },
options: { '': 'templates.globalSections.php.disabled', ...serverOptions },
enabled: true,
},
};
export default {
name: 'GlobalPHP', // Component name
display: i18n.common.php, // Display name for tab
display: 'common.php', // Display name for tab (i18n key)
key: 'php', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -123,20 +124,15 @@ THE SOFTWARE.
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: {
...computedFromDefaults(defaults, 'php'), // Getters & setters for the delegated data
phpServerOptions() {
return Object.entries(this.$props.data.phpServer.options)
.map(([key, value]) => ({ label: value, value: key }));
.map(([key, value]) => ({ label: `${this.$t(value)}${key ? `: ${key}` : ''}`, value: key }));
},
phpBackupServerOptions() {
return Object.entries(this.$props.data.phpBackupServer.options)
.map(([key, value]) => ({ label: value, value: key }));
.map(([key, value]) => ({ label: `${this.$t(value)}${key ? `: ${key}` : ''}`, value: key }));
},
},
watch: {
@@ -179,6 +175,12 @@ THE SOFTWARE.
},
deep: true,
},
// Ensure 'Disabled' gets translated in VueSelect on language switch
'$i18n.locale'() {
const updated = this.phpBackupServerOptions
.find(x => x.value === this.$refs.phpBackupServerSelect.$data._value.value);
if (updated) this.$refs.phpBackupServerSelect.$data._value = updated;
},
},
};
</script>

View File

@@ -28,13 +28,13 @@ THE SOFTWARE.
<div>
<div v-if="!pythonServerEnabled" class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.python.pythonServer }}</label>
<label class="label">{{ $t('templates.globalSections.python.pythonServer') }}</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<label class="text">
{{ i18n.templates.globalSections.python.pythonMustBeEnabledOnOneSite }}
{{ $t('templates.globalSections.python.pythonMustBeEnabledOnOneSite') }}
</label>
</div>
</div>
@@ -43,7 +43,7 @@ THE SOFTWARE.
<div v-else class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.python.pythonServer }}</label>
<label class="label">{{ $t('templates.globalSections.python.pythonServer') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -61,7 +61,6 @@ THE SOFTWARE.
</template>
<script>
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
@@ -74,17 +73,12 @@ THE SOFTWARE.
export default {
name: 'GlobalPython', // Component name
display: i18n.common.python, // Display name for tab
display: 'common.python', // Display name for tab (i18n key)
key: 'python', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: computedFromDefaults(defaults, 'python'), // Getters & setters for the delegated data
watch: {
// Enable Python server settings if any site uses Python

View File

@@ -28,13 +28,13 @@ THE SOFTWARE.
<div>
<div v-if="!reverseProxyEnabled" class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">{{ i18n.common.reverseProxy }}</label>
<label class="label">{{ $t('common.reverseProxy') }}</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<label class="text">
{{ i18n.templates.globalSections.reverseProxy.reverseProxyMustBeEnabledOnOneSite }}
{{ $t('templates.globalSections.reverseProxy.reverseProxyMustBeEnabledOnOneSite') }}
</label>
</div>
</div>
@@ -59,7 +59,7 @@ THE SOFTWARE.
</div>
<div class="control">
<a class="button is-static">
{{ i18n.templates.globalSections.reverseProxy.seconds }}
{{ $t('templates.globalSections.reverseProxy.seconds') }}
</a>
</div>
</div>
@@ -83,7 +83,7 @@ THE SOFTWARE.
</div>
<div class="control">
<a class="button is-static">
{{ i18n.templates.globalSections.reverseProxy.seconds }}
{{ $t('templates.globalSections.reverseProxy.seconds') }}
</a>
</div>
</div>
@@ -107,7 +107,7 @@ THE SOFTWARE.
</div>
<div class="control">
<a class="button is-static">
{{ i18n.templates.globalSections.reverseProxy.seconds }}
{{ $t('templates.globalSections.reverseProxy.seconds') }}
</a>
</div>
</div>
@@ -118,7 +118,6 @@ THE SOFTWARE.
</template>
<script>
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
@@ -154,7 +153,7 @@ THE SOFTWARE.
export default {
name: 'GlobalReverseProxy', // Component name
display: i18n.common.reverseProxy, // Display name for tab
display: 'common.reverseProxy', // Display name for tab (i18n key)
key: 'reverseProxy', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
props: {
@@ -162,7 +161,6 @@ THE SOFTWARE.
},
data() {
return {
i18n,
reverseProxyEnabled: false,
};
},

View File

@@ -59,7 +59,7 @@ THE SOFTWARE.
<br />
<div class="message is-warning">
<div class="message-body"
v-html="i18n.templates.globalSections.security.whenUsingWordPressUnsafeEvalIsOftenRequiredToAllowFunctionality"
v-html="$t('templates.globalSections.security.whenUsingWordPressUnsafeEvalIsOftenRequiredToAllowFunctionality')"
></div>
</div>
</template>
@@ -77,7 +77,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="serverTokens" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.common.enable }}
{{ $t('common.enable') }}
</PrettyCheck>
</div>
</div>
@@ -95,7 +95,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="limitReq" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.common.enable }}
{{ $t('common.enable') }}
</PrettyCheck>
</div>
</div>
@@ -113,7 +113,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="securityTxt" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.common.enable }}
{{ $t('common.enable') }}
</PrettyCheck>
</div>
</div>
@@ -143,7 +143,6 @@ THE SOFTWARE.
<script>
import PrettyCheck from 'pretty-checkbox-vue/check';
import VueSelect from 'vue-select';
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
@@ -186,7 +185,7 @@ THE SOFTWARE.
export default {
name: 'GlobalSecurity', // Component name
display: i18n.templates.globalSections.security.security, // Display name for tab
display: 'templates.globalSections.security.security', // Display name for tab (i18n key)
key: 'security', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -196,11 +195,6 @@ THE SOFTWARE.
props: {
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: {
...computedFromDefaults(defaults, 'security'), // Getters & setters for the delegated data
hasWordPress() {

View File

@@ -28,7 +28,7 @@ THE SOFTWARE.
<div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.tools.modularizedStructure }}</label>
<label class="label">{{ $t('templates.globalSections.tools.modularizedStructure') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -36,7 +36,7 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="modularizedStructure" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.tools.enableModularizedConfigFiles }}
{{ $t('templates.globalSections.tools.enableModularizedConfigFiles') }}
</PrettyCheck>
</div>
</div>
@@ -54,8 +54,8 @@ THE SOFTWARE.
<div class="checkbox">
<PrettyCheck v-model="symlinkVhost" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ i18n.templates.globalSections.tools.enableSymLinksFrom }} sites-available/
{{ i18n.templates.globalSections.tools.to }} sites-enabled/
{{ $t('templates.globalSections.tools.enableSymLinksFrom') }} sites-available/
{{ $t('templates.globalSections.tools.to') }} sites-enabled/
</PrettyCheck>
</div>
</div>
@@ -65,7 +65,7 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.tools.shareConfiguration }}</label>
<label class="label">{{ $t('templates.globalSections.tools.shareConfiguration') }}</label>
</div>
<div class="field-body">
<div class="field">
@@ -83,23 +83,23 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ i18n.templates.globalSections.tools.resetConfiguration }}</label>
<label class="label">{{ $t('templates.globalSections.tools.resetConfiguration') }}</label>
</div>
<div class="field-body">
<div class="field is-grouped">
<div class="control">
<a class="button is-danger is-outline is-mini" @click="resetGlobal">
{{ i18n.templates.globalSections.tools.resetGlobalConfig }}
{{ $t('templates.globalSections.tools.resetGlobalConfig') }}
</a>
</div>
<div v-if="hasDomain" class="control">
<a class="button is-danger is-outline is-mini" @click="resetDomains">
{{ i18n.templates.globalSections.tools.resetAllDomains }}
{{ $t('templates.globalSections.tools.resetAllDomains') }}
</a>
</div>
<div v-if="hasDomain" class="control">
<a class="button is-danger is-outline is-mini" @click="removeDomains">
{{ i18n.templates.globalSections.tools.removeAllDomains }}
{{ $t('templates.globalSections.tools.removeAllDomains') }}
</a>
</div>
</div>
@@ -118,12 +118,12 @@ THE SOFTWARE.
<div class="field is-grouped">
<div class="control">
<a class="button is-danger is-outline is-mini" @click="resetDomain(domainData[1])">
{{ i18n.templates.globalSections.tools.resetDomainConfig }}
{{ $t('templates.globalSections.tools.resetDomainConfig') }}
</a>
</div>
<div class="control">
<a class="button is-danger is-outline is-mini" @click="removeDomain(domainData[1])">
{{ i18n.templates.globalSections.tools.removeDomain }}
{{ $t('templates.globalSections.tools.removeDomain') }}
</a>
</div>
</div>
@@ -135,10 +135,10 @@ THE SOFTWARE.
<Modal ref="confirmModal" :title="confirmTitle">
<p>{{ confirmBody }}</p>
<a class="button is-danger is-outline" @click="doConfirmAction">
{{ i18n.templates.globalSections.tools.yesImSure }}
{{ $t('templates.globalSections.tools.yesImSure') }}
</a>
<a class="button is-outline" @click="$refs.confirmModal.close()">
{{ i18n.templates.globalSections.tools.noCancel }}
{{ $t('templates.globalSections.tools.noCancel') }}
</a>
</Modal>
</div>
@@ -147,7 +147,6 @@ THE SOFTWARE.
<script>
import PrettyCheck from 'pretty-checkbox-vue/check';
import Modal from 'do-vue/src/templates/modal';
import i18n from '../../i18n';
import delegatedFromDefaults from '../../util/delegated_from_defaults';
import computedFromDefaults from '../../util/computed_from_defaults';
import shareQuery from '../../util/share_query';
@@ -166,7 +165,7 @@ THE SOFTWARE.
export default {
name: 'GlobalTools', // Component name
display: i18n.templates.globalSections.tools.tools, // Display name for tab
display: 'templates.globalSections.tools.tools', // Display name for tab (i18n key)
key: 'tools', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
@@ -178,7 +177,6 @@ THE SOFTWARE.
},
data() {
return {
i18n,
confirmTitle: '',
confirmBody: '',
confirmAction: () => {},
@@ -242,8 +240,8 @@ THE SOFTWARE.
},
resetGlobal() {
this.confirm(
i18n.templates.globalSections.tools.resetGlobalConfig,
i18n.templates.globalSections.tools.resetGlobalConfigBody,
this.$t('templates.globalSections.tools.resetGlobalConfig'),
this.$t('templates.globalSections.tools.resetGlobalConfigBody'),
() => {
analytics('reset_global', 'Reset');
Object.values(this.$parent.$props.data).forEach(category => {
@@ -261,10 +259,10 @@ THE SOFTWARE.
if (!domain) return;
this.confirm(
i18n.templates.globalSections.tools.resetDomainConfig ,
`${i18n.templates.globalSections.tools.areYouSureYouWantToResetAllConfigurationOptionsForThe}
this.$t('templates.globalSections.tools.resetDomainConfig'),
`${this.$t('templates.globalSections.tools.areYouSureYouWantToResetAllConfigurationOptionsForThe')}
${domain.server.domain.computed}
${i18n.templates.globalSections.tools.domain}`,
${this.$t('templates.globalSections.tools.domain')}`,
() => {
analytics('reset_domain', 'Reset', domain.server.domain.computed);
this.doResetDomain(domain);
@@ -277,10 +275,10 @@ THE SOFTWARE.
if (!domain) return;
this.confirm(
i18n.templates.globalSections.tools.removeDomain,
`${i18n.templates.globalSections.tools.areYouSureYouWantToRemoveThe}
this.$t('templates.globalSections.tools.removeDomain'),
`${this.$t('templates.globalSections.tools.areYouSureYouWantToRemoveThe')}
${domain.server.domain.computed}
${i18n.templates.globalSections.tools.domainConfiguration}`,
${this.$t('templates.globalSections.tools.domainConfiguration')}`,
() => {
analytics(
'remove_domain',
@@ -295,8 +293,8 @@ THE SOFTWARE.
},
resetDomains() {
this.confirm(
i18n.templates.globalSections.tools.resetAllDomainsConfig,
i18n.templates.globalSections.tools.resetAllDomainsConfigBody,
this.$t('templates.globalSections.tools.resetAllDomainsConfig'),
this.$t('templates.globalSections.tools.resetAllDomainsConfigBody'),
() => {
analytics(
'reset_all',
@@ -313,8 +311,8 @@ THE SOFTWARE.
},
removeDomains() {
this.confirm(
i18n.templates.globalSections.tools.removeAllDomains,
i18n.templates.globalSections.tools.removeAllDomainsBody,
this.$t('templates.globalSections.tools.removeAllDomains'),
this.$t('templates.globalSections.tools.removeAllDomainsBody'),
() => {
analytics(
'remove_all',