Added a choices translation selector

Added the ability to select a translation of choices
This commit is contained in:
MxShift 2023-02-25 01:02:39 +06:00
parent d84fa0fd06
commit a4f6d03137
2 changed files with 37 additions and 13 deletions

View file

@ -35,7 +35,9 @@ var segmentGroups = bv.segmentGroups;
// Transation of choices
var moments = JSON.parse(JSON.stringify(momentsBySegment));
var translated_choices = ru;
var translated_choices = en;
function switch_choices() {
for (var key in translated_choices) {
@ -58,7 +60,10 @@ for (var key in translated_choices) {
}
}
momentsBySegment = moments;
return moments;
}
// momentsBySegment = moments;
// Get translations from bandersnatch.js

View file

@ -38,6 +38,7 @@
<meta name="keywords" content="Bandersnatch,Bandersnatch Interactive Player,Interactive Player,watch," />
<script src="assets/bandersnatch.js"></script>
<script src="assets/choices/ru.js"></script>
<script src="assets/choices/en.js"></script>
<script src="assets/SegmentMap.js"></script>
<script src="assets/scripts.js"></script>
<script>
@ -47,6 +48,7 @@
reset();
}
</script>
<link rel="stylesheet" type="text/css" href="assets/styles.css">
</head>
@ -57,6 +59,16 @@
<div id="file-selector">
<div class="file-area">
<div class="contact">
<div>
<span class="default">You can select translation of choices: </span>
<select id="choice-translation">
<option value="ru">Russian</option>
<option value="en" selected>English</option>
</select>
<br>
This player remembers your choices and watch history: <a
href="javascript:askReset()">Reset all</a>
</div>
<p>
Authors:
<a href="https://github.com/joric/bandersnatch/">Original version</a> - <a
@ -64,9 +76,6 @@
Web page, subtitles - <a href="https://github.com/mehotkhan">Mehotkhan</a> |
Many fixes, improvements, and everything else - <a
href="https://github.com/CyberShadow">CyberShadow</a>
<br>
This player remembers your choices and watch history. <a
href="javascript:askReset()">Click here to reset and start from scratch.</a>
</p>
</div>
<input id="fileinput" type="file">
@ -163,4 +172,14 @@
</div>
</body>
<script>
var select = document.getElementById('choice-translation');
select.addEventListener('change',(e)=>{
translated_choices = window[select.value];
console.log(select.value);
// console.log(translated_choices);
momentsBySegment = switch_choices();
})
</script>
</html>