-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
386 lines (363 loc) · 20.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<!DOCTYPE html>
<html class="js-focus-visible" data-js-focus-visible="" dir="ltr" lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lingualibre Languages Gallery</title>
<link id="style-fonts" rel="stylesheet" href="css/fonts.css">
<link id="style-main" rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="https://lingualibre.org/resources/assets/logo/lingualibre-favicon.ico">
</head>
<body>
<div id="app">
<noscript>Please enable JavaScript to run this app</noscript>
<div id="root">
<div id="main" class="languages">
<main id="content" class="languages">
<div class="page languages-page">
<div class="page__wrapper">
<p class="ribon-message">This new datasets and languages gallery is under test. If necessary, you can <a class="link"
href="https://github.com/hugolpz/LanguagesGallery/issues/">report an issue</a> or <a class="link"
href="https://github.com/hugolpz/LanguagesGallery/#contribute">contribute</a> on Github</a>.
</p>
<div class="top">
<h1 class="page-heading">Languages <span class="count">({{ filteredLanguages.filter(language => Number(language.records) >= 0 ).length }})</span></h1>
<div class="text">
<div id="contribute" class="inner">
<p>Don't see your language on Lingualibre yet? </p><a class="button outline rounded"
href="https://lingualibre.org/index.php?title=Special:UserLogin&returnto=Special%3ARecordWizard&returntoquery=">Log
in and record a few words</a>
<!-- SEARCH INPUT -->
<div id="search" class="search sticky" >
<input type="text" placeholder="Search by language name" value="fren" class="" v-model="search">
<button type="button" class="text-button " style="padding: 0px;">
<img src="assets/search.svg" title="" alt="icon">
</button>
</div>
</div>
</div>
</div>
<div class="language-sections" v-for="(threshold, index) in thresholds" :key="index">
<section class="launched">
<div class="title-and-search">
<!-- TITLE OF GROUP -->
<h2 class="language-sections__heading"
:id="'threshold-'+meaningfulNumber(threshold)">
Languages with over {{ meaningfulNumber(threshold) }} recordings
<span class="count">({{ filteredLanguages.filter(language => (thresholds[index-1] ||
100000000) > Number(language.records) && Number(language.records) >= thresholds[index] ).length
}})</span>
</h2>
</div>
<!-- Descriptor -->
<div class="page-text-content">
<p
v-if="filteredLanguages.filter(language => (thresholds[index-1] || 100000000) > Number(language.records) && Number(language.records) >= thresholds[index] ).length > 0">
<i>For activated languages <a class="link"
href="https://lingualibre.org/wiki/Special:RecordWizard">log in and start recording
vocabulary</a>, most languages have vocabulary lists ready to record : at Step 3, search <code
style="white-space: nowrap;">"List:{your_ISO}/Unilex"</code>.</i></p>
<p v-else>
<i>No language matching this search and conditions, please try another search or <a class="link"
href="https://lingualibre.org/wiki/Special:RecordWizard">record a few words</a>.</i>
</p>
</div>
<div class="languages-page__language-cards">
<!-- Component languageCard -->
<div class="LanguageCard--NQpAM"
:id="language.iso"
v-for="language in filteredLanguages.filter(language => (thresholds[index-1] || 100000000) > Number(language.records) && Number(language.records) >= thresholds[index] )">
<div class="LanguageCardContent--HJkVa">
<!-- TITRES -->
<h3 class="LanguageCardHeading--mV8ad">{{language.languageLabelNative || language.itemLabel ||
language.languageLabel}}</h3>
<span>{{ meaningfulNumber(language.population,'short',zero='Unkown number of') }} speakers
worldwide</span>
<!-- DATA TABLE -->
<div class="Data--JRpje">
<!-- DATA ITEM -->
<div class="DataItem--r5BlZ">
<h4 class="DataItemHeading--QFQyU">
<!-- <i class="DataItemHeadingIcon--tW9fa icon1"></i> SEE CSS "TEST" -->
<svg class='DataItemHeadingIcon--tW9fa' width='13' height='13' viewBox='0 0 13 13'
xmlns='http://www.w3.org/2000/svg'>
<path
d='M7.9 8.5c-.2.1-.2.4 0 .5l.2.5-.2.5c-.2.1-.2.3 0 .5l.2.1.3-.1a1.4 1.4 0 0 0 0-2 .4.4 0 0 0-.5 0ZM9.4 7.2v.6a2.4 2.4 0 0 1 0 3.4v.5l.3.2s.2 0 .3-.2a3.2 3.2 0 0 0 0-4.5.4.4 0 0 0-.6 0Z'>
</path>
<path
d='M11.6 6.1a.4.4 0 0 0-.6 0v.5a4 4 0 0 1 0 5.7v.6h.6a4.8 4.8 0 0 0 0-6.8ZM8 6.5c0-.3 0-.5-.3-.7l-1.1-.6C6 2.2 3.4.2.4 0 .2 0 0 .2 0 .4s.2.4.4.4c2.6 0 5 2.1 5.5 4.7l.1.3 1.3.7-1.2.7-.2.3-.2.7H3.2c-.2 0-.4.1-.4.4A3 3 0 0 0 4 10.9c-1 .8-2.2 1.3-3.5 1.3-.2 0-.4.2-.4.4s.2.4.4.4c1.6 0 3.2-.7 4.4-1.9v-.3l-.1-.3c-.6-.3-1-1-1-1.6H6c.1 0 .3 0 .3-.2l.3-1 1-.6c.3 0 .5-.3.5-.6Z'>
</path>
<path d='M3.1 5.5h.4l.1-.3V4.9a.4.4 0 0 0-.5 0H3l-.1.3v.2l.2.1Z'></path>
</svg>Speakers
</h4>
<p class="DataItemValue--G3soc">{{ meaningfulNumber(language.speakers) }}</p>
</div>
<!-- DATA ITEM 2 -->
<div class="DataItem--r5BlZ">
<!-- SVG & Dimension -->
<h4 class="DataItemHeading--QFQyU">
<svg class='DataItemHeadingIcon--tW9fa' width='13' height='13' viewBox='0 0 25 25'
xmlns='http://www.w3.org/2000/svg'>
<path
d='M16.923 17.318c.201.612.461 1.251.463 1.895v3.79c0 .598-.215.997-.827.997-.613 0-.638-.399-.638-.997v-3.89c.103-.797-.397-1.396-.907-1.894-.306-.3-.245-.323-.204-.612.102-.4.143-.757.816-.699 2.96-.299 5.912-1.681 5.912-6.368 0-1.097-.603-2.194-1.419-3.091-.307-.3-.307-.699-.205-.998.307-.797.307-1.98.102-2.778-.51.1-1.711.4-3.038 1.296-.205.2-.51.2-.817.1a12.487 12.487 0 0 0-6.635 0c-.306.1-.612.1-.919-.1-1.225-.897-2.535-1.196-3.046-1.296-.205.798-.205 1.981.101 2.778.102.4.102.798-.204.998-.816.897-1.225 1.994-1.225 3.091 0 4.687 2.57 6.061 5.532 6.36.408 0 .714.3.816.7.102.397 0 .419-.204.619-.51.498-.714 1.097-.714 1.795v3.889c0 .598-.017.997-.629.997-.613 0-.835-.399-.835-.997v-1.888c-3.062.498-4.006-1.197-4.924-2.294-.408-.5-.714-.897-1.123-.997-.51-.1-1.302-.505-1.098-1.004.102-.498.714-.705 1.225-.506 1.02.3 1.633.997 2.245 1.695.817 1.097 1.531 1.895 3.675 1.496.05-1.199.248-1.547.455-2.087-2.858-.598-6.069-2.393-6.069-7.678 0-1.496.51-2.892 1.429-3.99-.408-1.395-.306-2.692.306-3.988a.91.91 0 0 1 .613-.599c.408-.1 1.543-.299 4.298 1.397 2.247-.499 4.979-.499 7.123 0 2.654-1.696 3.89-1.496 4.298-1.397.306.1.51.3.613.599.51 1.296.612 2.593.306 3.889A6.175 6.175 0 0 1 23 9.54c0 5.684-3.627 7.28-6.077 7.778z' />
</svg>
Gender split
</h4>
<!-- Value -->
<p data-testid="clip-recorded-hour" class="DataItemValue--G3soc">
<span>♀{{ meaningfulNumber(language.speakersFemales) }}</span>
<span>{{ language.speakersOthers?meaningfulNumber(language.speakersOthers,'shorter'):''
}}</span>
<span>{{ meaningfulNumber(language.speakersMales) }}♂</span>
</p>
<div class="progress--Te4aM">
<!-- SPAN TRIAL -->
<div class="visually-hidden">{{ percent(language.speakersFemales,language.speakers) }}%
</div>
<div class="progressBar--u2kfl progress-females"
:style="{ width: percent(+language.speakersFemales,language.speakers)+'%'}"></div>
<div class="visually-hidden">{{ percent(language.speakersOthers,language.speakers) }}%
</div>
<div class="progressBar--u2kfl progress-others" :style="{
width: percent(language.speakersOthers,language.speakers)+'%',
left: percent(+language.speakersFemales,language.speakers)+'%'
}"></div>
</div>
</div>
<!-- DATA ITEM 3 -->
<div class="DataItem--r5BlZ">
<h4 class="DataItemHeading--QFQyU">
<svg class='DataItemHeadingIcon--tW9fa' width='13' height='13' viewBox='0 0 13 13'
xmlns='http://www.w3.org/2000/svg'>
<path
d='M5.8 2.3h5.6a.4.4 0 1 0 0-.8H5.8a.4.4 0 1 0 0 .8ZM7.2 10.7H.4a.4.4 0 1 0 0 .8h6.8a.4.4 0 1 0 0-.8ZM.4 5.4H10a.4.4 0 1 0 0-.8H.4c-.2 0-.4.2-.4.4s.2.4.4.4ZM0 8c0 .2.2.4.4.4h12.2a.4.4 0 1 0 0-.8H.4c-.2 0-.4.2-.4.4ZM9.8 10.7H9a.4.4 0 1 0 0 .8h.7c.1.2.1.6-.1.8-.2.2-.2.4 0 .6l.2.1.3-.1c.6-.6.6-1.5 0-2.1l-.3-.1ZM12.3 10.7h-.9a.4.4 0 1 0 0 .8h.7c.2.2.2.6 0 .8-.2.2-.2.4 0 .6l.2.1.3-.1c.6-.6.5-1.5 0-2.1l-.3-.1ZM3.2 2.3H4a.4.4 0 1 0 0-.8h-.7a.7.7 0 0 1 .1-.8c.2-.2.2-.4 0-.6a.4.4 0 0 0-.5 0c-.6.6-.6 1.5 0 2.1l.3.1ZM.7 2.3h.9a.4.4 0 1 0 0-.8H.9a.7.7 0 0 1 0-.8c.2-.2.2-.4 0-.6a.4.4 0 0 0-.5 0C0 .7 0 1.6.4 2.2l.3.1Z'>
</path>
</svg>Unique words vs recordings ratio
</h4>
<!-- Value -->
<p data-testid="clip-recorded-hour" class="DataItemValue--G3soc">
<span>{{ meaningfulNumber(language.words) }}</span>
<span>{{ meaningfulNumber(language.records) }}</span>
</p>
<div class="progress--Te4aM">
<!-- DIV TRIAL -->
<div class="visually-hidden">{{ percent(language.words,language.records) }}%</div>
<div class="progressBar--u2kfl progress-words"
:style="{ width: percent(language.words,language.records)+'%'}"></div>
</div>
</div>
<!-- DATA ITEM 4 -->
<div class="DataItem--r5BlZ">
<!-- SVG & Dimension -->
<h4 class="DataItemHeading--QFQyU">
<svg class='DataItemHeadingIcon--tW9fa' width='13' height='13' viewBox='0 0 13 13'
xmlns='http://www.w3.org/2000/svg'>
<path
d='M6.904 1.386c0-.517-.775-.517-.775 0V6.48c0 .103.041.193.112.266l3.685 3.785c.186.236.381.15.541 0a.378.378 0 0 0 0-.54L6.894 6.323z' />
<path
d='M12.267 6.104A5.79 5.79 0 0 0 6.883.72c-.337-.01-.466-.004-.775.01A5.762 5.762 0 0 0 .735 6.104a5.06 5.06 0 0 0 0 .776c.194 3.008 2.702 5.404 5.76 5.404 3.06 0 5.568-2.396 5.761-5.404.032-.363.027-.5.011-.776zM1.49 6.493c0-2.763 2.244-5.027 5.007-5.027a5.026 5.026 0 0 1 5.016 5.017A5.027 5.027 0 0 1 6.5 11.5a5.014 5.014 0 0 1-5.01-5.008z' />
</svg>
Recordings gender split
</h4>
<!-- Value -->
<p data-testid="clip-recorded-hour" class="DataItemValue--G3soc">
<span>{{ meaningfulNumber(language.recordsFemale,"short",0) }}</span>
<span>{{ meaningfulNumber(language.recordsOthers,"shorter",'') }}</span>
<span>{{ meaningfulNumber(language.recordsMale,"short",0) }}</span>
</p>
<div class="progress--Te4aM">
<div class="visually-hidden">{{ percent(language.recordsFemale,language.records) || 0 }}%
</div>
<div class="progressBar--u2kfl progress-females"
:style="{ width: percent(language.recordsFemale,language.records) +'%'}"></div>
<div class="progressBar--u2kfl progress-others" :style="{
width: percent(language.recordsOthers,language.records)+'%',
left: percent(language.recordsFemale,language.records)+'%'
}"></div>
</div>
</div>
</div>
</div>
<div class="LanguageCardFooter" style="display: flex;">
<a class="cta--IQ7M2" href="https://lingualibre.org/wiki/Special:RecordWizard"
style="display:inline-block;width:50%;">Contribute</a>
<a class="cta--IQ7M2" :href="datasetUrl(language)"
style="display:inline-block;width:auto;">Download</a>
</div>
</div>
</div>
</section>
</div>
<div class="footer">
<div class="page-text-content">
<p>
Data from LinguaLibre.org,
SPARQL2DATA by Yug & Elfix,
Webpage forked from <a class="link" href="https://commonvoice.mozilla.org/en/languages">Common
Voice</a> (<a class="link"
href="https://github.com/common-voice/common-voice/blob/main/LICENSE">MPL 2.0</a>). VueJS single
page adaptations by Yug (MPL). This is an open source project <a class="link"
href="https://github.com/hugolpz/LanguagesGallery">you can contribute</a> using simple HTML, CSS
and JS.</p>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<script>
// https://codepen.io/jcesar020/pen/wpbKoK?editors=1111
// https://cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.min.js
// https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js
/* ************************************************** */
/* DATA ********************************************* */
var data = [
{
"code": "epo",
"iso": "epo",
"isoLabel": "Esperanto",
"itemLabel": "Esperanto",
"language": "Q25",
"languageLabel": "Esperanto",
"languageLabelNative": "Esperanto",
"languageLabelsCount": "1",
"percent": "85.7",
"population": "2000000",
"populationQualifier": "1-10M",
"records": "33842",
"speakers": "18",
"speakersFemales": "0",
"speakersMales": "17",
"speakersOthers": "1",
"wiki": "eo",
"wikidata": "Q143",
"words": "28993"
},
{
"code": "eng",
"iso": "eng",
"isoLabel": "English",
"itemLabel": "English",
"language": "Q22",
"languageLabel": "English",
"languageLabelNative": "English",
"languageLabelsCount": "1",
"percent": "88.2",
"population": "753359540",
"populationQualifier": ">100M",
"records": "30745",
"recordsFemale": "1995",
"recordsMale": "26060",
"speakers": "103",
"speakersFemales": "22",
"speakersMales": "73",
"speakersOthers": "8",
"wiki": "en",
"wikidata": "Q1860",
"words": "27132"
},
{
"code": "ukr",
"iso": "ukr",
"isoLabel": "українська мова",
"itemLabel": "Ukrainian",
"language": "Q43",
"languageLabel": "Ukrainian",
"languageLabelNative": "українська мова",
"languageLabelsCount": "1",
"percent": "99.3",
"population": "27300000",
"populationQualifier": "10-100M",
"records": "26280",
"recordsFemale": "7125",
"recordsMale": "19155",
"speakers": "10",
"speakersFemales": "3",
"speakersMales": "7",
"speakersOthers": "0",
"wiki": "uk",
"wikidata": "Q8798",
"words": "26087"
},
];
/* ************************************************** */
/* VUEJS ******************************************** */
var app=new Vue({
el: "#main",
data: function() {
return {
languages: data,
thresholds: [20000, 3000, 300, 50, 0],
search: '',
urlParams: new URLSearchParams(window.location.search),
}
},
methods: {
meaningfulNumber: function(num,suffixType='short',zero=null) {
var na,k,M; // pretty suffixes
suffixType=='shorter' ||
suffixType == 'short'?(na='n.a.',k='k', M='M')
:suffixType == 'long'?(na='Undocumented',k=' thousands', M=' millions')
:(na='',k=',000',M =',000,000');
if(zero){na = zero}
// pretty numbers
var numStr =
num == undefined ? ''+na
: num == 0? 0
: num < 1000? num
: num < 10000 && !suffixType=='shorter'? num
: num < 100000? (Math.round(num / 100)/10) +k
: num < 1000000? (Math.round(num / 1000)) +k
: num < 20000000? (Math.round(num / 100000)/10) +M
: num < 200000000? (Math.round(num / 1000000)) +M
:(Math.round(num / 10000000)*10) +M;
return numStr;
},
percent : function(num,all) {
return Math.round(100*num/all*10)/10;
},
datasetUrl: function(item) { return 'https://lingualibre.org/datasets/'+[item.language.split("/").pop(),item.iso,item.languageLabel].join('-')+'.zip';
},
async fetchUrlParams() {
this.search = this.urlParams.get('search')||'';
this.enlighten = this.urlParams.get('enlighten')||'';
},
// Not used:
getData: function(){
var url = 'https://jsonplaceholder.typicode.com/data';
axios.get(url).then(response =>{
this.lists = response.data
});
},
},
computed: {
filteredLanguages: function(){
var self=this;
var filterItems= function(item){
console.log(item)
var matchEnglish = item.languageLabel?item.languageLabel.toLowerCase().indexOf(self.search.toLowerCase())>=0 : false;
var matchNative = item.languageLabelNative?item.languageLabelNative.toLowerCase().indexOf(self.search.toLowerCase())>=0 : false;
return match = matchEnglish || matchNative ;
}
return this.languages.filter(filterItems);
//return this.language;
}
},
mounted() {
this.fetchUrlParams();
fetch('https://hugolpz.github.io/Sparql2Data/data/languages-gallery.json')
.then(response => response.json())
.then(data => {
this.languages = data;
})
.catch(error => {
console.error('Error fetching data:', error);
});
}
});
</script>
</html>