This commit is contained in:
a-ill
2023-07-03 21:27:18 +03:00
parent a0f672439d
commit ea157a6031
28 changed files with 143 additions and 133 deletions

View File

@@ -91,14 +91,15 @@ export function loadLocaleContent(content,componentName,loaded,callback) {
locale = "en"
}
}
if (callback!=undefined) {
callback(locale)
}
getData("/locales/" + locale + "/" + componentName + ".json" ,function(response) {
let parsed = JSON.parse(response)
content.set(parsed)
if (callback!=undefined) {
callback(locale)
}
loaded = 1
})
return locale
}
export function getLocale(locale,lang) {

View File

@@ -0,0 +1,3 @@
{
"tableOfContents": "TABLE OF CONTENTS"
}

View File

@@ -1,6 +1,6 @@
{
"heading": "Кооперативы",
"p1": "Мы создаем рабочие кооперативы, которые представляют собой бизнес-модель, в которой работники владеют предприятием и контролируют его. Каждый работник имеет право голоса при принятии решений, а прибыль распределяется на основе индивидуальных вкладов. Эта структура способствует мотивации и удовлетворенности работой, создавая более приятные условия труда, а также бросает вызов концентрации богатства в традиционных капиталистических предприятиях.",
"p1": "Мы создаем рабочие кооперативы, которые представляют собой бизнес-модель, в которой работники владеют предприятием. Каждый работник имеет право голоса при принятии решений, а прибыль распределяется на основе индивидуальных вкладов. Эта структура способствует мотивации и удовлетворенности работой, создавая более приятные условия труда, а также бросает вызов концентрации богатства в традиционных капиталистических предприятиях.",
"p2": "Сосредоточив внимание на потребностях сотрудников, наши кооперативы создают благоприятную и устойчивую рабочую среду, которая способствует социальной сплоченности и гарантиям занятости. Мы также уделяем первостепенное внимание интересам местных сообществ, ориентируясь на долгосрочную перспективу. Когда решения принимают работники, мы избегаем вредных краткосрочных стратегий, ориентированных на получение прибыли, и вместо этого реинвестируем нашу прибыль, способствуя развитию и устойчивости сообщества.",
"subheading1": "Наши кооперативы",
"subheading2": "Европа",

View File

@@ -0,0 +1,3 @@
{
"tableOfContents": "ОГЛАВЛЕНИЕ"
}

View File

@@ -3,7 +3,7 @@
"manifesto": "Манифест",
"joinUs": "Присоединяйся",
"groups": "Группы",
"communities": "Сообщества",
"communities": "Коммуны",
"cooperatives": "Кооперативы",
"partners": "Партнеры"
}

View File

@@ -5,17 +5,16 @@
import { onMount } from 'svelte'
import { writable } from 'svelte/store';
import { communities, addMarkersCommunities } from '/js/communities.js'
import { loadLocaleContent, getLocale } from "/js/libraries/serverTools.js"
import { loadLocaleContent } from "/js/libraries/serverTools.js"
// Import components
import "/js/components/map-component.js"
// Main code
let loaded
let locale = []
let content = writable({})
loadLocaleContent(content,"communities-component",loaded,(lang) => getLocale(locale,lang))
let locale = loadLocaleContent(content,"communities-component",loaded)
function mapCallbackCommunities(createMap,content,locale) {
let map = createMap([51.505, -0.09],3)
@@ -40,10 +39,10 @@
<h4>{$content.subheading2}</h4>
{#each communities as community}
<div class="location-info">
<p><b>{$content.location}: </b>{community.location[0][locale[0]]}</p>
<p><b>{$content.status}: </b>{community.status[locale[0]]}</p>
<p><b>{$content.location}: </b>{community.location[0][locale]}</p>
<p><b>{$content.status}: </b>{community.status[locale]}</p>
<p><b>{$content.members}: </b>{community.members}</p>
<p><b>{$content.contact}: </b><a href={community.contact[0]} target=;_blank; rel=noreferrer>{community.contact[1][locale[0]]}</a></p>
<p><b>{$content.contact}: </b><a href={community.contact[0]} target=;_blank; rel=noreferrer>{community.contact[1][locale]}</a></p>
</div>
{/each}

View File

@@ -5,17 +5,16 @@
import { onMount } from 'svelte'
import { writable } from 'svelte/store';
import { coops, addMarkersCoops } from '/js/coops.js'
import { loadLocaleContent,getLocale } from "/js/libraries/serverTools.js"
import { loadLocaleContent } from "/js/libraries/serverTools.js"
// Import components
import "/js/components/map-component.js"
// Main code
let loaded
let locale = []
let content = writable({})
loadLocaleContent(content,"cooperatives-component",loaded,(lang) => getLocale(locale,lang))
let locale = loadLocaleContent(content,"cooperatives-component",loaded)
function mapCallbackCoops(createMap,content,locale) {
let map = createMap([51.505, -0.09],3)
@@ -43,12 +42,12 @@
<div class="img-general-info">
<div>
<p><b>{$content.name}: </b>{coop.name}</p>
<p><b>{$content.location}: </b>{coop.location[0][locale[0]]}</p>
<p><b>{$content.market}: </b>{coop.market[locale[0]]}</p>
<p><b>{$content.location}: </b>{coop.location[0][locale]}</p>
<p><b>{$content.market}: </b>{coop.market[locale]}</p>
<p><b>{$content.workers}: </b>{coop.workers}</p>
<p><b>{$content.status}: </b>{coop.status[locale[0]]}</p>
<p><b>{$content.status}: </b>{coop.status[locale]}</p>
<p><b>{$content.website}: </b><a href={"https://www."+coop.website} target="_blank" rel=noreferrer>{coop.website}</a></p>
<p><b>{$content.contact}: </b><a href={coop.contact[0]} target=;_blank; rel=noreferrer>{coop.contact[1][locale[0]]}</a></p>
<p><b>{$content.contact}: </b><a href={coop.contact[0]} target=;_blank; rel=noreferrer>{coop.contact[1][locale]}</a></p>
</div>
<picture>
<source srcset={"/img/coops/"+coop.logo+".webp"}>
@@ -56,7 +55,7 @@
<img class="coop-logo" alt="logo">
</picture>
</div>
<p><b>{$content.description}: </b>{coop.description[locale[0]]}</p>
<p><b>{$content.description}: </b>{coop.description[locale]}</p>
</div>
{/each}
</div>

View File

@@ -4,16 +4,15 @@
// Import statements
import { writable } from 'svelte/store';
import { loadLocaleContent,getLocale } from "/js/libraries/serverTools.js"
import { loadLocaleContent } from "/js/libraries/serverTools.js"
// Import components
// Main code
let loaded
let locale = []
let content = writable({})
loadLocaleContent(content,"footer-component",loaded,(lang) => getLocale(locale,lang))
let locale = loadLocaleContent(content,"footer-component",loaded)
</script>
@@ -74,7 +73,7 @@ footer p, footer a {
display: grid;
margin-left: 2rem;
margin-right: 2rem;
margin-bottom: 1.4rem;
margin-bottom: 1rem;
}
.not-logged {

View File

@@ -5,17 +5,16 @@
import { onMount } from 'svelte'
import { writable } from 'svelte/store';
import { groups, addMarkersGroups } from '/js/groups.js'
import { loadLocaleContent,getLocale } from "/js/libraries/serverTools.js"
import { loadLocaleContent} from "/js/libraries/serverTools.js"
// Import components
import "/js/components/map-component.js"
// Main code
let loaded
let locale = []
let content = writable({})
loadLocaleContent(content,"groups-component",loaded,(lang) => getLocale(locale,lang))
let locale = loadLocaleContent(content,"groups-component",loaded)
function mapCallbackGroups(createMap,content,locale) {
let map = createMap([51.505, -0.09],3)
@@ -41,9 +40,9 @@
<h4>{$content.subheading2}</h4>
{#each groups as group}
<div class="location-info">
<p><b>{$content.location}: </b>{group.location[0][locale[0]]}</p>
<p><b>{$content.location}: </b>{group.location[0][locale]}</p>
<p><b>{$content.members}: </b>{group.members}</p>
<p><b>{$content.contact}: </b><a href={group.contact[0]} target=;_blank; rel=noreferrer>{group.contact[1][locale[0]]}</a></p>
<p><b>{$content.contact}: </b><a href={group.contact[0]} target=;_blank; rel=noreferrer>{group.contact[1][locale]}</a></p>
</div>
{/each}
</div>

View File

@@ -7,17 +7,16 @@
import { addMarkersGroups } from '/js/groups.js'
import { addMarkersCoops } from '/js/coops.js'
import { addMarkersCommunities } from '/js/communities.js'
import { loadLocaleContent, getLocale } from "/js/libraries/serverTools.js"
import { loadLocaleContent } from "/js/libraries/serverTools.js"
// Import components
import "/js/components/map-component.js"
// Main code
let loaded
let locale = []
let content = writable({})
loadLocaleContent(content,"join-us-component",loaded,(lang) => getLocale(locale,lang))
let locale = loadLocaleContent(content,"join-us-component",loaded)
function mapCallback(createMap,content,locale) {
let map = createMap([51.505, -0.09],3)
@@ -55,9 +54,9 @@
<div id="call-to-action-list">
<p>{$content.findOur}</p>
<ol>
<li><a href={"/" + locale[0] + "/groups"}>{$content.group}</a>,</li>
<li><a href={"/" + locale[0] + "/communities"}>{$content.community}</a> {$content.or}</li>
<li><a href={"/" + locale[0] + "/cooperatives"}>{$content.cooperative}</a></li>
<li><a href={"/" + locale + "/groups"}>{$content.group}</a>,</li>
<li><a href={"/" + locale + "/communities"}>{$content.community}</a> {$content.or}</li>
<li><a href={"/" + locale + "/cooperatives"}>{$content.cooperative}</a></li>
</ol>
<p>{$content.nearYou}</p>
</div>

View File

@@ -24,7 +24,8 @@
}
}
loadLocaleContent(content,"landing-component",loaded,changeWidth)
let locale = loadLocaleContent(content,"landing-component",loaded,changeWidth)
changeWidth(locale)
onMount(() => {

View File

@@ -3,9 +3,10 @@
<script>
// Import statements
import { onMount } from 'svelte'
import { writable } from 'svelte/store';
import { getData } from "/js/libraries/serverTools.js"
import { px2rem } from "/js/libraries/miscTools.js"
import { locales } from "/js/libraries/serverTools.js"
import { loadLocaleContent } from "/js/libraries/serverTools.js"
// Import components
@@ -24,15 +25,12 @@
let margin = 0
let root
let main
let loaded
let content = writable({})
let locale = loadLocaleContent(content,"manifesto-component",loaded)
let locale
let localeUrl = location.href.split("/").filter(x => Object.keys(locales).includes(x))
if (localeUrl.length==0) {
locale = "en"
}
else {
locale = localeUrl[0]
}
const htmlDelims = ["ul","ol"]
getData("/locales/"+ locale + "/manifesto.txt",function(response) {
@@ -166,74 +164,78 @@
})
</script>
<div id="container" bind:this={root}>
<div id="text-container">
{#key key}
<div bind:this={contentTable} id="table-content">
<button id="toggle-content" bind:this={contentButton} on:click={() => hideBlock(contentArrow,contentBlock)}>
TABLE OF CONTENTS
<img bind:this={contentArrow} src="../assets/arrow_down.svg" alt="arrow down" style="transform: scaleY(-1)">
</button>
<div bind:this={contentBlock} class="module" style="display: initial;">
{#each contentHeadings as obj}
{#if Array.isArray(obj)}
{#each obj as obj2}
<div class="heading-button-wrapper">
<button bind:this={buttons[obj2.index]} on:click={() => goToChapter(obj2.id)} class="level1 heading-button">
{obj2.name}
</button>
</div>
{#key loaded}
{#if Object.keys($content).length!=0}
<div id="container" bind:this={root}>
<div id="text-container">
{#key key}
<div bind:this={contentTable} id="table-content">
<button id="toggle-content" bind:this={contentButton} on:click={() => hideBlock(contentArrow,contentBlock)}>
{$content.tableOfContents}
<img bind:this={contentArrow} src="../assets/arrow_down.svg" alt="arrow down" style="transform: scaleY(-1)">
</button>
<div bind:this={contentBlock} class="module" style="display: initial;">
{#each contentHeadings as obj}
{#if Array.isArray(obj)}
{#each obj as obj2}
<div class="heading-button-wrapper">
<button bind:this={buttons[obj2.index]} on:click={() => goToChapter(obj2.id)} class="level1 heading-button">
{obj2.name}
</button>
</div>
{/each}
{:else}
<div class="heading-button-wrapper">
<button bind:this={buttons[obj.index]} on:click={() => goToChapter(obj.id)} class="level0 heading-button">
{obj.name}
</button>
</div>
{/if}
{/each}
{:else}
<div class="heading-button-wrapper">
<button bind:this={buttons[obj.index]} on:click={() => goToChapter(obj.id)} class="level0 heading-button">
{obj.name}
</button>
</div>
{/if}
{/each}
</div>
</div>
</div>
<div id="main" bind:this={main}>
{#each manifesto as line}
{#if line!==""}
{#if typeof (line === 'object') && (Object.keys(line)[0]=="ul")}
<ul>
{#each line.ul as line2}
<li>{line2}</li>
{/each}
</ul>
{:else if typeof (line === 'object') && (Object.keys(line)[0]=="ol")}
<ol>
{#each line.ol as line2}
<li>
{@html line2}
</li>
{/each}
</ol>
{:else if typeof (line === 'object') && (line.type=="h3")}
<button on:click ={contentTable.scrollIntoView({block: 'start'}, true)} style="display: block; width: 100%;">
<h3 bind:this={headingsObjects[line.id]} id={line.id}>{@html line.line}</h3>
</button>
{:else if typeof (line === 'object') && (line.type=="h2")}
<button on:click ={contentTable.scrollIntoView({block: 'start'}, true)} style="display: block; width: 100%;">
<h2 bind:this={headingsObjects[line.id]} id={line.id}>{@html line.line}</h2>
</button>
{:else if line[0]=="#"}
<h1>{@html line.slice(2,line.length)}</h1>
{:else}
<p class="margin-end">
{@html line}
</p>
{/if}
{:else if false}
<b></b>
{/if}
{/each}
</div>
{/key}
</div>
<div id="main" bind:this={main}>
{#each manifesto as line}
{#if line!==""}
{#if typeof (line === 'object') && (Object.keys(line)[0]=="ul")}
<ul>
{#each line.ul as line2}
<li>{line2}</li>
{/each}
</ul>
{:else if typeof (line === 'object') && (Object.keys(line)[0]=="ol")}
<ol>
{#each line.ol as line2}
<li>
{@html line2}
</li>
{/each}
</ol>
{:else if typeof (line === 'object') && (line.type=="h3")}
<button on:click ={contentTable.scrollIntoView({block: 'start'}, true)} style="display: block; width: 100%;">
<h3 bind:this={headingsObjects[line.id]} id={line.id}>{@html line.line}</h3>
</button>
{:else if typeof (line === 'object') && (line.type=="h2")}
<button on:click ={contentTable.scrollIntoView({block: 'start'}, true)} style="display: block; width: 100%;">
<h2 bind:this={headingsObjects[line.id]} id={line.id}>{@html line.line}</h2>
</button>
{:else if line[0]=="#"}
<h1>{@html line.slice(2,line.length)}</h1>
{:else}
<p class="margin-end">
{@html line}
</p>
{/if}
{:else if false}
<b></b>
{/if}
{/each}
</div>
{/key}
</div>
</div>
</div>
{/if}
{/key}
<style>

View File

@@ -5,17 +5,16 @@
// Import statements
import { onMount, getContext } from 'svelte'
import { writable } from 'svelte/store'
import { loadLocaleContent, getLocale, locales } from "/js/libraries/serverTools.js"
import { loadLocaleContent, locales } from "/js/libraries/serverTools.js"
// Main code
let hambInput
let navbar
let localesDropdown
let loaded
let locale = []
let content = writable({})
loadLocaleContent(content,"navbar-component",loaded,(lang) => getLocale(locale,lang))
let locale = loadLocaleContent(content,"navbar-component",loaded)
function changeNavbar() {
if (hambInput.checked) {
@@ -65,7 +64,7 @@
<input bind:this={hambInput} type="checkbox" id="side-menu" on:click={changeNavbar}>
<label id="hamb" for="side-menu"><span id="hamb-line"></span></label>
<!-- Logo -->
<a id=logo-container href={"/" + locale[0] + "/"}>
<a id=logo-container href={"/" + locale + "/"}>
<img src="/img/common/flag.png" id="navbar-logo" alt="logo">
<span id="navbar-logo-text">{$content.orgName}</span>
</a>

View File

@@ -4,7 +4,7 @@
// Import statements
import { onMount } from 'svelte'
import { writable } from 'svelte/store';
import { loadLocaleContent,getLocale } from "/js/libraries/serverTools.js"
import { loadLocaleContent } from "/js/libraries/serverTools.js"
//import { communities, addMarkersCommunities } from '/js/communities.js'
// Import components
@@ -12,10 +12,9 @@
// Main code
let loaded
let locale = []
let content = writable({})
loadLocaleContent(content,"partners-component",loaded,(lang) => getLocale(locale,lang))
let locale = loadLocaleContent(content,"partners-component",loaded)
let partners = [
{
@@ -58,11 +57,11 @@
</picture>
<div>
<p><b>{$content.name}: </b>{partner.name}</p>
<p><b>{$content.type}: </b>{partner.type[locale[0]]}</p>
<p><b>{$content.type}: </b>{partner.type[locale]}</p>
<p><b>{$content.link}: </b><a href={partner.link} target=;_blank; rel=noreferrer>{partner.link}</a></p>
</div>
</div>
<p><b>{$content.description}: </b>{partner.description[locale[0]]}</p>
<p><b>{$content.description}: </b>{partner.description[locale]}</p>
</div>
{/each}
</div>