Adds localized description of the manifest. Fixes url of the api to the link meta nodes

parent a17ec8ae
Pipeline #18358 failed with stages
in 3 minutes and 39 seconds
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/index';
import { DefaultSettings } from '../../../../lib/default.settings';
@Injectable({
providedIn: 'root',
......@@ -15,7 +14,7 @@ export class ThemesApiService {
}
public THEMES_LINK_IMAGES_GET_URL(theme: string): string {
return `${DefaultSettings.httpLibEndpoint}/linkImages/${theme}`;
return `/assets/meta/${theme}/linkNodes.json`;
}
public getLinkImages(theme: string): Observable<Array<any>> {
......
......@@ -8,6 +8,7 @@ import { DB_TABLE, STORAGE_KEY } from '../../shared/enums';
import { ThemesApiService } from '../api/themes/themes-api.service';
import { ConnectionService } from '../connection/connection.service';
import { CurrentQuizService } from '../current-quiz/current-quiz.service';
import { I18nService } from '../i18n/i18n.service';
import { StorageService } from '../storage/storage.service';
@Injectable()
......@@ -30,6 +31,7 @@ export class ThemesService {
private connectionService: ConnectionService,
private themesApiService: ThemesApiService,
private storageService: StorageService,
private i18nService: I18nService,
) {
if (isPlatformBrowser(this.platformId)) {
this.storageService.read(DB_TABLE.CONFIG, STORAGE_KEY.DEFAULT_THEME).subscribe(val => {
......@@ -98,6 +100,9 @@ export class ThemesService {
this.themesApiService.getLinkImages(theme).subscribe(data => {
data.forEach((elem) => {
if (elem.id === 'link-manifest') {
elem.href = elem.href.replace('%%LANG%%', this.i18nService.currentLanguage.toLowerCase());
}
const previousElement = document.getElementById(elem.id);
if (previousElement) {
this.replaceExistingNode(previousElement, elem);
......
{
"manifest": {
"name": "Quiz-App der THM",
"description": "Die Quiz-App der Zukunft!"
},
"global": {
"arsnova_slogan": "Quiz-App für MINT",
"yes": "Ja",
......
{
"manifest": {
"name": "Quiz App made by THM",
"description": "The ultimate quiz app from the future!"
},
"global": {
"console-log-warning": "WARNING!\nThis will not help you cheating on any quizzes at all!\n\nAnyone who told you to use these tools may tries to compromise your computer",
"arsnova_slogan": "Quizzes for everyone & anything",
......
{
"manifest": {
"name": "Quiz App made by THM",
"description": "The ultimate quiz app from the future!"
},
"global": {
"arsnova_slogan": "Aplicación del concurso para la clase",
"back": "Volver",
......
{
"manifest": {
"name": "Quiz App made by THM",
"description": "The ultimate quiz app from the future!"
},
"global": {
"arsnova_slogan": "On quiz, On apprend!",
"back": "retour",
......
{
"manifest": {
"name": "Quiz App made by THM",
"description": "The ultimate quiz app from the future!"
},
"global": {
"arsnova_slogan": "Quiz-app per l´insegnamento",
"back": "Indietro",
......
......@@ -3,6 +3,7 @@ const fs = require('fs');
const process = require('process');
const minimist = require('minimist');
const mkdirp = require('mkdirp');
const mf = require('messageformat');
const argv = minimist(process.argv.slice(2));
......@@ -54,7 +55,7 @@ class GenerateMetaNodes {
generateLinkImages() {
themes.forEach(theme => {
const basePath = `${this.baseUrl}/assets/images/theme/${theme}`;
const manifestPath = `${this.baseUrl}/assets/manifest/${theme}`;
const manifestPath = `${this.baseUrl}/assets/meta/${theme}/manifest_%%LANG%%.json`;
const result = [
{
......@@ -136,11 +137,14 @@ class GenerateMetaNodes {
generateManifest() {
languages.forEach(language => {
const localizer = new mf(language);
const descriptionMessageSrc = JSON.parse(fs.readFileSync(path.join(this.pathToAssets, 'i18n', `${language}.json`), 'UTF-8')).manifest.description;
const descriptionMessage = localizer.compile(descriptionMessageSrc)();
themes.forEach(theme => {
const manifest = {
short_name: 'arsnovaClick',
name: 'arsnova.click',
description: '',
description: descriptionMessage,
background_color: themeData[theme].exportedAtRowStyle.bg,
theme_color: themeData[theme].exportedAtRowStyle.bg,
start_url: `${this.baseUrl}`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment