Move strings to i18n for python & reverse proxy domain sections

This commit is contained in:
MattIPv4 2020-06-01 17:04:55 +01:00
parent 242ff5b80e
commit 49406bfd46
6 changed files with 75 additions and 24 deletions

View file

@ -18,5 +18,7 @@ import https from './https';
import logging from './logging';
import php from './php';
import presets from './presets';
import python from './python';
import reverseProxy from './reverse_proxy';
export default { https, logging, php, presets };
export default { https, logging, php, presets, python, reverseProxy };

View file

@ -0,0 +1,25 @@
/*
Copyright 2020 DigitalOcean
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.
*/
export default {
python: 'Python',
pythonIsDisabled: 'Python is disabled.',
pythonCannotBeEnabledWithReverseProxy: 'Python cannot be enabled whilst the reverse proxy is enabled.',
pythonCannotBeEnabledWithPhp: 'Python cannot be enabled whilst PHP is enabled.',
enablePython: 'enable Python',
djangoRules: 'Django rules',
enableDjangoRules: 'enable Django-specific rules',
};

View file

@ -0,0 +1,24 @@
/*
Copyright 2020 DigitalOcean
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.
*/
export default {
reverseProxy: 'Reverse proxy',
reverseProxyIsDisabled: 'Reverse proxy is disabled.',
reverseProxyCannotBeEnabledWithPhp: 'Reverse proxy cannot be enabled whilst PHP is enabled.',
reverseProxyCannotBeEnabledWithPython: 'Reverse proxy cannot be enabled whilst Python is enabled.',
enableReverseProxy: 'enable reverse proxy',
path: 'Path',
};

View file

@ -100,7 +100,7 @@ limitations under the License.
},
singlePageApplication: {
default: false,
display: i18n.templates.domainSections.presets.singePageApplication,
display: i18n.templates.domainSections.presets.singlePageApplication,
enabled: true,
computedCheck (data) {
return data.php.php.computed

View file

@ -18,18 +18,18 @@ limitations under the License.
<div>
<div v-if="!pythonEnabled" class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">Python</label>
<label class="label">{{ i18n.templates.domainSections.python.python }}</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<label class="text">
Python is disabled.
{{ i18n.templates.domainSections.python.pythonIsDisabled }}
<template v-if="$parent.$props.data.reverseProxy.reverseProxy.computed">
<br />Python cannot be enabled whilst the reverse proxy is enabled.
<br />{{ i18n.templates.domainSections.python.pythonCannotBeEnabledWithReverseProxy }}
</template>
<template v-if="$parent.$props.data.php.php.computed">
<br />Python cannot be enabled whilst PHP is enabled.
<br />{{ i18n.templates.domainSections.python.pythonCannotBeEnabledWithPhp }}
</template>
</label>
</div>
@ -39,7 +39,7 @@ limitations under the License.
<div v-else class="field is-horizontal">
<div class="field-label">
<label class="label">Python</label>
<label class="label">{{ i18n.templates.domainSections.python.python }}</label>
</div>
<div class="field-body">
<div class="field">
@ -47,7 +47,7 @@ limitations under the License.
<div class="checkbox">
<PrettyCheck v-model="python" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
enable Python
{{ i18n.templates.domainSections.python.enablePython }}
</PrettyCheck>
</div>
</div>
@ -57,7 +57,7 @@ limitations under the License.
<div v-if="djangoRulesEnabled" class="field is-horizontal">
<div class="field-label">
<label class="label">Django rules</label>
<label class="label">{{ i18n.templates.domainSections.python.djangoRules }}</label>
</div>
<div class="field-body">
<div class="field">
@ -65,7 +65,7 @@ limitations under the License.
<div class="checkbox">
<PrettyCheck v-model="djangoRules" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
enable Django-specific rules
{{ i18n.templates.domainSections.python.enableDjangoRules }}
</PrettyCheck>
</div>
</div>
@ -94,7 +94,7 @@ limitations under the License.
export default {
name: 'DomainPython', // Component name
display: 'Python', // Display name for tab
display: i18n.templates.domainSections.python.python, // Display name for tab
key: 'python', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {

View file

@ -18,18 +18,18 @@ limitations under the License.
<div>
<div v-if="!reverseProxyEnabled" class="field is-horizontal is-aligned-top">
<div class="field-label">
<label class="label">Reverse proxy</label>
<label class="label">{{ i18n.templates.domainSections.reverseProxy.reverseProxy }}</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<label class="text">
Reverse proxy is disabled.
{{ i18n.templates.domainSections.reverseProxy.reverseProxyIsDisabled }}
<template v-if="$parent.$props.data.php.php.computed">
<br />Reverse proxy cannot be enabled whilst PHP is enabled.
<br />{{ i18n.templates.domainSections.reverseProxy.reverseProxyCannotBeEnabledWithPhp }}
</template>
<template v-if="$parent.$props.data.python.python.computed">
<br />Reverse proxy cannot be enabled whilst Python is enabled.
<br />{{ i18n.templates.domainSections.reverseProxy.reverseProxyCannotBeEnabledWithPython }}
</template>
</label>
</div>
@ -39,7 +39,7 @@ limitations under the License.
<div v-else class="field is-horizontal">
<div class="field-label">
<label class="label">Reverse proxy</label>
<label class="label">{{ i18n.templates.domainSections.reverseProxy.reverseProxy }}</label>
</div>
<div class="field-body">
<div :class="`field${reverseProxyChanged ? ' is-changed' : ''}`">
@ -47,7 +47,7 @@ limitations under the License.
<div class="checkbox">
<PrettyCheck v-model="reverseProxy" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
enable reverse proxy
{{ i18n.templates.domainSections.reverseProxy.enableReverseProxy }}
</PrettyCheck>
</div>
</div>
@ -57,7 +57,7 @@ limitations under the License.
<div v-if="pathEnabled" class="field is-horizontal">
<div class="field-label">
<label class="label">Path</label>
<label class="label">{{ i18n.templates.domainSections.reverseProxy.path }}</label>
</div>
<div class="field-body">
<div :class="`field${pathChanged ? ' is-changed' : ''}`">
@ -113,22 +113,22 @@ limitations under the License.
};
export default {
name: 'DomainReverseProxy', // Component name
display: 'Reverse proxy', // Display name for tab
key: 'reverseProxy', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
name: 'DomainReverseProxy', // Component name
display: i18n.templates.domainSections.reverseProxy.reverseProxy, // Display name for tab
key: 'reverseProxy', // Key for data in parent
delegated: delegatedFromDefaults(defaults), // Data the parent will present here
components: {
PrettyCheck,
},
props: {
data: Object, // Data delegated back to us from parent
data: Object, // Data delegated back to us from parent
},
data () {
return {
i18n,
};
},
computed: computedFromDefaults(defaults, 'reverseProxy'), // Getters & setters for the delegated data
computed: computedFromDefaults(defaults, 'reverseProxy'), // Getters & setters for the delegated data
watch: {
// If the PHP or Python is enabled, the Reverse proxy will be forced off
'$parent.$props.data': {