Change many lines
This commit is contained in:
5
src/lib/data/album.js
Normal file
5
src/lib/data/album.js
Normal file
@ -0,0 +1,5 @@
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
const album = {error: "Not found"};
|
||||
/** @type {import('svelte/store').Writable<ApiError | Album>} */
|
||||
export default writable(album);
|
||||
69
src/lib/data/language.js
Normal file
69
src/lib/data/language.js
Normal file
@ -0,0 +1,69 @@
|
||||
import { writable, derived } from "svelte/store";
|
||||
|
||||
/** @type {import('svelte/store').Writable<TranslationKey>} */
|
||||
export const language = writable('de');
|
||||
|
||||
/**
|
||||
* @type {Record<TranslationKey, Record<String, String>>}
|
||||
*/
|
||||
const translations = {
|
||||
de: {
|
||||
'gallery': 'Galerie',
|
||||
'album': 'Album',
|
||||
'albums': 'Alben',
|
||||
'photo': 'Foto',
|
||||
'photos': 'Fotos',
|
||||
'video': 'Video',
|
||||
'videos': 'Videos',
|
||||
'back': 'Zurück',
|
||||
'small': 'Klein',
|
||||
'medium': 'Mittel',
|
||||
'large': 'Groß',
|
||||
'open': 'Öffnen',
|
||||
'download': 'Herunterladen',
|
||||
'download-all': 'Alle herunterladen',
|
||||
},
|
||||
en: {
|
||||
'gallery': 'Gallery',
|
||||
'album': 'Album',
|
||||
'albums': 'Albums',
|
||||
'photo': 'Photo',
|
||||
'photos': 'Photos',
|
||||
'video': 'Video',
|
||||
'videos': 'Videos',
|
||||
'back': 'Back',
|
||||
'small': 'Small',
|
||||
'medium': 'Medium',
|
||||
'large': 'Large',
|
||||
'open': 'Open',
|
||||
'download': 'Download',
|
||||
'download-all': 'Download all',
|
||||
}
|
||||
};
|
||||
|
||||
export const str = derived(language, $language => {
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {...any} args
|
||||
*/
|
||||
function translate(key, ...args) {
|
||||
const str = translations[$language][key];
|
||||
if (str === undefined) return key;
|
||||
return str.replace(/\{(\d+)\}/g, (_, i) => args[i]);
|
||||
}
|
||||
return translate;
|
||||
});
|
||||
|
||||
export const strf = derived(language, $language => {
|
||||
/**
|
||||
* @param {Translation | string} translations
|
||||
* @param {...any} args
|
||||
*/
|
||||
function translate(translations, ...args) {
|
||||
if (typeof translations === 'string') return translations;
|
||||
const str = translations[$language];
|
||||
if (str === undefined) return translations.de;
|
||||
return str.replace(/\{(\w+)\}/g, (_, i) => args[i]);
|
||||
}
|
||||
return translate;
|
||||
});
|
||||
73
src/lib/data/licenses.json
Normal file
73
src/lib/data/licenses.json
Normal file
@ -0,0 +1,73 @@
|
||||
[
|
||||
{
|
||||
"type": "cc0",
|
||||
"title": "CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
|
||||
"text": {
|
||||
"de": "Sie sind berechtigt, dieses Werk zu kopieren, verändern, verbreiten und aufzuführen, selbst für kommerzielle Zwecke, <b>ohne um weitere Erlaubnis bitten zu müssen</b>.",
|
||||
"en": "You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission."
|
||||
},
|
||||
"url": "https://creativecommons.org/publicdomain/zero/1.0/"
|
||||
},
|
||||
{
|
||||
"type": "cc-by",
|
||||
"title": "Creative Commons Attribution 4.0 International (CC BY 4.0)",
|
||||
"text": {
|
||||
"de": "Sie sind berechtigt, dieses Werk zu kopieren, verändern, verbreiten und aufzuführen, selbst für kommerzielle Zwecke, <b>wenn Sie den Namen des Autors nennen</b>, die Lizenz erwähnen und ggf. angeben, ob Veränderungen vorgenommen wurden.",
|
||||
"en": "You can copy, modify, distribute and perform the work, even for commercial purposes, <b>if you give appropriate credit</b>, mention the license and indicate if changes were made."
|
||||
},
|
||||
"url": "https://creativecommons.org/licenses/by/4.0/"
|
||||
},
|
||||
{
|
||||
"type": "cc-by-sa",
|
||||
"title": "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)",
|
||||
"text": {
|
||||
"de": "Sie sind berechtigt, dieses Werk zu kopieren, verändern, verbreiten und aufzuführen, selbst für kommerzielle Zwecke, <b>wenn Sie den Namen des Autors nennen</b>, die Lizenz erwähnen und ggf. angeben, ob Veränderungen vorgenommen wurden. Wenn Sie das Werk verändern, dürfen Sie das veränderte Werk nur <b>unter derselben Lizenz</b> verbreiten.",
|
||||
"en": "You can copy, modify, distribute and perform the work, even for commercial purposes, <b>if you give appropriate credit</b>, mention the license and indicate if changes were made. If you remix, transform, or build upon the material, you must distribute your contributions <b>under the same license</b> as the original."
|
||||
},
|
||||
"url": "https://creativecommons.org/licenses/by-sa/4.0/"
|
||||
},
|
||||
{
|
||||
"type": "cc-by-nc",
|
||||
"title": "Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)",
|
||||
"text": {
|
||||
"de": "Sie sind berechtigt, dieses Werk zu kopieren, verändern, verbreiten und aufzuführen, <b>wenn Sie den Namen des Autors nennen</b>, die Lizenz erwähnen und ggf. angeben, ob Veränderungen vorgenommen wurden. Sie dürfen das Werk <b>nicht für kommerzielle Zwecke</b> nutzen.",
|
||||
"en": "You can copy, modify, distribute and perform the work, <b>if you give appropriate credit</b>, mention the license and indicate if changes were made. You may use the material only for <b>non commercial purposes</b>."
|
||||
},
|
||||
"url": "https://creativecommons.org/licenses/by-nc/4.0/"
|
||||
},
|
||||
{
|
||||
"type": "cc-by-nc-sa",
|
||||
"title": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)",
|
||||
"text": {
|
||||
"de": "Sie sind berechtigt, dieses Werk zu kopieren, verändern, verbreiten und aufzuführen, <b>wenn Sie den Namen des Autors nennen</b>, die Lizenz erwähnen und ggf. angeben, ob Veränderungen vorgenommen wurden. Sie dürfen das Werk <b>nicht für kommerzielle Zwecke</b> nutzen. Wenn Sie das Werk verändern, dürfen Sie das veränderte Werk nur <b>unter derselben Lizenz</b> verbreiten.",
|
||||
"en": "You can copy, modify, distribute and perform the work, <b>if you give appropriate credit</b>, mention the license and indicate if changes were made. You may use the material only for <b>non commercial purposes</b>. If you remix, transform, or build upon the material, you must distribute your contributions <b>under the same license</b> as the original."
|
||||
},
|
||||
"url": "https://creativecommons.org/licenses/by-nc-sa/4.0/"
|
||||
},
|
||||
{
|
||||
"type": "cc-by-nd",
|
||||
"title": "Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)",
|
||||
"text": {
|
||||
"de": "Sie sind berechtigt, dieses Werk zu kopieren, verbreiten und aufzuführen, selbst für kommerzielle Zwecke, <b>wenn Sie den Namen des Autors nennen</b> und die Lizenz erwähnen. Sie dürfen das Werk <b>nicht verändern</b>.",
|
||||
"en": "You can copy, distribute and perform the work, even for commercial purposes, <b>if you give appropriate credit</b> and mention the license. You may <b>not alter</b> the work in any way."
|
||||
},
|
||||
"url": "https://creativecommons.org/licenses/by-nd/4.0/"
|
||||
},
|
||||
{
|
||||
"type": "cc-by-nc-nd",
|
||||
"title": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)",
|
||||
"text": {
|
||||
"de": "Sie sind berechtigt, dieses Werk zu kopieren, verbreiten und aufzuführen, <b>wenn Sie den Namen des Autors nennen</b> und die Lizenz erwähnen. Sie dürfen das Werk <b>nicht verändern</b> und <b>nicht für kommerzielle Zwecke</b> nutzen.",
|
||||
"en": "You can copy, distribute and perform the work, <b>if you give appropriate credit</b> and mention the license. You may <b>not alter</b> the work in any way and may use the material only for <b>non commercial purposes</b>."
|
||||
},
|
||||
"url": "https://creativecommons.org/licenses/by-nc-nd/4.0/"
|
||||
},
|
||||
{
|
||||
"type": "all-rights-reserved",
|
||||
"title": "All rights reserved",
|
||||
"text": {
|
||||
"de": "Alle Rechte vorbehalten. Dieses Werk darf ohne Erlaubnis des Autors <b>nicht kopiert, verändert, verbreitet oder aufgeführt</b> werden.",
|
||||
"en": "All rights reserved. This work <b>may not be copied, modified, distributed or performed</b> without the permission of the author."
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user