stremiok 2.3.3 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +6 -5
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +42 -39
  6. package/js/app.js +7 -3
  7. package/js/downloads.js +16 -16
  8. package/js/epg.js +2 -3
  9. package/js/hubpreview.js +1 -1
  10. package/js/i18n.js +108 -0
  11. package/js/iptv.js +13 -13
  12. package/js/jellyfin.js +62 -29
  13. package/js/lang/ar.js +1941 -0
  14. package/js/lang/de.js +1941 -0
  15. package/js/lang/es.js +1941 -0
  16. package/js/lang/fi.js +1941 -0
  17. package/js/lang/fr.js +1941 -0
  18. package/js/lang/he.js +1941 -0
  19. package/js/lang/hi.js +1941 -0
  20. package/js/lang/it.js +1941 -0
  21. package/js/lang/ja.js +1941 -0
  22. package/js/lang/ko.js +1941 -0
  23. package/js/lang/languages.js +21 -0
  24. package/js/lang/pl.js +1941 -0
  25. package/js/lang/pt-BR.js +1941 -0
  26. package/js/lang/ru.js +1941 -0
  27. package/js/lang/tr.js +1941 -0
  28. package/js/lang/zh-CN.js +1941 -0
  29. package/js/local.js +9 -9
  30. package/js/netfolders.js +13 -13
  31. package/js/player-audio.js +17 -17
  32. package/js/player-controls.js +100 -100
  33. package/js/player-core.js +60 -57
  34. package/js/player-lang.js +22 -22
  35. package/js/player-quality.js +15 -15
  36. package/js/player-store.js +25 -18
  37. package/js/player-subs.js +69 -69
  38. package/js/plex.js +69 -21
  39. package/js/stremio-account.js +17 -12
  40. package/js/stremio-sync.js +641 -0
  41. package/js/stremio.js +79 -76
  42. package/js/stvod.js +4 -4
  43. package/js/trakt.js +23 -23
  44. package/js/tvapps.js +4 -4
  45. package/js/util.js +39 -27
  46. package/js/view-core.js +109 -92
  47. package/js/view-detail.js +135 -126
  48. package/js/view-discover.js +27 -27
  49. package/js/view-guide.js +13 -13
  50. package/js/view-home.js +148 -120
  51. package/js/view-search.js +25 -25
  52. package/js/view-settings.js +735 -643
  53. package/js/xtvod.js +2 -2
  54. package/js/youtube.js +17 -17
  55. package/js/ytplay.js +11 -6
  56. package/package.json +1 -1
  57. package/tizenbrew.html +1 -1
package/js/view-detail.js CHANGED
@@ -17,6 +17,13 @@
17
17
  function posterActions() { return V.posterActions.apply(null, arguments); } // core
18
18
  function scr() { return V.scr.apply(null, arguments); } // core
19
19
  function toggleNowPlaying() { return V.toggleNowPlaying.apply(null, arguments); } // core
20
+ // Your Stremio account's Library (connected): + Stremio Library / ✓ In Stremio Library.
21
+ function libraryPill(type, id) {
22
+ if (!V.libraryOn() || _d.addonType) { return null; }
23
+ var p = U.el('div', 'pill focusable', V.libraryLabel(type, id));
24
+ p.__onselect = function () { V.toggleLibrary(type, _d.meta); setTimeout(function () { p.textContent = V.libraryLabel(type, id); }, 0); };
25
+ return p;
26
+ }
20
27
  function trimMeta() { return V.trimMeta.apply(null, arguments); } // home
21
28
  function searchFor() { return V.searchFor.apply(null, arguments); } // search
22
29
 
@@ -66,17 +73,17 @@
66
73
  var why = list.length ? '' : (Stremio.streamNotes ? Stremio.streamNotes(type, id) : []).slice(0, 3).map(function (n) { return n.addon + ' ' + n.title; }).join('; ');
67
74
  U.log('sources', 'No playable source for “' + ((_d.meta && _d.meta.name) || id) + '” (' + type + ' ' + id + '): ' +
68
75
  (list.length ? list.length + ' source(s), none playable here' : 'no addon sent any') + (why ? ' (' + why + ')' : ''));
69
- U.toast('No playable source for this channel' + (why ? ': ' + why : ''), why ? 6000 : 3000); App.back(); return;
76
+ U.toast(why ? U.t('No playable source for this channel: {why}', { why: why }) : U.t('No playable source for this channel'), why ? 6000 : 3000); App.back(); return;
70
77
  }
71
78
  if (playable.length === 1) {
72
- startPlayback(playable[0], id, _d.streamLabel || _d.meta.name || 'Live');
79
+ startPlayback(playable[0], id, _d.streamLabel || _d.meta.name || U.t('Live'));
73
80
  } else if ((opts && opts.playBest) || _d.autoBest) { // (the remote's Play key)
74
81
  var top = bestRow(rankRowsFor(list));
75
- startPlayback(top ? top.st : playable[0], id, _d.streamLabel || _d.meta.name || 'Live');
82
+ startPlayback(top ? top.st : playable[0], id, _d.streamLabel || _d.meta.name || U.t('Live'));
76
83
  } else {
77
84
  drawDetail(); // multiple sources → straight to the source list
78
85
  }
79
- }, function () { if (!still()) { return; } U.spinner(false); U.toast('Could not load sources'); App.back(); });
86
+ }, function () { if (!still()) { return; } U.spinner(false); U.toast(U.t('Could not load sources')); App.back(); });
80
87
  }
81
88
 
82
89
  // opts.resume: a Continue Watching entry to play straight away (see startResume).
@@ -109,7 +116,7 @@
109
116
  _d.meta = Object.assign({ id: id, type: type }, _d.preview);
110
117
  afterMeta();
111
118
  } else {
112
- U.toast('Could not load details');
119
+ U.toast(U.t('Could not load details'));
113
120
  App.back();
114
121
  }
115
122
  });
@@ -200,14 +207,14 @@
200
207
  }
201
208
  // A season's name: a year ("2026"), "Videos" (a YouTube channel's undated list), or "Season 2".
202
209
  function seasonName(sn) {
203
- if (_d && _d.collection) { return 'Titles'; }
204
- if (_d && _d.addonType) { return _d.yearSeasons ? '' + sn : 'Videos'; }
205
- return sn >= 1900 && sn <= 2200 ? '' + sn : 'Season ' + sn;
210
+ if (_d && _d.collection) { return U.t('Titles'); }
211
+ if (_d && _d.addonType) { return _d.yearSeasons ? '' + sn : U.t('Videos'); }
212
+ return sn >= 1900 && sn <= 2200 ? '' + sn : U.t('Season {n}', { n: sn });
206
213
  }
207
214
  // An episode as it's named on its own (the Play button, the player, Continue Watching): a
208
215
  // YouTube channel's video by its title, an episode by its code ("S2E5").
209
216
  function epName(v) {
210
- return (_d && _d.addonType) ? (v.title || 'Video') : _d.meta.name + ' S' + seasonOf(v) + 'E' + (v.episode || '');
217
+ return (_d && _d.addonType) ? (v.title || U.t('Video')) : _d.meta.name + ' S' + seasonOf(v) + 'E' + (v.episode || '');
211
218
  }
212
219
  // Seasons that are years (a YouTube channel): the newest first.
213
220
  function yearOrder() { return !!(_d && _d.yearSeasons); }
@@ -226,7 +233,7 @@
226
233
  behaviorHints: (p.fileHints && typeof p.fileHints === 'object') ? p.fileHints : undefined }; // (its file: for subtitles made for it)
227
234
  if (p.torrent && typeof p.torrent.infoHash === 'string') { // (a torrent: its link from the streaming server set now)
228
235
  st = Stremio.torrentSource({ infoHash: p.torrent.infoHash, fileIdx: p.torrent.fileIdx, sources: p.torrent.sources, name: p.name, behaviorHints: st.behaviorHints });
229
- if (!st.url) { U.toast('This one plays through a streaming server: Settings › Content › Streaming server', 6000); return; }
236
+ if (!st.url) { U.toast(U.t('This one plays through a streaming server: Settings › Content › Streaming server'), 6000); return; }
230
237
  }
231
238
  if (/^https:\/\/www\.youtube\.com\/watch\?v=[A-Za-z0-9_-]{11}$/.test(p.url || '')) { st._yt = true; st.ytPage = p.url; } // (a YouTube video: through the service again)
232
239
  resumeSources(startPlayback(st, p.id, p.name, how), p.id);
@@ -278,7 +285,7 @@
278
285
  var epTitle = ep.title || ep.name || '';
279
286
  bits.push(epCode(ep) + (epTitle ? ' “' + epTitle + '”' : ''));
280
287
  var aired = airsAt(ep);
