From f93c042adcc8c8ca5c8823bef865ca303908e941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Sat, 4 Apr 2020 14:33:48 +0200 Subject: [PATCH] adjusted authorship --- app/cache.js | 30 +++++++++++++++--------------- app/file.js | 2 +- app/loc.js | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/cache.js b/app/cache.js index 8b4e2e2..c50e1bf 100644 --- a/app/cache.js +++ b/app/cache.js @@ -3,7 +3,7 @@ export /*abstract */class Cache { /** * @param {string} key * @return {boolean} - * @author fenris + * @author svartoyg */ /*protected */has(key) { throw (new Error('not implemented')); @@ -12,7 +12,7 @@ export /*abstract */class Cache { /** * @param {string} key * @return {any} - * @author fenris + * @author svartoyg */ /*protected */fetch(key) { throw (new Error('not implemented')); @@ -21,7 +21,7 @@ export /*abstract */class Cache { /** * @param {string} key * @param {any} value - * @author fenris + * @author svartoyg */ /*protected */store(key, value) { throw (new Error('not implemented')); @@ -31,7 +31,7 @@ export /*abstract */class Cache { * @param {string} key * @param {()=>Promise} retrieve * @return {Promise} - * @author fenris + * @author svartoyg */ /*public */async get(key, retrieve) { if (this.has(key)) { @@ -47,32 +47,32 @@ export /*abstract */class Cache { /** - * @author fenris + * @author svartoyg */ class CacheNone extends Cache { /** - * @author fenris + * @author svartoyg */ /*public */constructor() { super(); } /** - * @author fenris + * @author svartoyg */ /*protected */has(key) { return false; } /** - * @author fenris + * @author svartoyg */ /*protected */fetch(key) { throw (new Error('not possible')); } /** - * @author fenris + * @author svartoyg */ /*protected */store(key, value) { } @@ -80,12 +80,12 @@ class CacheNone extends Cache { /** - * @author fenris + * @author svartoyg */ export class CacheLocalstorage extends Cache { /** * @param {string} [corner] for separating the cache instance from others - * @author fenris + * @author svartoyg */ /*public */constructor(corner = null) { super(); @@ -93,21 +93,21 @@ export class CacheLocalstorage extends Cache { } /** - * @author fenris + * @author svartoyg */ /*private */augmentKey(key) { return ((this.corner === null) ? key : (this.corner + '/' + key)); } /** - * @author fenris + * @author svartoyg */ /*protected */has(key) { return (window.localStorage.getItem(this.augmentKey(key)) !== null); } /** - * @author fenris + * @author svartoyg */ /*protected */fetch(key) { const valueRaw = window.localStorage.getItem(this.augmentKey(key)); @@ -116,7 +116,7 @@ export class CacheLocalstorage extends Cache { } /** - * @author fenris + * @author svartoyg */ /*protected */store(key, value) { const valueRaw = JSON.stringify(value); diff --git a/app/file.js b/app/file.js index 739a599..07c8665 100644 --- a/app/file.js +++ b/app/file.js @@ -3,7 +3,7 @@ * @param {string} path * @return Promise * @todo use Util.fetch instead? - * @author fenris + * @author svartoyg */ export async function read (path) { return ( diff --git a/app/loc.js b/app/loc.js index 1328dc6..0c2d9d7 100644 --- a/app/loc.js +++ b/app/loc.js @@ -7,7 +7,7 @@ import {read as fileRead} from './file'; * the relative path to the directory containing the JSON localization files * * @var {string} - * @author fenris + * @author svartoyg */ var _directory = 'loc'; @@ -16,7 +16,7 @@ var _directory = 'loc'; * the default language to use * * @var {string} - * @author fenris + * @author svartoyg */ var _languageDefault = null; @@ -25,14 +25,14 @@ var _languageDefault = null; * the fallback language to use * * @var {string} - * @author fenris + * @author svartoyg */ var _languageFallback = null; /** * @var {Cache} - * @author fenris + * @author svartoyg */ var _cache = null; @@ -41,7 +41,7 @@ var _cache = null; * two level map with ISO-639-1 code as first key and translation id as second key * * @var {Map>} - * @author fenris + * @author svartoyg */ var _data = {}; @@ -49,7 +49,7 @@ var _data = {}; /** * @param {string} language * @return Promise> - * @author fenris + * @author svartoyg */ async function retrieveData (language) { const regexp = (new RegExp("^([a-z]{2})$")); @@ -77,7 +77,7 @@ async function retrieveData (language) { /** * @param {string} languageDefault * @param {string} [languageFallback] - * @author fenris + * @author svartoyg */ export async function initialize (languageDefault, languageFallback = 'en') { _cache = new CacheLocalstorage('loc'); @@ -103,7 +103,7 @@ export async function initialize (languageDefault, languageFallback = 'en') { * @param {string} key * @param {string} [languageChosen] * @return {string} - * @author fenris + * @author svartoyg */ export function translate (key, languageChosen = _languageDefault) { let result = undefined;