Show languages on instance about
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
c66e4d5d83
commit
fb8e94c4e3
@ -9,6 +9,7 @@ export const CONFIG = gql`
|
|||||||
registrationsAllowlist
|
registrationsAllowlist
|
||||||
demoMode
|
demoMode
|
||||||
countryCode
|
countryCode
|
||||||
|
languages
|
||||||
anonymous {
|
anonymous {
|
||||||
participation {
|
participation {
|
||||||
allowed
|
allowed
|
||||||
@ -93,6 +94,7 @@ export const ABOUT = gql`
|
|||||||
description
|
description
|
||||||
longDescription
|
longDescription
|
||||||
contact
|
contact
|
||||||
|
languages
|
||||||
registrationsOpen
|
registrationsOpen
|
||||||
registrationsAllowlist
|
registrationsAllowlist
|
||||||
anonymous {
|
anonymous {
|
||||||
|
@ -11,6 +11,7 @@ export interface IConfig {
|
|||||||
registrationsAllowlist: boolean;
|
registrationsAllowlist: boolean;
|
||||||
demoMode: boolean;
|
demoMode: boolean;
|
||||||
countryCode: string;
|
countryCode: string;
|
||||||
|
languages: string[];
|
||||||
location: {
|
location: {
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
|
@ -42,6 +42,10 @@
|
|||||||
<section class="config">
|
<section class="config">
|
||||||
<h3 class="subtitle">{{ $t("Instance configuration") }}</h3>
|
<h3 class="subtitle">{{ $t("Instance configuration") }}</h3>
|
||||||
<table class="table is-fullwidth">
|
<table class="table is-fullwidth">
|
||||||
|
<tr>
|
||||||
|
<td>{{ $t("Instance languages") }}</td>
|
||||||
|
<td>{{ formatList(config.languages.map((lang) => getLanguageNameForCode(lang))) }}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $t("Mobilizon version") }}</td>
|
<td>{{ $t("Mobilizon version") }}</td>
|
||||||
<td>{{ config.version }}</td>
|
<td>{{ config.version }}</td>
|
||||||
@ -73,10 +77,12 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
|
import { formatList } from "@/utils/i18n";
|
||||||
import { ABOUT } from "../../graphql/config";
|
import { ABOUT } from "../../graphql/config";
|
||||||
import { STATISTICS } from "../../graphql/statistics";
|
import { STATISTICS } from "../../graphql/statistics";
|
||||||
import { IConfig } from "../../types/config.model";
|
import { IConfig } from "../../types/config.model";
|
||||||
import { IStatistics } from "../../types/statistics.model";
|
import { IStatistics } from "../../types/statistics.model";
|
||||||
|
import langs from "../../i18n/langs.json";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
apollo: {
|
apollo: {
|
||||||
@ -89,6 +95,8 @@ export default class AboutInstance extends Vue {
|
|||||||
|
|
||||||
statistics!: IStatistics;
|
statistics!: IStatistics;
|
||||||
|
|
||||||
|
formatList = formatList;
|
||||||
|
|
||||||
get isContactEmail(): boolean {
|
get isContactEmail(): boolean {
|
||||||
return this.config && this.config.contact.includes("@");
|
return this.config && this.config.contact.includes("@");
|
||||||
}
|
}
|
||||||
@ -97,6 +105,12 @@ export default class AboutInstance extends Vue {
|
|||||||
return this.config && this.config.contact.match(/^https?:\/\//g) !== null;
|
return this.config && this.config.contact.match(/^https?:\/\//g) !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line class-methods-use-this
|
||||||
|
getLanguageNameForCode(code: string): string {
|
||||||
|
const languageMaps = langs as Record<string, any>;
|
||||||
|
return languageMaps[code];
|
||||||
|
}
|
||||||
|
|
||||||
generateConfigLink(): { uri: string; text: string } | null {
|
generateConfigLink(): { uri: string; text: string } | null {
|
||||||
if (!this.config.contact) return null;
|
if (!this.config.contact) return null;
|
||||||
if (this.isContactEmail) {
|
if (this.isContactEmail) {
|
||||||
|
Loading…
Reference in New Issue
Block a user