281
- if (aired > 0) { bits.push((aired > Date.now() ? 'Airs ' : 'Aired ') + U.dayLabel(aired)); }
288
+ if (aired > 0) { bits.push(aired > Date.now() ? U.t('Airs {when}', { when: U.dayLabel(aired) }) : U.t('Aired {when}', { when: U.dayLabel(aired) })); }
282
289
  if (ep.rating && !isNaN(parseFloat(ep.rating))) { bits.push('★ ' + ep.rating); }
283
290
  } else {
284
291
  if (meta.releaseInfo) { bits.push(meta.releaseInfo); }
@@ -289,7 +296,7 @@
289
296
  var genres = (meta.genres && meta.genres.length) ? meta.genres : own.genres;
290
297
  if (genres.length) { bits.push(genres.slice(0, 3).join(', ')); }
291
298
  }
292
- if (meta._from) { bits.push('Details: ' + meta._from); } // (which addon: the highest in Settings › Addons that has them)
299
+ if (meta._from) { bits.push(U.t('Details: {addon}', { addon: meta._from })); } // (which addon: the highest in Settings › Addons that has them)
293
300
  body.appendChild(U.el('div', 'detail-meta', bits.join(' · ')));
294
301
  var ratings = U.el('div', 'detail-ratings');
295
302
  body.appendChild(ratings);
@@ -403,7 +410,7 @@
403
410
  function withTmdb() { return Stremio.hasTmdb() && /^tt\d+$/.test(_d.id || ''); }
404
411
  function morePill() {
405
412
  if (!withTmdb() && !hasAddonPeople(_d.meta)) { return null; }
406
- var p = U.el('div', 'pill focusable more-pill', 'ⓘ Cast & more');
413
+ var p = U.el('div', 'pill focusable more-pill', U.t('ⓘ Cast & more'));
407
414
  p.__onselect = function () { _d.moreFrom = _d.mode; _d.mode = 'more'; drawDetail(); };
408
415
  if (_d._focusPill === 'more') { _d._epFocus = p; _d._focusPill = null; }
409
416
  return p;
@@ -411,7 +418,7 @@
411
418
  function ratingsPill() {
412
419
  var integ = Stremio.getIntegrations();
413
420
  if (!(integ.omdb || integ.tmdb) || !/^tt\d+$/.test(_d.id || '')) { return null; }
414
- var p = U.el('div', 'pill focusable ratings-pill', '★ Episode ratings');
421
+ var p = U.el('div', 'pill focusable ratings-pill', U.t('★ Episode ratings'));
415
422
  p.__onselect = function () { _d.moreFrom = _d.mode; _d.mode = 'ratings'; drawDetail(); };
416
423
  if (_d._focusPill === 'ratings') { _d._epFocus = p; _d._focusPill = null; }
417
424
  return p;
@@ -420,7 +427,7 @@
420
427
  function morePanel() {
421
428
  var panel = U.el('div', 'list-panel more-panel');
422
429
  var rows = U.el('div', 'more-rows');
423
- rows.appendChild(U.el('div', 'row-empty', 'Loading…'));
430
+ rows.appendChild(U.el('div', 'row-empty', U.t('Loading…')));
424
431
  panel.appendChild(rows);
425
432
  var page = _d;
426
433
  var ep = shownEpisode();
@@ -432,16 +439,16 @@
432
439
  if (_d !== page || _d.mode !== 'more') { return; }
433
440
  U.clear(rows);
434
441
  if (!people || !people.length) {
435
- if (!theirs()) { rows.appendChild(U.el('div', 'row-empty', 'TMDB has nothing more for this episode.')); }
442
+ if (!theirs()) { rows.appendChild(U.el('div', 'row-empty', U.t('TMDB has nothing more for this episode.'))); }
436
443
  focusLoaded(rows);
437
444
  return;
438
445
  }
439
- rows.appendChild(buildRow('Cast & more', people.map(personCard)));
446
+ rows.appendChild(buildRow(U.t('Cast & more'), people.map(personCard)));
440
447
  focusLoaded(rows);
441
448
  }, function () {
442
449
  if (_d !== page) { return; }
443
450
  U.clear(rows);
444
- if (!theirs()) { rows.appendChild(U.el('div', 'row-empty', 'Couldn\'t reach TMDB.')); }
451
+ if (!theirs()) { rows.appendChild(U.el('div', 'row-empty', U.t('Couldn\'t reach TMDB.'))); }
445
452
  focusLoaded(rows);
446
453
  });
447
454
  return panel;
@@ -449,16 +456,16 @@
449
456
  Stremio.tmdbTitleExtras(page.type, page.id, pageCancel()).then(function (x) {
450
457
  if (_d !== page || _d.mode !== 'more') { return; }
451
458
  U.clear(rows);
452
- if (x && x.cast.length) { rows.appendChild(buildRow('Cast & more', x.cast.map(personCard))); }
459
+ if (x && x.cast.length) { rows.appendChild(buildRow(U.t('Cast & more'), x.cast.map(personCard))); }
453
460
  var own = !(x && x.cast.length) && theirs(); // (no people from TMDB: the addon's)
454
461
  if (x && x.collection) { rows.appendChild(buildRow(x.collection.name, x.collection.parts.map(tmdbCard))); }
455
- if (x && x.similar.length) { rows.appendChild(buildRow('More like this', x.similar.map(tmdbCard))); }
456
- if (!rows.firstChild && !own) { rows.appendChild(U.el('div', 'row-empty', 'TMDB has nothing more for this title.')); }
462
+ if (x && x.similar.length) { rows.appendChild(buildRow(U.t('More like this'), x.similar.map(tmdbCard))); }
463
+ if (!rows.firstChild && !own) { rows.appendChild(U.el('div', 'row-empty', U.t('TMDB has nothing more for this title.'))); }
457
464
  focusLoaded(rows);
458
465
  }, function (err) {
459
466
  if (_d !== page || (err && err.cancelled)) { return; }
460
467
  U.clear(rows);
461
- if (!theirs()) { rows.appendChild(U.el('div', 'row-empty', 'Couldn\'t reach TMDB.')); }
468
+ if (!theirs()) { rows.appendChild(U.el('div', 'row-empty', U.t('Couldn\'t reach TMDB.'))); }
462
469
  focusLoaded(rows);
463
470
  });
464
471
  return panel;
@@ -489,10 +496,10 @@
489
496
  // Rows of them, by name (no photos): OK searches for the name. Whether there were any.
490
497
  function appendAddonPeople(rows, meta) {
491
498
  var o = addonLinks(meta), any = false;
492
- [['Cast', o.cast, ''], ['Directors', o.directors, 'Director'], ['Writers', o.writers, 'Writer']].forEach(function (g) {
499
+ [[U.t('Cast'), o.cast, ''], [U.t('Directors'), o.directors, U.t('Director')], [U.t('Writers'), o.writers, U.t('Writer')]].forEach(function (g) {
493
500
  if (!g[1].length) { return; }
494
501
  any = true;
495
- rows.appendChild(buildRow(g[0] + ' · from ' + ((meta && meta._from) || 'the addon'), g[1].map(function (n) { return namedPersonCard(n, g[2]); })));
502
+ rows.appendChild(buildRow(g[0] + ' · ' + U.t('from {addon}', { addon: (meta && meta._from) || U.t('the addon') }), g[1].map(function (n) { return namedPersonCard(n, g[2]); })));
496
503
  });
497
504
  return any;
498
505
  }
@@ -543,7 +550,7 @@
543
550
  function peopleCard(p) {
544
551
  var c = personCard({ id: p.id, name: p.name, photo: p.photo, character: p.dept });
545
552
  c.__meta = { id: 'person:' + p.id, name: p.name, releaseInfo: p.dept,
546
- description: p.knownFor && p.knownFor.length ? 'Known for: ' + p.knownFor.join(', ') : '' };
553
+ description: p.knownFor && p.knownFor.length ? U.t('Known for: {titles}', { titles: p.knownFor.join(', ') }) : '' };
547
554
  return c;
548
555
  }
549
556
 
@@ -568,9 +575,9 @@
568
575
  U.spinner(true);
569
576
  Stremio.tmdbImdbId(item.kind, item.tmdbId, pageCancel()).then(function (imdb) {
570
577
  U.spinner(false);
571
- if (!imdb) { U.toast('“' + item.name + '” has no IMDb id, so the addons can\'t open it.', 3500); return; }
578
+ if (!imdb) { U.toast(U.t('“{name}” has no IMDb id, so the addons can\'t open it.', { name: item.name }), 3500); return; }
572
579
  then(imdb);
573
- }, function () { U.spinner(false); U.toast('Couldn\'t reach TMDB.'); });
580
+ }, function () { U.spinner(false); U.toast(U.t('Couldn\'t reach TMDB.')); });
574
581
  }
575
582
 
576
583
  // ----- a person's page (from the cast row) -----
@@ -587,7 +594,7 @@
587
594
  drawPerson();
