Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/src/components/PersonalInfo/LocaleSection/LocaleSection.vue')
-rw-r--r--apps/settings/src/components/PersonalInfo/LocaleSection/LocaleSection.vue88
1 files changed, 88 insertions, 0 deletions
diff --git a/apps/settings/src/components/PersonalInfo/LocaleSection/LocaleSection.vue b/apps/settings/src/components/PersonalInfo/LocaleSection/LocaleSection.vue
new file mode 100644
index 00000000000..61c98f3a27a
--- /dev/null
+++ b/apps/settings/src/components/PersonalInfo/LocaleSection/LocaleSection.vue
@@ -0,0 +1,88 @@
+<!--
+ - @copyright 2022 Christopher Ng <chrng8@gmail.com>
+ -
+ - @author Christopher Ng <chrng8@gmail.com>
+ -
+ - @license AGPL-3.0-or-later
+ -
+ - This program is free software: you can redistribute it and/or modify
+ - it under the terms of the GNU Affero General Public License as
+ - published by the Free Software Foundation, either version 3 of the
+ - License, or (at your option) any later version.
+ -
+ - This program is distributed in the hope that it will be useful,
+ - but WITHOUT ANY WARRANTY; without even the implied warranty of
+ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ - GNU Affero General Public License for more details.
+ -
+ - You should have received a copy of the GNU Affero General Public License
+ - along with this program. If not, see <http://www.gnu.org/licenses/>.
+ -
+-->
+
+<template>
+ <section>
+ <HeaderBar :input-id="inputId"
+ :readable="propertyReadable" />
+
+ <template v-if="isEditable">
+ <Locale :input-id="inputId"
+ :locales-for-language="localesForLanguage"
+ :other-locales="otherLocales"
+ :locale.sync="locale" />
+ </template>
+
+ <span v-else>
+ {{ t('settings', 'No locale set') }}
+ </span>
+ </section>
+</template>
+
+<script>
+import { loadState } from '@nextcloud/initial-state'
+
+import Locale from './Locale.vue'
+import HeaderBar from '../shared/HeaderBar.vue'
+
+import { ACCOUNT_SETTING_PROPERTY_ENUM, ACCOUNT_SETTING_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants.js'
+
+const { localeMap: { activeLocale, localesForLanguage, otherLocales } } = loadState('settings', 'personalInfoParameters', {})
+
+export default {
+ name: 'LocaleSection',
+
+ components: {
+ Locale,
+ HeaderBar,
+ },
+
+ data() {
+ return {
+ propertyReadable: ACCOUNT_SETTING_PROPERTY_READABLE_ENUM.LOCALE,
+ localesForLanguage,
+ otherLocales,
+ locale: activeLocale,
+ }
+ },
+
+ computed: {
+ inputId() {
+ return `account-setting-${ACCOUNT_SETTING_PROPERTY_ENUM.LOCALE}`
+ },
+
+ isEditable() {
+ return Boolean(this.locale)
+ },
+ },
+}
+</script>
+
+<style lang="scss" scoped>
+section {
+ padding: 10px 10px;
+
+ &::v-deep button:disabled {
+ cursor: default;
+ }
+}
+</style>