588
595
  }, function () {
589
596
  U.spinner(false);
590
- if (_d === page) { U.toast('Couldn\'t load this person from TMDB.'); }
597
+ if (_d === page) { U.toast(U.t('Couldn\'t load this person from TMDB.')); }
591
598
  });
592
599
  }
593
600
  function drawPerson() {
@@ -612,9 +619,9 @@
612
619
  panel.appendChild(rows);
613
620
  s.appendChild(panel);
614
621
  if (p) {
615
- if (p.movies.length) { rows.appendChild(buildRow('Movies', p.movies.map(tmdbCard))); }
616
- if (p.series.length) { rows.appendChild(buildRow('Series', p.series.map(tmdbCard))); }
617
- if (!p.movies.length && !p.series.length) { rows.appendChild(U.el('div', 'row-empty', 'No titles listed on TMDB.')); }
622
+ if (p.movies.length) { rows.appendChild(buildRow(U.t('Movies'), p.movies.map(tmdbCard))); }
623
+ if (p.series.length) { rows.appendChild(buildRow(U.t('Series'), p.series.map(tmdbCard))); }
624
+ if (!p.movies.length && !p.series.length) { rows.appendChild(U.el('div', 'row-empty', U.t('No titles listed on TMDB.'))); }
618
625
  }
619
626
  Focus.setScope(s, rows.querySelector('.focusable') || undefined);
620
627
  restoreFocusKey(s);
@@ -662,7 +669,7 @@
662
669
  }
663
670
  scroll.appendChild(table);
664
671
  panel.appendChild(scroll);
665
- panel.appendChild(U.el('div', 'grid-legend', 'IMDb ratings where OMDb has them, else TMDB. OK on an episode opens it.'));
672
+ panel.appendChild(U.el('div', 'grid-legend', U.t('IMDb ratings where OMDb has them, else TMDB. OK on an episode opens it.')));
666
673
  _d._epFocus = (_d.season != null && cells[_d.season + ':1']) || startCell;
667
674
  U.settleAll(ss.map(function (sn) {
668
675
  return function () {
@@ -751,7 +758,7 @@
751
758
  return (meta.videos || []).filter(function (v) { return v && v.streams && v.streams.length; });
752
759
  }
753
760
  function fileLabel(v) {
754
- var t = '' + (v.title || v.name || v.id || 'File');
761
+ var t = '' + (v.title || v.name || v.id || U.t('File'));
755
762
  return t.split('/').pop();
756
763
  }
757
764
  function fileStreams(v) {
@@ -805,7 +812,7 @@
805
812
  // ----- series: Resume / Play -----
806
813
  function seasonOf(v) { return v.season === undefined ? 1 : v.season; }
807
814
  function epCode(v) {
808
- if (_d && _d.addonType) { var t = '' + (v.title || 'Video'); return '“' + (t.length > 40 ? t.slice(0, 39) + '…' : t) + '”'; } // (a YouTube channel's video)
815
+ if (_d && _d.addonType) { var t = '' + (v.title || U.t('Video')); return '“' + (t.length > 40 ? t.slice(0, 39) + '…' : t) + '”'; } // (a YouTube channel's video)
809
816
  return 'S' + seasonOf(v) + 'E' + (v.episode || '?');
810
817
  }
811
818
 
@@ -844,7 +851,7 @@
844
851
  // watched all that's out): no Play, just when it airs.
845
852
  var airs = airsAt(up.v);
846
853
  if (_d.collection) { // (the next film you haven't watched: its page)
847
- var open = U.el('div', 'pill focusable', '▶ Open “' + (up.v.title || up.v.name || '') + '”');
854
+ var open = U.el('div', 'pill focusable', '▶ ' + U.t('Open “{title}”', { title: up.v.title || up.v.name || '' }));
848
855
  open.__onselect = function () { openTitle(up.v); };
849
856
  row.appendChild(open);
850
857
  var tpc = trailerPill();
@@ -852,7 +859,7 @@
852
859
  return row;
853
860
  }
854
861
  if (!up.resume && !episodeWatched(up.v) && airs > Date.now()) {
855
- row.appendChild(U.el('div', 'pill airs-pill', epCode(up.v) + ' airs ' + U.dayLabel(airs)));
862
+ row.appendChild(U.el('div', 'pill airs-pill', U.t('{ep} airs {when}', { ep: epCode(up.v), when: U.dayLabel(airs) })));
856
863
  } else {
857
864
  row.appendChild(playUpButton(up));
858
865
  }
@@ -860,6 +867,8 @@
860
867
  np.__onselect = function () { toggleNowPlaying('series', _d.meta); _d._focusNp = true; drawDetail(); };
861
868
  if (_d._focusNp) { _d._epFocus = np; _d._focusNp = false; }
862
869
  row.appendChild(np);
870
+ var lp = libraryPill('series', _d.meta.id || _d.id);
871
+ if (lp) { row.appendChild(lp); }
863
872
  var tp = trailerPill();
864
873
  if (tp) { row.appendChild(tp); }
865
874
  var mp = morePill();
@@ -870,8 +879,8 @@
870
879
  }
871
880
  function playUpButton(up) {
872
881
  var btn = U.el('div', 'pill focusable', up.resume
873
- ? '▶ Resume ' + epCode(up.v) + ' · ' + U.fmtTime(up.resume.position)
874
- : '▶ Play ' + epCode(up.v));
882
+ ? '▶ ' + U.t('Resume {ep} · {at}', { ep: epCode(up.v), at: U.fmtTime(up.resume.position) })
883
+ : '▶ ' + U.t('Play {ep}', { ep: epCode(up.v) }));
875
884
  btn.__onselect = function () {
876
885
  // resume the exact stream when one was saved; otherwise pick a source
877
886
  if (up.resume && up.resume.url) { startResume(up.resume); }
@@ -886,7 +895,7 @@
886
895
  if (up.resume && up.resume.position > 0) {
887
896
  btn.__onlongpress = function () {
888
897
  var code = epCode(up.v);
889
- pickList((_d.meta.name || '') + ' ' + code, [['resume', 'Resume at ' + U.fmtTime(up.resume.position)], ['start', 'Play ' + code + ' from the start']], null, function (k) {
898
+ pickList((_d.meta.name || '') + ' ' + code, [['resume', U.t('Resume at {at}', { at: U.fmtTime(up.resume.position) })], ['start', U.t('Play {ep} from the start', { ep: code })]], null, function (k) {
890
899
  if (k === 'resume') { btn.__onselect(); return; }
891
900
  if (up.resume.url) { startResume(Object.assign({}, up.resume, { fromStart: true })); }
892
901
  else { openStreams(up.v.id, epName(up.v), false, { fromStart: true }); }
@@ -942,7 +951,7 @@
942
951
  return (t.lang && mine.indexOf(t.lang) !== -1 && r < 3 ? 0 : 10) + r; // (yours first, ticket ads still last)
943
952
  }
944
953
  out.sort(function (a, b) { return (rank(a) - rank(b)) || (a.at - b.at); });
945
- out.forEach(function (t, i) { if (!t.name) { t.name = out.length > 1 ? 'Trailer ' + (i + 1) : 'Trailer'; } });
954
+ out.forEach(function (t, i) { if (!t.name) { t.name = out.length > 1 ? U.t('Trailer {n}', { n: i + 1 }) : U.t('Trailer'); } });
946
955
  return out;
947
956
  }
948
957
  // Your languages, two-letter (TMDB's): the audio's, the subtitles' (and their second choice).
@@ -955,12 +964,11 @@
955
964
  return out;
956
965
  }
957
966
  // A trailer as listed: its title, then its language, month and "unofficial", where known.
958
- var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
959
967
  function trailerLabel(t) {
960
968
  var bits = [t.name];
961
969
  if (t.lang && Player.langName) { bits.push(Player.langName(t.lang)); }
962
970
  var m = /^(\d{4})-(\d{2})/.exec(t.date || '');
963
- if (m) { bits.push(MONTHS[+m[2] - 1] + ' ' + m[1]); }
971
+ if (m) { bits.push(U.month(+m[2] - 1) + ' ' + m[1]); }
964
972
  if (t.official === false) { bits.push('unofficial'); }
965
973
  return bits.join(' · ');
966
974
  }
@@ -969,25 +977,25 @@
969
977
  // when it refuses (false: just that one, picked by hand).
970
978
  function playTrailers(list, next) {
971
979
  var meta = _d.meta, title = (meta && (meta.name || meta.title)) || '', passed = [], still = pageNow();
972
- U.spinner(true, 'Opening trailer…');
980
+ U.spinner(true, U.t('Opening trailer…'));
973
981
  YTPlay.ensureService().then(function () {
974
982
  function tryAt(i) {
975
983
  if (!still()) { U.spinner(false); return; }
976
984
  if (i >= list.length) {
977
985
  U.spinner(false);
978
- U.toast(list.length === 1 ? '“' + list[0].name + '” isn’t available from YouTube to StremioK' : 'YouTube won’t give out any of this title’s ' + list.length + ' trailers to StremioK', 6000);
986
+ U.toast(list.length === 1 ? U.t('“{name}” isn’t available from YouTube to StremioK', { name: list[0].name }) : U.t('YouTube won’t give out any of this title’s {n} trailers to StremioK', { n: list.length }), 6000);
979
987
  return;
980
988
  }
981
989
  var t = list[i], page = 'https://www.youtube.com/watch?v=' + t.id;
982
990
  (YTPlay.canPlay ? YTPlay.canPlay(page) : Promise.resolve(true)).then(function (ok) {
983
991
  if (!ok) {
984
992
  U.log('youtube', 'Trailer “' + t.name + '” (' + t.id + ') of “' + title + '”: YouTube didn’t give it out' + (next && i + 1 < list.length ? '; trying the next one' : ''));
985
- if (!next) { U.spinner(false); U.toast('“' + t.name + '” isn’t available from YouTube to StremioK', 6000); return; }
993
+ if (!next) { U.spinner(false); U.toast(U.t('“{name}” isn’t available from YouTube to StremioK', { name: t.name }), 6000); return; }
986
994
  passed.push(t);
987
995
  tryAt(i + 1);
988
996
  return;
989
997
  }
990
- if (passed.length) { U.toast('“' + passed[0].name + '” isn’t available from YouTube: playing “' + t.name + '”', 6000); }
998
+ if (passed.length) { U.toast(U.t('“{name}” isn’t available from YouTube: playing “{other}”', { name: passed[0].name, other: t.name }), 6000); }
991
999
  playTrailer(t.id);
992
1000
  });
993
1001
  }
@@ -1016,11 +1024,11 @@
1016
1024
  }
1017
1025
  var list = trailersOf(_d.meta);
1018
1026
  if (!list.length || typeof YTPlay === 'undefined') { return null; }
1019
- var p = U.el('div', 'pill focusable trailer-pill', '▶ Trailer' + (list.length > 1 ? ' (' + list.length + ')' : ''));
1027
+ var p = U.el('div', 'pill focusable trailer-pill', '▶ ' + U.t('Trailer') + (list.length > 1 ? ' (' + list.length + ')' : ''));
1020
1028
  p.__onselect = function () { playTrailers(list, true); };
1021
1029
  if (list.length > 1) { // hold OK: the list, to pick one
1022
1030
  p.__onlongpress = function () {
1023
- pickList('Trailers', list.map(function (t, i) { return ['' + i, trailerLabel(t)]; }), '', function (k) { playTrailers([list[+k]], false); });
1031
+ pickList(U.t('Trailers'), list.map(function (t, i) { return ['' + i, trailerLabel(t)]; }), '', function (k) { playTrailers([list[+k]], false); });
1024
1032
  };
1025
1033
  }
1026
1034
  if (_d._focusTrailer) { _d._epFocus = p; _d._focusTrailer = false; }
@@ -1050,7 +1058,7 @@
1050
1058
  }
1051
1059
  function epTrailerButton(ep, t) {
1052
1060
  var season = seasonName(seasonOf(ep));
1053
- var p = U.el('div', 'pill focusable trailer-pill', t.season ? '▶ ' + season + ' trailer' : '▶ Trailer');
1061
+ var p = U.el('div', 'pill focusable trailer-pill', t.season ? '▶ ' + U.t('{season} trailer', { season: season }) : '▶ ' + U.t('Trailer'));
1054
1062
  p.__onselect = function () { playTrailer(t.ytId, (_d.meta.name || _d.meta.title || '') + ' ' + (t.season ? season : epCode(ep))); };
1055
1063
  if (_d._focusTrailer) { _d._epFocus = p; _d._focusTrailer = false; }
1056
1064
  return p;
@@ -1060,13 +1068,13 @@
1060
1068
  function playTrailer(ytId, label) {
1061
1069
  var page = 'https://www.youtube.com/watch?v=' + ytId;
1062
1070
  var meta = _d.meta, still = pageNow();
1063
- U.spinner(true, 'Opening trailer…');
1071
+ U.spinner(true, U.t('Opening trailer…'));
1064
1072
  YTPlay.ensureService().then(function () {
1065
1073
  U.spinner(false);
1066
1074
  if (!still()) { return; }
1067
1075
  Player.play({
1068
1076
  url: YTPlay.resolverUrl(page, 1080, false, ytLangFor(page)), variantUrl: YTPlay.resolverUrl(page), initialQualityHeight: 1080,
1069
- ytLang: ytLangFor(page), type: _d.type, id: 'trailer:' + ytId, name: (label || meta.name || meta.title || '') + ' · Trailer',
1077
+ ytLang: ytLangFor(page), type: _d.type, id: 'trailer:' + ytId, name: (label || meta.name || meta.title || '') + ' · ' + U.t('Trailer'),
1070
1078
  poster: meta.poster, streams: [], yt: page, trailer: true
1071
1079
  }, function () { _d._focusTrailer = true; drawDetail(); }); // back on the page, on the Trailer button
1072
1080
  }, function () {
@@ -1077,7 +1085,7 @@
1077
1085
 
1078
1086
  function movieActions() {
1079
1087
  var row = U.el('div', 'btn-row');
1080
- var play = U.el('div', 'pill focusable', '▶ Play');
1088
+ var play = U.el('div', 'pill focusable', U.t('▶ Play'));
1081
1089
  play.__onselect = function () { openStreams(_d.id, _d.meta.name, false, AUTO); };
1082
1090
  play.__onplay = function () { openStreams(_d.id, _d.meta.name, false, PLAY_KEY); };
1083
1091
  row.appendChild(play);
@@ -1095,7 +1103,7 @@
1095
1103
 
1096
1104
  // Hide spoilers (Settings › Appearance): for an episode not watched yet, 'pictures' (its still
1097
1105
  // blurred) or 'all' (its synopsis left out too); '' to show it.
1098
- var SPOILER_TEXT = 'Synopsis hidden: not watched yet';
1106
+ var SPOILER_TEXT = U.t('Synopsis hidden: not watched yet');
1099
1107
  function spoilerFor(v) {
1100
1108
  var mode = Stremio.getPrefs().spoilers;
1101
1109
  if (mode === 'off' || !v || _d.collection || episodeWatched(v)) { return ''; }
@@ -1137,28 +1145,28 @@
1137
1145
 
1138
1146
  function seasonMenu(meta, sn, allSeasons) {
1139
1147
  var on = !seasonWatched(meta, sn);
1140
- var opts = [['season', (on ? 'Mark Season ' + sn + ' watched' : 'Mark Season ' + sn + ' unwatched')]];
1148
+ var opts = [['season', (on ? U.t('Mark Season {n} watched', { n: sn }) : U.t('Mark Season {n} unwatched', { n: sn }))]];
1141
1149
  // "up to here": the regular seasons before this one too (not specials, Season 0)
1142
1150
  var earlier = allSeasons.filter(function (x) { return x > 0 && x < sn; });
1143
- if (sn > 0 && earlier.length) { opts.push(['upto', 'Mark Seasons ' + earlier[0] + '–' + sn + ' watched']); }
1151
+ if (sn > 0 && earlier.length) { opts.push(['upto', U.t('Mark Seasons {from}–{to} watched', { from: earlier[0], to: sn })]); }
1144
1152
  var allOn = !seriesWatched(meta);
1145
- opts.push(['all', allOn ? 'Mark whole series watched' : 'Mark whole series unwatched']);
1153
+ opts.push(['all', allOn ? U.t('Mark whole series watched') : U.t('Mark whole series unwatched')]);
1146
1154
  var showId = (meta.id || _d.id || '').split(':')[0];
1147
1155
  if (typeof Trakt !== 'undefined' && Trakt.isConnected() && Trakt.rate && /^tt\d+$/.test(showId)) { // (on Trakt: by the show's IMDb id)
1148
1156
  var mine = Trakt.myRating('season', showId + ':' + sn);
1149
- opts.push(['rate', mine ? 'Season ' + sn + ': your rating ' + mine + ' · change' : 'Rate Season ' + sn + ' on Trakt']);
1157
+ opts.push(['rate', mine ? U.t('Season {n}: your rating {rating} · change', { n: sn, rating: mine }) : U.t('Rate Season {n} on Trakt', { n: sn })]);
1150
1158
  }
1151
1159
  pickList(seasonName(sn), opts, null, function (what) {
1152
1160
  if (what === 'rate') { V.rateOnTrakt('season', showId + ':' + sn, (meta.name || '') + ' ' + seasonName(sn)); return; }
1153
1161
  if (what === 'season') {
1154
- markEpisodes(idsOf(seasonEpisodes(meta, sn)), on, seasonName(sn) + (on ? ' marked watched' : ' marked unwatched'));
1162
+ markEpisodes(idsOf(seasonEpisodes(meta, sn)), on, on ? U.t('{season} marked watched', { season: seasonName(sn) }) : U.t('{season} marked unwatched', { season: seasonName(sn) }));
1155
1163
  } else if (what === 'upto') {
1156
1164
  markEpisodes(idsOf(meta.videos.filter(function (v) {
1157
1165
  var x = (v.season === undefined ? 1 : v.season);
1158
1166
  return x > 0 && x <= sn;
1159
- })), true, 'Seasons ' + earlier[0] + '–' + sn + ' marked watched');
1167
+ })), true, U.t('Seasons {from}–{to} marked watched', { from: earlier[0], to: sn }));
1160
1168
  } else {
1161
- markEpisodes(idsOf(meta.videos), allOn, allOn ? 'Whole series marked watched' : 'Whole series marked unwatched');
1169
+ markEpisodes(idsOf(meta.videos), allOn, allOn ? U.t('Whole series marked watched') : U.t('Whole series marked unwatched'));
1162
1170
  }
1163
1171
  _d.season = sn;
1164
1172
  _d._focusSeason = sn;
@@ -1169,7 +1177,7 @@
1169
1177
  function episodeMenu(meta, v) {
1170
1178
  var on = !episodeWatched(v);
1171
1179
  var code = epCode(v);
1172
- var opts = [['details', 'Details'], ['one', on ? 'Mark ' + code + ' watched' : 'Mark ' + code + ' unwatched']];
1180
+ var opts = [['details', U.t('Details')], ['one', on ? U.t('Mark {ep} watched', { ep: code }) : U.t('Mark {ep} unwatched', { ep: code })]];
1173
1181
  // every episode before this one (same order as Next), specials only within Season 0
1174
1182
  var ord = orderedEpisodes(meta), at = ord.indexOf(v), before = [];
1175
1183
  var sv = (v.season === undefined ? 1 : v.season);
@@ -1177,19 +1185,19 @@
1177
1185
  var x = (ord[i].season === undefined ? 1 : ord[i].season);
1178
1186
  if (x > 0 || sv === 0) { before.push(ord[i]); }
1179
1187
  }
1180
- if (before.length) { opts.push(['upto', 'Mark watched up to ' + code]); }
1188
+ if (before.length) { opts.push(['upto', U.t('Mark watched up to {ep}', { ep: code })]); }
1181
1189
  // it and every episode after it (the same order; specials only within Season 0), when one is watched
1182
1190
  var after = [v];
1183
1191
  for (var j = at + 1; j < ord.length; j++) {
1184
1192
  var y = (ord[j].season === undefined ? 1 : ord[j].season);
1185
1193
  if (y > 0 || sv === 0) { after.push(ord[j]); }
1186
1194
  }
1187
- if (after.length > 1 && after.some(episodeWatched)) { opts.push(['fromhere', 'Mark unwatched from ' + code + ' on']); }
1195
+ if (after.length > 1 && after.some(episodeWatched)) { opts.push(['fromhere', U.t('Mark unwatched from {ep} on', { ep: code })]); }
1188
1196
  pickList(meta.name + ' ' + code, opts, null, function (what) {
1189
1197
  if (what === 'details') { openStreams(v.id, epName(v)); return; } // (its page: as OK on it)
1190
- if (what === 'one') { markEpisodes([v.id], on, on ? 'Marked watched' : 'Marked unwatched'); }
1191
- else if (what === 'fromhere') { markEpisodes(idsOf(after), false, 'Marked unwatched from ' + code + ' on'); }
1192
- else { markEpisodes(idsOf(before.concat([v])), true, 'Marked watched up to ' + code); }
1198
+ if (what === 'one') { markEpisodes([v.id], on, on ? U.t('Marked watched') : U.t('Marked unwatched')); }
1199
+ else if (what === 'fromhere') { markEpisodes(idsOf(after), false, U.t('Marked unwatched from {ep} on', { ep: code })); }
1200
+ else { markEpisodes(idsOf(before.concat([v])), true, U.t('Marked watched up to {ep}', { ep: code })); }
1193
1201
  _d.target = v.id;
1194
1202
  drawDetail();
1195
1203
  });
@@ -1200,15 +1208,15 @@
1200
1208
  function collectionMenu(meta, v) {
1201
1209
  var on = !episodeWatched(v), name = v.title || v.name || '';
1202
1210
  var before = orderedEpisodes(meta).slice(0, orderedEpisodes(meta).indexOf(v));
1203
- var opts = [['one', on ? 'Mark watched' : 'Mark unwatched']];
1204
- if (before.length) { opts.push(['upto', 'Mark watched up to “' + name + '” (' + (before.length + 1) + ' films)']); }
1205
- opts.push(['open', 'Open its page']);
1211
+ var opts = [['one', on ? U.t('Mark watched') : U.t('Mark unwatched')]];
1212
+ if (before.length) { opts.push(['upto', U.t('Mark watched up to “{name}” ({n} films)', { name: name, n: before.length + 1 })]); }
1213
+ opts.push(['open', U.t('Open its page')]);
1206
1214
  pickList(name, opts, null, function (what) {
1207
1215
  if (what === 'open') { openTitle(v); return; }
1208
1216
  var films = what === 'one' ? [v] : before.concat([v]), mark = what === 'one' ? on : true;
1209
1217
  Player.setWatchedMany('movie', idsOf(films), mark);
1210
1218
  if (mark) { films.forEach(function (f) { Player.removeProgress('movie', f.id); }); } // (off Continue Watching: watched)
1211
- U.toast(what === 'one' ? (mark ? 'Marked watched' : 'Marked unwatched') : 'Marked watched up to “' + name + '”');
1219
+ U.toast(what === 'one' ? (mark ? U.t('Marked watched') : U.t('Marked unwatched')) : U.t('Marked watched up to “{name}”', { name: name }));
1212
1220
  _d.target = v.id;
1213
1221
  drawDetail();
1214
1222
  });
@@ -1305,7 +1313,7 @@
1305
1313
  var title = U.el('span', 'ep-title', (watched ? '✓ ' : '') + (_d.collection ? (v.title || v.name || '') + (yr ? ' (' + yr + ')' : '') : 'E' + (v.episode || '?') + ' ' + (v.title || v.name || '')));
1306
1314
  var rating = U.el('span', 'ep-rating', '');
1307
1315
  line.appendChild(title);
1308
- if (unaired) { var when = U.dayLabel(airs); line.appendChild(U.el('span', 'ep-airs', 'Airs ' + when)); }
1316
+ if (unaired) { var when = U.dayLabel(airs); line.appendChild(U.el('span', 'ep-airs', U.t('Airs {when}', { when: when }))); }
1309
1317
  line.appendChild(rating);
1310
1318
  body.appendChild(line);
1311
1319
  var ov = U.el('span', 'ep-ov', hide === 'all' ? SPOILER_TEXT : v.overview || '');
@@ -1400,14 +1408,13 @@
1400
1408
  // (matched by the service's name) asks first, once, naming the exact app.
1401
1409
  function openWhere(opens) {
1402
1410
  function go() {
1403
- U.toast('Opening ' + opens.app.name + '…', 2000);
1411
+ U.toast(U.t('Opening {app}…', { app: opens.app.name }), 2000);
1404
1412
  TVApps.openTitle(opens.app, opens.data).then(null, function (e) {
1405
- U.toast('Couldn\'t open ' + opens.app.name + ': ' + e.message, 4000);
1413
+ U.toast(U.t('Couldn\'t open {name}: {why}', { name: opens.app.name, why: e.message }), 4000);
1406
1414
  });
1407
1415
  }
1408
1416
  if (!TVApps.isApproved || TVApps.isApproved(opens.app.id)) { go(); return; }
1409
- confirm('Open “' + opens.app.name + '” (' + opens.app.id + ') from “where to watch” sources? It isn’t one of your streaming apps; ' +
1410
- 'StremioK will remember your answer for this app (Settings › Content › Streaming apps lists yours).', 'Open', function () {
1417
+ confirm(U.t('Open “{app}” ({id}) from “where to watch” sources? It isn’t one of your streaming apps; StremioK will remember your answer for this app (Settings › Content › Streaming apps lists yours).', { app: opens.app.name, id: opens.app.id }), U.t('Open'), function () {
1411
1418
  TVApps.approve(opens.app.id); go();
1412
1419
  });
1413
1420
  }
@@ -1434,8 +1441,8 @@
1434
1441
  // links that don't play here.
1435
1442
  var TIERS = ['2160', '1440', '1080', '720', 'sd', 'other'];
1436
1443
  var GROUPS = ['local', 'net', 'server', 'emby', 'plex', 'played'].concat(TIERS, ['ranked', 'unsuitable', 'worded', 'sized', 'bad', 'where']);
1437
- var GROUP_TITLES = { local: 'On your USB drive', net: 'On your network folder', server: 'On your Jellyfin server', emby: 'On your Emby server', plex: 'On your Plex server', played: 'Played before', '2160': '4K', '1440': '1440p', '1080': '1080p', '720': '720p',
1438
- sd: 'SD', other: 'Other', ranked: 'Sources', unsuitable: 'Marked not suitable', worded: 'Hidden by your words', sized: 'Outside your size limits', bad: 'Not working or not allowed on this TV', where: 'Where to watch · other apps' };
1444
+ var GROUP_TITLES = { local: U.t('On your USB drive'), net: U.t('On your network folder'), server: U.t('On your Jellyfin server'), emby: U.t('On your Emby server'), plex: U.t('On your Plex server'), played: U.t('Played before'), '2160': '4K', '1440': '1440p', '1080': '1080p', '720': '720p',
1445
+ sd: 'SD', other: U.t('Other'), ranked: U.t('Sources'), unsuitable: U.t('Marked not suitable'), worded: U.t('Hidden by your words'), sized: U.t('Outside your size limits'), bad: U.t('Not working or not allowed on this TV'), where: U.t('Where to watch · other apps') };
1439
1446
  var KIND_SCORE = { remux: 4, bluray: 3, web: 2, hdtv: 1, '': 1.5, cam: -5 };
1440
1447
  function tierOf(info) {
1441
1448
  return info.res >= 2160 ? '2160' : info.res >= 1440 ? '1440' : info.res >= 1080 ? '1080' : info.res >= 720 ? '720' : info.res > 0 ? 'sd' : 'other';
@@ -1540,7 +1547,7 @@
1540
1547
  else if (r.info.hdr) { bits.push('HDR'); }
1541
1548
  var out = bits.join(' ');
1542
1549
  if (r.info.cache > 0) { out += ' ⚡'; }
1543
- if (r.group === 'played') { out += ' · played before'; }
1550
+ if (r.group === 'played') { out += ' · ' + U.t('played before'); }
1544
1551
  return out;
1545
1552
  }
1546
1553
 
@@ -1638,10 +1645,10 @@
1638
1645
  var canService = serviceHlsOk(stream);
1639
1646
  if (!canStart && !canDownload && !canService) { toggleUnsuitable(stream); return; }
1640
1647
  var unsuit = isUnsuitable(_d.id, stream), opts = [];
1641
- if (canStart) { opts.push(['start', 'Play from the start']); }
1642
- if (canService) { opts.push(['service', 'Play through StremioK’s service']); }
1643
- if (canDownload) { opts.push(['download', '⬇ Download to USB drive']); }
1644
- opts.push(['suit', unsuit ? 'Put back among the sources' : 'Not suitable']);
1648
+ if (canStart) { opts.push(['start', U.t('Play from the start')]); }
1649
+ if (canService) { opts.push(['service', U.t('Play through StremioK’s service')]); }
1650
+ if (canDownload) { opts.push(['download', U.t('⬇ Download to USB drive')]); }
1651
+ opts.push(['suit', unsuit ? U.t('Put back among the sources') : U.t('Not suitable')]);
1645
1652
  pickList(Stremio.streamName(stream), opts, null, function (k) {
1646
1653
  if (k === 'start') { startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, { fromStart: true }); }
1647
1654
  else if (k === 'service') { startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, { viaService: true, fromStart: !!howHere() }); }
@@ -1652,7 +1659,7 @@
1652
1659
  // What a download of this title's video is saved as (here, and from the player: ctx.downloadAs).
1653
1660
  function downloadTitle(videoId) {
1654
1661
  var meta = _d.meta || {}, ep = (_d.type === 'series' && videoId) ? ('' + videoId).match(/:(\d+):(\d+)$/) : null;
1655
- var label = (meta.name || meta.title || _d.streamLabel || 'Video') + (meta.year ? ' (' + meta.year + ')' : '') +
1662
+ var label = (meta.name || meta.title || _d.streamLabel || U.t('Video')) + (meta.year ? ' (' + meta.year + ')' : '') +
1656
1663
  (ep ? ' S' + (ep[1] < 10 ? '0' : '') + ep[1] + 'E' + (ep[2] < 10 ? '0' : '') + ep[2] : '');
1657
1664
  return { type: _d.type, videoId: videoId, label: label, titleId: _d.id, name: meta.name || meta.title || '', poster: meta.poster || '', year: meta.year || meta.releaseInfo || '' };
1658
1665
  }
@@ -1662,12 +1669,12 @@
1662
1669
  }
1663
1670
  function toggleUnsuitable(stream) {
1664
1671
  var titleId = _d && _d.id, on = !isUnsuitable(titleId, stream), name = Stremio.streamName(stream);
1665
- var msg = on ? 'Mark “' + name + '” as not suitable for this title? It moves to the bottom of the list, and out of Played before.'
1666
- : 'Put “' + name + '” back among this title’s sources?';
1667
- confirm(msg, on ? 'Not suitable' : 'Put back', function () {
1672
+ var msg = on ? U.t('Mark “{name}” as not suitable for this title? It moves to the bottom of the list, and out of Played before.', { name: name })
1673
+ : U.t('Put “{name}” back among this title’s sources?', { name: name });
1674
+ confirm(msg, on ? U.t('Not suitable') : U.t('Put back'), function () {
1668
1675
  setUnsuitable(titleId, stream, on);
1669
1676
  if (on) { forgetPlayed(titleId, stream, Stremio.streamInfo(stream)); }
1670
- U.toast(on ? 'Marked not suitable' : 'Back among the sources');
1677
+ U.toast(on ? U.t('Marked not suitable') : U.t('Back among the sources'));
1671
1678
  if (_d && _d.id === titleId && _d.mode === 'streams' && _d.streams) {
1672
1679
  _d.streams = sortStreams(_d.streams);
1673
1680
  redrawKeepingFocus(); // (on the same source, in its new place)
@@ -1796,8 +1803,8 @@
1796
1803
  var pend = _d.streamsPending || 0, label = _d.streamLabel || '';
1797
1804
  var title = (_d.meta && (_d.meta.name || _d.meta.title)) || '';
1798
1805
  var parts = [];
1799
- if (label && label !== title) { parts.push('Sources for ' + label); }
1800
- if (pend) { parts.push(pend + ' more addon' + (pend > 1 ? 's' : '') + ' still loading…'); }
1806
+ if (label && label !== title) { parts.push(U.t('Sources for {title}', { title: label })); }
1807
+ if (pend) { parts.push(U.tn(pend, '{n} more addon still loading…', '{n} more addons still loading…')); }
1801
1808
  return parts.join(' · ');
1802
1809
  }
1803
1810
  // ----- the source filter: Addon ▾ / Resolution ▾ next to ▶ Play best (this title's, on _d) -----
@@ -1833,12 +1840,12 @@
1833
1840
  function filterPill(kind, rows) {
1834
1841
  var f = filterOf(), opts = filterOptions(kind, rows);
1835
1842
  if (opts.length < 2 && !f[kind]) { return null; } // (no choice to make)
1836
- var label = kind === 'addon' ? 'Addon: ' + (f.addon || 'All') : 'Resolution: ' + (f.res ? GROUP_TITLES[f.res] : 'All');
1843
+ var label = kind === 'addon' ? U.t('Addon: {which}', { which: f.addon || U.t('All') }) : U.t('Resolution: {which}', { which: f.res ? GROUP_TITLES[f.res] : U.t('All') });
1837
1844
  var p = U.el('div', 'pill focusable filter-pill', label + ' ▾');
1838
1845
  if (_d._focusPill === 'filter-' + kind) { _d._epFocus = p; _d._focusPill = null; }
1839
1846
  p.__onselect = function () {
1840
1847
  var total = rows.filter(function (r) { return matchFilter(r, filterOf(), kind) && (kind === 'addon' || r.group !== 'where'); }).length;
1841
- pickList(kind === 'addon' ? 'Sources from' : 'Resolution', [['', 'All · ' + total]].concat(opts.map(function (o) { return [o[0], o[1] + ' · ' + o[2]]; })), f[kind], function (k) {
1848
+ pickList(kind === 'addon' ? U.t('Sources from') : U.t('Resolution'), [['', U.t('All') + ' · ' + total]].concat(opts.map(function (o) { return [o[0], o[1] + ' · ' + o[2]]; })), f[kind], function (k) {
1842
1849
  var now = filterOf();
1843
1850
  _d.filter = { addon: kind === 'addon' ? k : now.addon, res: kind === 'res' ? k : now.res };
1844
1851
  _d._focusPill = 'filter-' + kind;
@@ -1854,7 +1861,7 @@
1854
1861
  var best = (_d.streams && _d.streams.length) ? bestRow(filterRows(rankRowsFor(_d.streams))) : null;
1855
1862
  if (best) { startPlayback(best.st, _d.streamId, _d.streamLabel || _d.meta.name, howHere()); }
1856
1863
  else if (!_d.streams || _d.streamsPending > 0) { _d.autoBest = _d.streamId; }
1857
- else { U.toast('Nothing here plays on this TV'); }
1864
+ else { U.toast(U.t('Nothing here plays on this TV')); }
1858
1865
  }
1859
1866
  function streamActionsBar() {
1860
1867
  var row = U.el('div', 'btn-row streams-actions');
@@ -1862,12 +1869,12 @@
1862
1869
  // ▶ Play best: the top of the ranking (focused when the page opens), within the filter
1863
1870
  var best = allRows.length ? bestRow(filterRows(allRows)) : null;
1864
1871
  if (best) {
1865
- var pb = U.el('div', 'pill focusable play-best', '▶ Play best' + (howHere() ? ' from the start' : '') + ' · ' + describeRow(best));
1872
+ var pb = U.el('div', 'pill focusable play-best', '▶ ' + (howHere() ? U.t('Play best from the start') : U.t('Play best')) + ' · ' + describeRow(best));
1866
1873
  pb.__onselect = function () { startPlayback(best.st, _d.streamId, _d.streamLabel || _d.meta.name, howHere()); };
1867
1874
  var place = !howHere() && savedPlace(_d.streamId);
1868
1875
  if (place) { // hold OK: resuming, or from the start
1869
1876
  pb.__onlongpress = function () {
1870
- pickList(_d.streamLabel || _d.meta.name || '', [['resume', 'Play best, resuming at ' + U.fmtTime(place.position)], ['start', 'Play best from the start']], null, function (k) {
1877
+ pickList(_d.streamLabel || _d.meta.name || '', [['resume', U.t('Play best, resuming at {at}', { at: U.fmtTime(place.position) })], ['start', U.t('Play best from the start')]], null, function (k) {
1871
1878
  startPlayback(best.st, _d.streamId, _d.streamLabel || _d.meta.name, k === 'start' ? { fromStart: true } : null);
1872
1879
  });
1873
1880
  };
@@ -1883,6 +1890,8 @@
1883
1890
  var np = U.el('div', 'pill focusable', nowPlayingLabel('movie', npId));
1884
1891
  np.__onselect = function () { toggleNowPlaying('movie', _d.meta); np.textContent = nowPlayingLabel('movie', npId); };
1885
1892
  row.appendChild(np);
1893
+ var mlp = libraryPill('movie', npId);
1894
+ if (mlp) { row.appendChild(mlp); }
1886
1895
  var tp = trailerPill();
1887
1896
  if (tp) { row.appendChild(tp); }
1888
1897
  var mp = morePill();
@@ -1901,11 +1910,11 @@
1901
1910
  var panel = U.el('div', 'list-panel streams-panel');
1902
1911
  var listScroll = U.el('div', 'list-scroll');
1903
1912
  if (_d.streams === null) {
1904
- panel.appendChild(U.el('div', 'detail-meta', 'Loading sources…'));
1913
+ panel.appendChild(U.el('div', 'detail-meta', U.t('Loading sources…')));
1905
1914
  return panel;
1906
1915
  }
1907
1916
  if (!_d.streams.length) { // (asked again from here: an addon may have been slow or down)
1908
- var none = U.el('div', 'detail-meta no-sources', Stremio.hasStreamAddons && !Stremio.hasStreamAddons() ? 'No sources found. Add a stream addon in Settings.' : 'No sources found.');
1917
+ var none = U.el('div', 'detail-meta no-sources', Stremio.hasStreamAddons && !Stremio.hasStreamAddons() ? U.t('No sources found. Add a stream addon in Settings.') : U.t('No sources found.'));
1909
1918
  if (_d.embedded) { panel.appendChild(none); return panel; }
1910
1919
  listScroll.appendChild(none); // (in the list, above Re-scan: the list sits at the panel's top)
1911
1920
  (Stremio.streamNotes ? Stremio.streamNotes(addonType(), _d.streamId) : []).forEach(function (n) { // (why, when an addon says: AIOStreams)
@@ -1915,8 +1924,8 @@
1915
1924
  listScroll.appendChild(note);
1916
1925
  });
1917
1926
  var again = U.el('div', 'stream focusable rescan-row');
1918
- again.appendChild(document.createTextNode('↻ Re-scan for sources'));
1919
- again.appendChild(U.el('span', 's-sub', 'Ask all stream addons again'));
1927
+ again.appendChild(document.createTextNode(U.t('↻ Re-scan for sources')));
1928
+ again.appendChild(U.el('span', 's-sub', U.t('Ask all stream addons again')));
1920
1929
  again.__onselect = function () { rescanStreams(); };
1921
1930
  if (!_d._epFocus) { _d._epFocus = again; }
1922
1931
  listScroll.appendChild(again);
@@ -1940,7 +1949,7 @@
1940
1949
  });
1941
1950
  var gone = list.length - keptList.length;
1942
1951
  if (gone) {
1943
- listScroll.appendChild(U.el('div', 'streams-hidden', gone + (gone === 1 ? ' source the TV can’t play is hidden' : ' sources the TV can’t play are hidden') + ' (Settings › Playback › Source ranking)'));
1952
+ listScroll.appendChild(U.el('div', 'streams-hidden', U.tn(gone, '{n} source the TV can’t play is hidden', '{n} sources the TV can’t play are hidden') + ' ' + U.t('(Settings › Playback › Source ranking)')));
1944
1953
  list = keptList; rows = keptRows;
1945
1954
  }
1946
1955
  }
@@ -1949,8 +1958,8 @@
1949
1958
  if ((flt.addon || flt.res) && !_d.live) {
1950
1959
  var fl = [], fr = [];
1951
1960
  list.forEach(function (st, i) { if (rows[i] && matchFilter(rows[i], flt)) { fl.push(st); fr.push(rows[i]); } });
1952
- listScroll.appendChild(U.el('div', 'streams-hidden', 'Showing ' + fl.length + ' of ' + list.length + ' sources: ' +
1953
- [flt.addon, flt.res ? GROUP_TITLES[flt.res] : ''].filter(Boolean).join(' · ') + ' (Addon ▾ / Resolution ▾ above)'));
1961
+ listScroll.appendChild(U.el('div', 'streams-hidden', U.t('Showing {shown} of {all} sources: {filter} (Addon ▾ / Resolution ▾ above)', { shown: fl.length, all: list.length,
1962
+ filter: [flt.addon, flt.res ? GROUP_TITLES[flt.res] : ''].filter(Boolean).join(' · ') })));
1954
1963
  list = fl; rows = fr;
1955
1964
  }
1956
1965
  if (_d._keepStream) {
@@ -1990,23 +1999,23 @@
1990
1999
  var desc = Stremio.streamDescription(stream);
1991
2000
  if (size && !/(TB|GB|MB)\b/i.test(desc)) { lines.push('💾 ' + size); }
1992
2001
  if (desc) { lines.push(desc); }
1993
- if (stream._addon) { lines.push('⚙️ ' + stream._addon + (stream._also ? ' · also on ' + stream._also.join(', ') : '')); }
1994
- if (stream._earlier) { lines.push('🕘 From earlier: you played it ' + U.dayLabel(stream._earlier) + '; the addon didn’t answer in time just now, so it may no longer play'); }
1995
- if (row && row.unsuitable) { lines.push('⛔ Marked not suitable for this title · hold OK to put it back'); }
1996
- if (row && row.worded) { lines.push('🚫 Has your word “' + row.worded + '” (Settings › Playback › Source ranking)'); }
1997
- if (row && row.sized) { lines.push('📏 Outside your size limits: ' + row.sized + ' (Settings › Playback › Source ranking)'); }
1998
- if (row && row.blocked) { lines.push('⚠ ' + row.blocked + ' isn’t allowed (Settings › Playback › Formats)'); }
1999
- if (row && row.bad.length) { lines.push('⚠ Marked “Not working” on this TV: ' + row.bad.join(', ') + ' (Settings › Playback › Formats)'); }
2000
- if (stream._torrent) { lines.push('🧲 A torrent, through your streaming server (Settings › Content › Streaming server)'); }
2002
+ if (stream._addon) { lines.push('⚙️ ' + stream._addon + (stream._also ? ' · ' + U.t('also on {addons}', { addons: stream._also.join(', ') }) : '')); }
2003
+ if (stream._earlier) { lines.push('🕘 ' + U.t('From earlier: you played it {when}; the addon didn’t answer in time just now, so it may no longer play', { when: U.dayLabel(stream._earlier) })); }
2004
+ if (row && row.unsuitable) { lines.push(U.t('⛔ Marked not suitable for this title · hold OK to put it back')); }
2005
+ if (row && row.worded) { lines.push('🚫 ' + U.t('Has your word “{word}” (Settings › Playback › Source ranking)', { word: row.worded })); }
2006
+ if (row && row.sized) { lines.push('📏 ' + U.t('Outside your size limits: {limit} (Settings › Playback › Source ranking)', { limit: row.sized })); }
2007
+ if (row && row.blocked) { lines.push('⚠ ' + U.t('{format} isn’t allowed (Settings › Playback › Formats)', { format: row.blocked })); }
2008
+ if (row && row.bad.length) { lines.push('⚠ ' + U.t('Marked “Not working” on this TV: {formats} (Settings › Playback › Formats)', { formats: row.bad.join(', ') })); }
2009
+ if (stream._torrent) { lines.push(U.t('🧲 A torrent, through your streaming server (Settings › Content › Streaming server)')); }
2001
2010
  if (opens) {
2002
- lines.push('▶ OK opens ' + (opens.data ? 'it in ' : '') + opens.app.name);
2011
+ lines.push('▶ ' + (opens.data ? U.t('OK opens it in {app}', { app: opens.app.name }) : U.t('OK opens {app}', { app: opens.app.name })));
2003
2012
  } else if (!playable) {
2004
- if (stream.infoHash) { lines.push('— torrent: plays through a streaming server (Settings › Content › Streaming server)'); }
2013
+ if (stream.infoHash) { lines.push(U.t('— torrent: plays through a streaming server (Settings › Content › Streaming server)')); }
2005
2014
  else if (stream.externalUrl) {
2006
- lines.push('— another app' + ((typeof TVApps !== 'undefined' && TVApps.available())
2007
- ? ': add it in Settings › Content › Streaming apps to open it from here' : ' (not playable here)'));
2015
+ lines.push((typeof TVApps !== 'undefined' && TVApps.available())
2016
+ ? U.t('— another app: add it in Settings › Content › Streaming apps to open it from here') : U.t('— another app (not playable here)'));
2008
2017
  }
2009
- else { lines.push('— not directly playable on the TV'); }
2018
+ else { lines.push(U.t('— not directly playable on the TV')); }
2010
2019
  }
2011
2020
  var sub = U.el('span', 's-sub', lines.join('\n'));
2012
2021
  sub.style.whiteSpace = 'pre-line';
@@ -2019,7 +2028,7 @@
2019
2028
  }
2020
2029
  node.__onselect = function () {
2021
2030
  if (opens) { openWhere(opens); return; }
2022
- if (!playable) { U.toast(stream.infoHash ? 'Torrents play through a streaming server: Settings › Content › Streaming server' : 'This source can’t play directly on the TV.', stream.infoHash ? 6000 : undefined); return; }
2031
+ if (!playable) { U.toast(stream.infoHash ? U.t('Torrents play through a streaming server: Settings › Content › Streaming server') : U.t('This source can’t play directly on the TV.'), stream.infoHash ? 6000 : undefined); return; }
2023
2032
  startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, howHere());
2024
2033
  };
2025
2034
  return node;
@@ -2029,8 +2038,8 @@
2029
2038
  // file's own embedded stream, which no stream addon provides.
2030
2039
  if (!_d.embedded) {
2031
2040
  rescan = U.el('div', 'stream focusable rescan-row');
2032
- rescan.appendChild(document.createTextNode('↻ Re-scan for sources'));
2033
- rescan.appendChild(U.el('span', 's-sub', 'Refresh the list from all stream addons'));
2041
+ rescan.appendChild(document.createTextNode(U.t('↻ Re-scan for sources')));
2042
+ rescan.appendChild(U.el('span', 's-sub', U.t('Refresh the list from all stream addons')));
2034
2043
  rescan.__onselect = function () { rescanStreams(); };
2035
2044
  listScroll.appendChild(rescan);
2036
2045
  }
@@ -2062,7 +2071,7 @@
2062
2071
  // so the player lists them first ("with this source").
2063
2072
  function sourceSubsOf(st) {
2064
2073
  return U.listOf(st && st.subtitles, 50, function (t) { return typeof t.url === 'string' && /^https?:\/\//i.test(t.url); }).map(function (t, i) {
2065
- return { id: 'src:' + (t.id != null ? t.id : i), url: t.url, lang: typeof t.lang === 'string' ? t.lang : '', _addon: (st._addon || 'Source') + ' · with this source' };
2074
+ return { id: 'src:' + (t.id != null ? t.id : i), url: t.url, lang: typeof t.lang === 'string' ? t.lang : '', _addon: (st._addon || U.t('Source')) + ' · ' + U.t('with this source') };
2066
2075
  });
2067
2076
  }
2068
2077
  // The player's "Select source" list: each source with the request headers it needs
@@ -2087,7 +2096,7 @@
2087
2096
  function startPlayback(stream, videoId, label, how) {
2088
2097
  if (stream && stream.infoHash) { // (a torrent: its link from the streaming server set now)
2089
2098
  Stremio.torrentSource(stream);
2090
- if (!stream.url) { U.toast('Torrents play through a streaming server: Settings › Content › Streaming server', 6000); return null; }
2099
+ if (!stream.url) { U.toast(U.t('Torrents play through a streaming server: Settings › Content › Streaming server'), 6000); return null; }
2091
2100
  }
2092
2101
  // VOD changes progress/watched state. Live playback does not, and keeping Home
2093
2102
  // untouched lets us restore the exact originating card and scroll position.
@@ -2239,7 +2248,7 @@
2239
2248
  var ch = _d && _d.channels;
2240
2249
  if (!ch) { return; }
2241
2250
  var n = ch.list.length;
2242
- if (!(pos >= 1 && pos <= n)) { U.toast('No channel ' + pos + ' here (1 to ' + n + ')', 2000); return; }
2251
+ if (!(pos >= 1 && pos <= n)) { U.toast(U.t('No channel {n} here (1 to {max})', { n: pos, max: n }), 2000); return; }
2243
2252
  if (_zap) { clearTimeout(_zap.timer); _zap = null; }
2244
2253
  var m = ch.list[pos - 1].meta;
2245
2254
  U.toast(pos + ' / ' + n + ' ' + (m.name || m.title || ''), 1600);
@@ -2267,14 +2276,14 @@
2267
2276
  if (!ch || !Player.isActive()) { return; }
2268
2277
  var gen = ++_tuneGen;
2269
2278
  ch.tuning = idx;
2270
- var m = ch.list[idx].meta, type = m.type || page.type, name = m.name || m.title || 'Live';
2271
- U.spinner(true, 'Tuning to ' + name + '…');
2279
+ var m = ch.list[idx].meta, type = m.type || page.type, name = m.name || m.title || U.t('Live');
2280
+ U.spinner(true, U.t('Tuning to {name}…', { name: name }));
2272
2281
  Stremio.getStreams(type, m.id).then(function (list) {
2273
2282
  if (gen !== _tuneGen) { return; } // (a later channel was chosen: its own answer handles the spinner)
2274
2283
  ch.tuning = null;
2275
2284
  if (_d !== page || !Player.isActive()) { U.spinner(false); return; } // left the player meanwhile
2276
2285
  var playable = list.filter(Stremio.isPlayable);
2277
- if (!playable.length) { U.spinner(false); U.toast('No playable source for ' + name); return; }
2286
+ if (!playable.length) { U.spinner(false); U.toast(U.t('No playable source for {name}', { name: name })); return; }
2278
2287
  ch.idx = idx;
2279
2288
  page.id = m.id; page.type = type; page.meta = m; page.preview = m;
2280
2289
  page.streamId = m.id; page.streamLabel = name; page.streams = list;
@@ -2284,7 +2293,7 @@
2284
2293
  ch.tuning = null;
2285
2294
  if (_d !== page || !Player.isActive()) { U.spinner(false); return; }
2286
2295
  U.spinner(false);
2287
- U.toast('Couldn\'t load ' + name);
2296
+ U.toast(U.t('Couldn\'t load {name}', { name: name }));
2288
2297
  });
2289
2298
  }
2290
2299
 
@@ -2307,12 +2316,12 @@
2307
2316
  U.spinner(false);
2308
2317
  var pick = pickLikeLast(_d.id, _d.streams);
2309
2318
  if (!pick) {
2310
- U.toast('No playable source for that episode');
2319
+ U.toast(U.t('No playable source for that episode'));
2311
2320
  if (!Player.isActive()) { drawDetail(); }
2312
2321
  return;
2313
2322
  }
2314
2323
  startPlayback(pick, v.id, _d.streamLabel);
2315
- }, function () { if (!current()) { return; } U.spinner(false); U.toast('Failed to load that episode'); });
2324
+ }, function () { if (!current()) { return; } U.spinner(false); U.toast(U.t('Failed to load that episode')); });
2316
2325
  }
2317
2326
 
2318
2327
  // ----- binge: the next episode plays a source like the one you've been watching -----