stremiok 2.3.4 → 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 +9 -0
  2. package/README.md +1 -0
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +42 -40
  6. package/js/app.js +3 -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 +19 -19
  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 +59 -57
  34. package/js/player-lang.js +22 -22
  35. package/js/player-quality.js +15 -15
  36. package/js/player-store.js +13 -13
  37. package/js/player-subs.js +69 -69
  38. package/js/plex.js +11 -11
  39. package/js/stremio-account.js +8 -8
  40. package/js/stremio-sync.js +5 -5
  41. package/js/stremio.js +78 -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 +38 -26
  46. package/js/view-core.js +93 -93
  47. package/js/view-detail.js +124 -126
  48. package/js/view-discover.js +27 -27
  49. package/js/view-guide.js +13 -13
  50. package/js/view-home.js +124 -118
  51. package/js/view-search.js +25 -25
  52. package/js/view-settings.js +658 -642
  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
@@ -73,17 +73,17 @@
73
73
  var why = list.length ? '' : (Stremio.streamNotes ? Stremio.streamNotes(type, id) : []).slice(0, 3).map(function (n) { return n.addon + ' ' + n.title; }).join('; ');
74
74
  U.log('sources', 'No playable source for “' + ((_d.meta && _d.meta.name) || id) + '” (' + type + ' ' + id + '): ' +
75
75
  (list.length ? list.length + ' source(s), none playable here' : 'no addon sent any') + (why ? ' (' + why + ')' : ''));
76
- 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;
77
77
  }
78
78
  if (playable.length === 1) {
79
- startPlayback(playable[0], id, _d.streamLabel || _d.meta.name || 'Live');
79
+ startPlayback(playable[0], id, _d.streamLabel || _d.meta.name || U.t('Live'));
80
80
  } else if ((opts && opts.playBest) || _d.autoBest) { // (the remote's Play key)
81
81
  var top = bestRow(rankRowsFor(list));
82
- 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'));
83
83
  } else {
84
84
  drawDetail(); // multiple sources → straight to the source list
85
85
  }
86
- }, 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(); });
87
87
  }
88
88
 
89
89
  // opts.resume: a Continue Watching entry to play straight away (see startResume).
@@ -116,7 +116,7 @@
116
116
  _d.meta = Object.assign({ id: id, type: type }, _d.preview);
117
117
  afterMeta();
118
118
  } else {
119
- U.toast('Could not load details');
119
+ U.toast(U.t('Could not load details'));
120
120
  App.back();
121
121
  }
122
122
  });
@@ -207,14 +207,14 @@
207
207
  }
208
208
  // A season's name: a year ("2026"), "Videos" (a YouTube channel's undated list), or "Season 2".
209
209
  function seasonName(sn) {
210
- if (_d && _d.collection) { return 'Titles'; }
211
- if (_d && _d.addonType) { return _d.yearSeasons ? '' + sn : 'Videos'; }
212
- 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 });
213
213
  }
214
214
  // An episode as it's named on its own (the Play button, the player, Continue Watching): a
215
215
  // YouTube channel's video by its title, an episode by its code ("S2E5").
216
216
  function epName(v) {
217
- 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 || '');
218
218
  }
219
219
  // Seasons that are years (a YouTube channel): the newest first.
220
220
  function yearOrder() { return !!(_d && _d.yearSeasons); }
@@ -233,7 +233,7 @@
233
233
  behaviorHints: (p.fileHints && typeof p.fileHints === 'object') ? p.fileHints : undefined }; // (its file: for subtitles made for it)
234
234
  if (p.torrent && typeof p.torrent.infoHash === 'string') { // (a torrent: its link from the streaming server set now)
235
235
  st = Stremio.torrentSource({ infoHash: p.torrent.infoHash, fileIdx: p.torrent.fileIdx, sources: p.torrent.sources, name: p.name, behaviorHints: st.behaviorHints });
236
- 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; }
237
237
  }
238
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)
239
239
  resumeSources(startPlayback(st, p.id, p.name, how), p.id);
@@ -285,7 +285,7 @@
285
285
  var epTitle = ep.title || ep.name || '';
286
286
  bits.push(epCode(ep) + (epTitle ? ' “' + epTitle + '”' : ''));
287
287
  var aired = airsAt(ep);
288
- 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) })); }
289
289
  if (ep.rating && !isNaN(parseFloat(ep.rating))) { bits.push('★ ' + ep.rating); }
290
290
  } else {
291
291
  if (meta.releaseInfo) { bits.push(meta.releaseInfo); }
@@ -296,7 +296,7 @@
296
296
  var genres = (meta.genres && meta.genres.length) ? meta.genres : own.genres;
297
297
  if (genres.length) { bits.push(genres.slice(0, 3).join(', ')); }
298
298
  }
299
- 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)
300
300
  body.appendChild(U.el('div', 'detail-meta', bits.join(' · ')));
301
301
  var ratings = U.el('div', 'detail-ratings');
302
302
  body.appendChild(ratings);
@@ -410,7 +410,7 @@
410
410
  function withTmdb() { return Stremio.hasTmdb() && /^tt\d+$/.test(_d.id || ''); }
411
411
  function morePill() {
412
412
  if (!withTmdb() && !hasAddonPeople(_d.meta)) { return null; }
413
- 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'));
414
414
  p.__onselect = function () { _d.moreFrom = _d.mode; _d.mode = 'more'; drawDetail(); };
415
415
  if (_d._focusPill === 'more') { _d._epFocus = p; _d._focusPill = null; }
416
416
  return p;
@@ -418,7 +418,7 @@
418
418
  function ratingsPill() {
419
419
  var integ = Stremio.getIntegrations();
420
420
  if (!(integ.omdb || integ.tmdb) || !/^tt\d+$/.test(_d.id || '')) { return null; }
421
- 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'));
422
422
  p.__onselect = function () { _d.moreFrom = _d.mode; _d.mode = 'ratings'; drawDetail(); };
423
423
  if (_d._focusPill === 'ratings') { _d._epFocus = p; _d._focusPill = null; }
424
424
  return p;
@@ -427,7 +427,7 @@
427
427
  function morePanel() {
428
428
  var panel = U.el('div', 'list-panel more-panel');
429
429
  var rows = U.el('div', 'more-rows');
430
- rows.appendChild(U.el('div', 'row-empty', 'Loading…'));
430
+ rows.appendChild(U.el('div', 'row-empty', U.t('Loading…')));
431
431
  panel.appendChild(rows);
432
432
  var page = _d;
433
433
  var ep = shownEpisode();
@@ -439,16 +439,16 @@
439
439
  if (_d !== page || _d.mode !== 'more') { return; }
440
440
  U.clear(rows);
441
441
  if (!people || !people.length) {
442
- 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.'))); }
443
443
  focusLoaded(rows);
444
444
  return;
445
445
  }
446
- rows.appendChild(buildRow('Cast & more', people.map(personCard)));
446
+ rows.appendChild(buildRow(U.t('Cast & more'), people.map(personCard)));
447
447
  focusLoaded(rows);
448
448
  }, function () {
449
449
  if (_d !== page) { return; }
450
450
  U.clear(rows);
451
- 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.'))); }
452
452
  focusLoaded(rows);
453
453
  });
454
454
  return panel;
@@ -456,16 +456,16 @@
456
456
  Stremio.tmdbTitleExtras(page.type, page.id, pageCancel()).then(function (x) {
457
457
  if (_d !== page || _d.mode !== 'more') { return; }
458
458
  U.clear(rows);
459
- 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))); }
460
460
  var own = !(x && x.cast.length) && theirs(); // (no people from TMDB: the addon's)
461
461
  if (x && x.collection) { rows.appendChild(buildRow(x.collection.name, x.collection.parts.map(tmdbCard))); }
462
- if (x && x.similar.length) { rows.appendChild(buildRow('More like this', x.similar.map(tmdbCard))); }
463
- 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.'))); }
464
464
  focusLoaded(rows);
465
465
  }, function (err) {
466
466
  if (_d !== page || (err && err.cancelled)) { return; }
467
467
  U.clear(rows);
468
- 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.'))); }
469
469
  focusLoaded(rows);
470
470
  });
471
471
  return panel;
@@ -496,10 +496,10 @@
496
496
  // Rows of them, by name (no photos): OK searches for the name. Whether there were any.
497
497
  function appendAddonPeople(rows, meta) {
498
498
  var o = addonLinks(meta), any = false;
499
- [['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) {
500
500
  if (!g[1].length) { return; }
501
501
  any = true;
502
- 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]); })));
503
503
  });
504
504
  return any;
505
505
  }
@@ -550,7 +550,7 @@
550
550
  function peopleCard(p) {
551
551
  var c = personCard({ id: p.id, name: p.name, photo: p.photo, character: p.dept });
552
552
  c.__meta = { id: 'person:' + p.id, name: p.name, releaseInfo: p.dept,
553
- 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(', ') }) : '' };
554
554
  return c;
555
555
  }
556
556
 
@@ -575,9 +575,9 @@
575
575
  U.spinner(true);
576
576
  Stremio.tmdbImdbId(item.kind, item.tmdbId, pageCancel()).then(function (imdb) {
577
577
  U.spinner(false);
578
- 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; }
579
579
  then(imdb);
580
- }, function () { U.spinner(false); U.toast('Couldn\'t reach TMDB.'); });
580
+ }, function () { U.spinner(false); U.toast(U.t('Couldn\'t reach TMDB.')); });
581
581
  }
582
582
 
583
583
  // ----- a person's page (from the cast row) -----
@@ -594,7 +594,7 @@
594
594
  drawPerson();
595
595
  }, function () {
596
596
  U.spinner(false);
597
- 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.')); }
598
598
  });
599
599
  }
600
600
  function drawPerson() {
@@ -619,9 +619,9 @@
619
619
  panel.appendChild(rows);
620
620
  s.appendChild(panel);
621
621
  if (p) {
622
- if (p.movies.length) { rows.appendChild(buildRow('Movies', p.movies.map(tmdbCard))); }
623
- if (p.series.length) { rows.appendChild(buildRow('Series', p.series.map(tmdbCard))); }
624
- 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.'))); }
625
625
  }
626
626
  Focus.setScope(s, rows.querySelector('.focusable') || undefined);
627
627
  restoreFocusKey(s);
@@ -669,7 +669,7 @@
669
669
  }
670
670
  scroll.appendChild(table);
671
671
  panel.appendChild(scroll);
672
- 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.')));
673
673
  _d._epFocus = (_d.season != null && cells[_d.season + ':1']) || startCell;
674
674
  U.settleAll(ss.map(function (sn) {
675
675
  return function () {
@@ -758,7 +758,7 @@
758
758
  return (meta.videos || []).filter(function (v) { return v && v.streams && v.streams.length; });
759
759
  }
760
760
  function fileLabel(v) {
761
- var t = '' + (v.title || v.name || v.id || 'File');
761
+ var t = '' + (v.title || v.name || v.id || U.t('File'));
762
762
  return t.split('/').pop();
763
763
  }
764
764
  function fileStreams(v) {
@@ -812,7 +812,7 @@
812
812
  // ----- series: Resume / Play -----
813
813
  function seasonOf(v) { return v.season === undefined ? 1 : v.season; }
814
814
  function epCode(v) {
815
- 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)
816
816
  return 'S' + seasonOf(v) + 'E' + (v.episode || '?');
817
817
  }
818
818
 
@@ -851,7 +851,7 @@
851
851
  // watched all that's out): no Play, just when it airs.
852
852
  var airs = airsAt(up.v);
853
853
  if (_d.collection) { // (the next film you haven't watched: its page)
854
- 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 || '' }));
855
855
  open.__onselect = function () { openTitle(up.v); };
856
856
  row.appendChild(open);
857
857
  var tpc = trailerPill();
@@ -859,7 +859,7 @@
859
859
  return row;
860
860
  }
861
861
  if (!up.resume && !episodeWatched(up.v) && airs > Date.now()) {
862
- 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) })));
863
863
  } else {
864
864
  row.appendChild(playUpButton(up));
865
865
  }
@@ -879,8 +879,8 @@
879
879
  }
880
880
  function playUpButton(up) {
881
881
  var btn = U.el('div', 'pill focusable', up.resume
882
- ? '▶ Resume ' + epCode(up.v) + ' · ' + U.fmtTime(up.resume.position)
883
- : '▶ 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) }));
884
884
  btn.__onselect = function () {
885
885
  // resume the exact stream when one was saved; otherwise pick a source
886
886
  if (up.resume && up.resume.url) { startResume(up.resume); }
@@ -895,7 +895,7 @@
895
895
  if (up.resume && up.resume.position > 0) {
896
896
  btn.__onlongpress = function () {
897
897
  var code = epCode(up.v);
898
- 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) {
899
899
  if (k === 'resume') { btn.__onselect(); return; }
900
900
  if (up.resume.url) { startResume(Object.assign({}, up.resume, { fromStart: true })); }
901
901
  else { openStreams(up.v.id, epName(up.v), false, { fromStart: true }); }
@@ -951,7 +951,7 @@
951
951
  return (t.lang && mine.indexOf(t.lang) !== -1 && r < 3 ? 0 : 10) + r; // (yours first, ticket ads still last)
952
952
  }
953
953
  out.sort(function (a, b) { return (rank(a) - rank(b)) || (a.at - b.at); });
954
- 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'); } });
955
955
  return out;
956
956
  }
957
957
  // Your languages, two-letter (TMDB's): the audio's, the subtitles' (and their second choice).
@@ -964,12 +964,11 @@
964
964
  return out;
965
965
  }
966
966
  // A trailer as listed: its title, then its language, month and "unofficial", where known.
967
- var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
968
967
  function trailerLabel(t) {
969
968
  var bits = [t.name];
970
969
  if (t.lang && Player.langName) { bits.push(Player.langName(t.lang)); }
971
970
  var m = /^(\d{4})-(\d{2})/.exec(t.date || '');
972
- if (m) { bits.push(MONTHS[+m[2] - 1] + ' ' + m[1]); }
971
+ if (m) { bits.push(U.month(+m[2] - 1) + ' ' + m[1]); }
973
972
  if (t.official === false) { bits.push('unofficial'); }
974
973
  return bits.join(' · ');
975
974
  }
@@ -978,25 +977,25 @@
978
977
  // when it refuses (false: just that one, picked by hand).
979
978
  function playTrailers(list, next) {
980
979
  var meta = _d.meta, title = (meta && (meta.name || meta.title)) || '', passed = [], still = pageNow();
981
- U.spinner(true, 'Opening trailer…');
980
+ U.spinner(true, U.t('Opening trailer…'));
982
981
  YTPlay.ensureService().then(function () {
983
982
  function tryAt(i) {
984
983
  if (!still()) { U.spinner(false); return; }
985
984
  if (i >= list.length) {
986
985
  U.spinner(false);
987
- 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);
988
987
  return;
989
988
  }
990
989
  var t = list[i], page = 'https://www.youtube.com/watch?v=' + t.id;
991
990
  (YTPlay.canPlay ? YTPlay.canPlay(page) : Promise.resolve(true)).then(function (ok) {
992
991
  if (!ok) {
993
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' : ''));
994
- 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; }
995
994
  passed.push(t);
996
995
  tryAt(i + 1);
997
996
  return;
998
997
  }
999
- 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); }
1000
999
  playTrailer(t.id);
1001
1000
  });
1002
1001
  }
@@ -1025,11 +1024,11 @@
1025
1024
  }
1026
1025
  var list = trailersOf(_d.meta);
1027
1026
  if (!list.length || typeof YTPlay === 'undefined') { return null; }
1028
- 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 + ')' : ''));
1029
1028
  p.__onselect = function () { playTrailers(list, true); };
1030
1029
  if (list.length > 1) { // hold OK: the list, to pick one
1031
1030
  p.__onlongpress = function () {
1032
- 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); });
1033
1032
  };
1034
1033
  }
1035
1034
  if (_d._focusTrailer) { _d._epFocus = p; _d._focusTrailer = false; }
@@ -1059,7 +1058,7 @@
1059
1058
  }
1060
1059
  function epTrailerButton(ep, t) {
1061
1060
  var season = seasonName(seasonOf(ep));
1062
- 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'));
1063
1062
  p.__onselect = function () { playTrailer(t.ytId, (_d.meta.name || _d.meta.title || '') + ' ' + (t.season ? season : epCode(ep))); };
1064
1063
  if (_d._focusTrailer) { _d._epFocus = p; _d._focusTrailer = false; }
1065
1064
  return p;
@@ -1069,13 +1068,13 @@
1069
1068
  function playTrailer(ytId, label) {
1070
1069
  var page = 'https://www.youtube.com/watch?v=' + ytId;
1071
1070
  var meta = _d.meta, still = pageNow();
1072
- U.spinner(true, 'Opening trailer…');
1071
+ U.spinner(true, U.t('Opening trailer…'));
1073
1072
  YTPlay.ensureService().then(function () {
1074
1073
  U.spinner(false);
1075
1074
  if (!still()) { return; }
1076
1075
  Player.play({
1077
1076
  url: YTPlay.resolverUrl(page, 1080, false, ytLangFor(page)), variantUrl: YTPlay.resolverUrl(page), initialQualityHeight: 1080,
1078
- 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'),
1079
1078
  poster: meta.poster, streams: [], yt: page, trailer: true
1080
1079
  }, function () { _d._focusTrailer = true; drawDetail(); }); // back on the page, on the Trailer button
1081
1080
  }, function () {
@@ -1086,7 +1085,7 @@
1086
1085
 
1087
1086
  function movieActions() {
1088
1087
  var row = U.el('div', 'btn-row');
1089
- var play = U.el('div', 'pill focusable', '▶ Play');
1088
+ var play = U.el('div', 'pill focusable', U.t('▶ Play'));
1090
1089
  play.__onselect = function () { openStreams(_d.id, _d.meta.name, false, AUTO); };
1091
1090
  play.__onplay = function () { openStreams(_d.id, _d.meta.name, false, PLAY_KEY); };
1092
1091
  row.appendChild(play);
@@ -1104,7 +1103,7 @@
1104
1103
 
1105
1104
  // Hide spoilers (Settings › Appearance): for an episode not watched yet, 'pictures' (its still
1106
1105
  // blurred) or 'all' (its synopsis left out too); '' to show it.
1107
- var SPOILER_TEXT = 'Synopsis hidden: not watched yet';
1106
+ var SPOILER_TEXT = U.t('Synopsis hidden: not watched yet');
1108
1107
  function spoilerFor(v) {
1109
1108
  var mode = Stremio.getPrefs().spoilers;
1110
1109
  if (mode === 'off' || !v || _d.collection || episodeWatched(v)) { return ''; }
@@ -1146,28 +1145,28 @@
1146
1145
 
1147
1146
  function seasonMenu(meta, sn, allSeasons) {
1148
1147
  var on = !seasonWatched(meta, sn);
1149
- 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 }))]];
1150
1149
  // "up to here": the regular seasons before this one too (not specials, Season 0)
1151
1150
  var earlier = allSeasons.filter(function (x) { return x > 0 && x < sn; });
1152
- 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 })]); }
1153
1152
  var allOn = !seriesWatched(meta);
1154
- 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')]);
1155
1154
  var showId = (meta.id || _d.id || '').split(':')[0];
1156
1155
  if (typeof Trakt !== 'undefined' && Trakt.isConnected() && Trakt.rate && /^tt\d+$/.test(showId)) { // (on Trakt: by the show's IMDb id)
1157
1156
  var mine = Trakt.myRating('season', showId + ':' + sn);
1158
- 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 })]);
1159
1158
  }
1160
1159
  pickList(seasonName(sn), opts, null, function (what) {
1161
1160
  if (what === 'rate') { V.rateOnTrakt('season', showId + ':' + sn, (meta.name || '') + ' ' + seasonName(sn)); return; }
1162
1161
  if (what === 'season') {
1163
- 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) }));
1164
1163
  } else if (what === 'upto') {
1165
1164
  markEpisodes(idsOf(meta.videos.filter(function (v) {
1166
1165
  var x = (v.season === undefined ? 1 : v.season);
1167
1166
  return x > 0 && x <= sn;
1168
- })), true, 'Seasons ' + earlier[0] + '–' + sn + ' marked watched');
1167
+ })), true, U.t('Seasons {from}–{to} marked watched', { from: earlier[0], to: sn }));
1169
1168
  } else {
1170
- 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'));
1171
1170
  }
1172
1171
  _d.season = sn;
1173
1172
  _d._focusSeason = sn;
@@ -1178,7 +1177,7 @@
1178
1177
  function episodeMenu(meta, v) {
1179
1178
  var on = !episodeWatched(v);
1180
1179
  var code = epCode(v);
1181
- 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 })]];
1182
1181
  // every episode before this one (same order as Next), specials only within Season 0
1183
1182
  var ord = orderedEpisodes(meta), at = ord.indexOf(v), before = [];
1184
1183
  var sv = (v.season === undefined ? 1 : v.season);
@@ -1186,19 +1185,19 @@
1186
1185
  var x = (ord[i].season === undefined ? 1 : ord[i].season);
1187
1186
  if (x > 0 || sv === 0) { before.push(ord[i]); }
1188
1187
  }
1189
- 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 })]); }
1190
1189
  // it and every episode after it (the same order; specials only within Season 0), when one is watched
1191
1190
  var after = [v];
1192
1191
  for (var j = at + 1; j < ord.length; j++) {
1193
1192
  var y = (ord[j].season === undefined ? 1 : ord[j].season);
1194
1193
  if (y > 0 || sv === 0) { after.push(ord[j]); }
1195
1194
  }
1196
- 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 })]); }
1197
1196
  pickList(meta.name + ' ' + code, opts, null, function (what) {
1198
1197
  if (what === 'details') { openStreams(v.id, epName(v)); return; } // (its page: as OK on it)
1199
- if (what === 'one') { markEpisodes([v.id], on, on ? 'Marked watched' : 'Marked unwatched'); }
1200
- else if (what === 'fromhere') { markEpisodes(idsOf(after), false, 'Marked unwatched from ' + code + ' on'); }
1201
- 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 })); }
1202
1201
  _d.target = v.id;
1203
1202
  drawDetail();
1204
1203
  });
@@ -1209,15 +1208,15 @@
1209
1208
  function collectionMenu(meta, v) {
1210
1209
  var on = !episodeWatched(v), name = v.title || v.name || '';
1211
1210
  var before = orderedEpisodes(meta).slice(0, orderedEpisodes(meta).indexOf(v));
1212
- var opts = [['one', on ? 'Mark watched' : 'Mark unwatched']];
1213
- if (before.length) { opts.push(['upto', 'Mark watched up to “' + name + '” (' + (before.length + 1) + ' films)']); }
1214
- 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')]);
1215
1214
  pickList(name, opts, null, function (what) {
1216
1215
  if (what === 'open') { openTitle(v); return; }
1217
1216
  var films = what === 'one' ? [v] : before.concat([v]), mark = what === 'one' ? on : true;
1218
1217
  Player.setWatchedMany('movie', idsOf(films), mark);
1219
1218
  if (mark) { films.forEach(function (f) { Player.removeProgress('movie', f.id); }); } // (off Continue Watching: watched)
1220
- 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 }));
1221
1220
  _d.target = v.id;
1222
1221
  drawDetail();
1223
1222
  });
@@ -1314,7 +1313,7 @@
1314
1313
  var title = U.el('span', 'ep-title', (watched ? '✓ ' : '') + (_d.collection ? (v.title || v.name || '') + (yr ? ' (' + yr + ')' : '') : 'E' + (v.episode || '?') + ' ' + (v.title || v.name || '')));
1315
1314
  var rating = U.el('span', 'ep-rating', '');
1316
1315
  line.appendChild(title);
1317
- 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 }))); }
1318
1317
  line.appendChild(rating);
1319
1318
  body.appendChild(line);
1320
1319
  var ov = U.el('span', 'ep-ov', hide === 'all' ? SPOILER_TEXT : v.overview || '');
@@ -1409,14 +1408,13 @@
1409
1408
  // (matched by the service's name) asks first, once, naming the exact app.
1410
1409
  function openWhere(opens) {
1411
1410
  function go() {
1412
- U.toast('Opening ' + opens.app.name + '…', 2000);
1411
+ U.toast(U.t('Opening {app}…', { app: opens.app.name }), 2000);
1413
1412
  TVApps.openTitle(opens.app, opens.data).then(null, function (e) {
1414
- 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);
1415
1414
  });
1416
1415
  }
1417
1416
  if (!TVApps.isApproved || TVApps.isApproved(opens.app.id)) { go(); return; }
1418
- confirm('Open “' + opens.app.name + '” (' + opens.app.id + ') from “where to watch” sources? It isn’t one of your streaming apps; ' +
1419
- '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 () {
1420
1418
  TVApps.approve(opens.app.id); go();
1421
1419
  });
1422
1420
  }
@@ -1443,8 +1441,8 @@
1443
1441
  // links that don't play here.
1444
1442
  var TIERS = ['2160', '1440', '1080', '720', 'sd', 'other'];
1445
1443
  var GROUPS = ['local', 'net', 'server', 'emby', 'plex', 'played'].concat(TIERS, ['ranked', 'unsuitable', 'worded', 'sized', 'bad', 'where']);
1446
- 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',
1447
- 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') };
1448
1446
  var KIND_SCORE = { remux: 4, bluray: 3, web: 2, hdtv: 1, '': 1.5, cam: -5 };
1449
1447
  function tierOf(info) {
1450
1448
  return info.res >= 2160 ? '2160' : info.res >= 1440 ? '1440' : info.res >= 1080 ? '1080' : info.res >= 720 ? '720' : info.res > 0 ? 'sd' : 'other';
@@ -1549,7 +1547,7 @@
1549
1547
  else if (r.info.hdr) { bits.push('HDR'); }
1550
1548
  var out = bits.join(' ');
1551
1549
  if (r.info.cache > 0) { out += ' ⚡'; }
1552
- if (r.group === 'played') { out += ' · played before'; }
1550
+ if (r.group === 'played') { out += ' · ' + U.t('played before'); }
1553
1551
  return out;
1554
1552
  }
1555
1553
 
@@ -1647,10 +1645,10 @@
1647
1645
  var canService = serviceHlsOk(stream);
1648
1646
  if (!canStart && !canDownload && !canService) { toggleUnsuitable(stream); return; }
1649
1647
  var unsuit = isUnsuitable(_d.id, stream), opts = [];
1650
- if (canStart) { opts.push(['start', 'Play from the start']); }
1651
- if (canService) { opts.push(['service', 'Play through StremioK’s service']); }
1652
- if (canDownload) { opts.push(['download', '⬇ Download to USB drive']); }
1653
- 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')]);
1654
1652
  pickList(Stremio.streamName(stream), opts, null, function (k) {
1655
1653
  if (k === 'start') { startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, { fromStart: true }); }
1656
1654
  else if (k === 'service') { startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, { viaService: true, fromStart: !!howHere() }); }
@@ -1661,7 +1659,7 @@
1661
1659
  // What a download of this title's video is saved as (here, and from the player: ctx.downloadAs).
1662
1660
  function downloadTitle(videoId) {
1663
1661
  var meta = _d.meta || {}, ep = (_d.type === 'series' && videoId) ? ('' + videoId).match(/:(\d+):(\d+)$/) : null;
1664
- 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 + ')' : '') +
1665
1663
  (ep ? ' S' + (ep[1] < 10 ? '0' : '') + ep[1] + 'E' + (ep[2] < 10 ? '0' : '') + ep[2] : '');
1666
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 || '' };
1667
1665
  }
@@ -1671,12 +1669,12 @@
1671
1669
  }
1672
1670
  function toggleUnsuitable(stream) {
1673
1671
  var titleId = _d && _d.id, on = !isUnsuitable(titleId, stream), name = Stremio.streamName(stream);
1674
- var msg = on ? 'Mark “' + name + '” as not suitable for this title? It moves to the bottom of the list, and out of Played before.'
1675
- : 'Put “' + name + '” back among this title’s sources?';
1676
- 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 () {
1677
1675
  setUnsuitable(titleId, stream, on);
1678
1676
  if (on) { forgetPlayed(titleId, stream, Stremio.streamInfo(stream)); }
1679
- 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'));
1680
1678
  if (_d && _d.id === titleId && _d.mode === 'streams' && _d.streams) {
1681
1679
  _d.streams = sortStreams(_d.streams);
1682
1680
  redrawKeepingFocus(); // (on the same source, in its new place)
@@ -1805,8 +1803,8 @@
1805
1803
  var pend = _d.streamsPending || 0, label = _d.streamLabel || '';
1806
1804
  var title = (_d.meta && (_d.meta.name || _d.meta.title)) || '';
1807
1805
  var parts = [];
1808
- if (label && label !== title) { parts.push('Sources for ' + label); }
1809
- 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…')); }
1810
1808
  return parts.join(' · ');
1811
1809
  }
1812
1810
  // ----- the source filter: Addon ▾ / Resolution ▾ next to ▶ Play best (this title's, on _d) -----
@@ -1842,12 +1840,12 @@
1842
1840
  function filterPill(kind, rows) {
1843
1841
  var f = filterOf(), opts = filterOptions(kind, rows);
1844
1842
  if (opts.length < 2 && !f[kind]) { return null; } // (no choice to make)
1845
- 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') });
1846
1844
  var p = U.el('div', 'pill focusable filter-pill', label + ' ▾');
1847
1845
  if (_d._focusPill === 'filter-' + kind) { _d._epFocus = p; _d._focusPill = null; }
1848
1846
  p.__onselect = function () {
1849
1847
  var total = rows.filter(function (r) { return matchFilter(r, filterOf(), kind) && (kind === 'addon' || r.group !== 'where'); }).length;
1850
- 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) {
1851
1849
  var now = filterOf();
1852
1850
  _d.filter = { addon: kind === 'addon' ? k : now.addon, res: kind === 'res' ? k : now.res };
1853
1851
  _d._focusPill = 'filter-' + kind;
@@ -1863,7 +1861,7 @@
1863
1861
  var best = (_d.streams && _d.streams.length) ? bestRow(filterRows(rankRowsFor(_d.streams))) : null;
1864
1862
  if (best) { startPlayback(best.st, _d.streamId, _d.streamLabel || _d.meta.name, howHere()); }
1865
1863
  else if (!_d.streams || _d.streamsPending > 0) { _d.autoBest = _d.streamId; }
1866
- else { U.toast('Nothing here plays on this TV'); }
1864
+ else { U.toast(U.t('Nothing here plays on this TV')); }
1867
1865
  }
1868
1866
  function streamActionsBar() {
1869
1867
  var row = U.el('div', 'btn-row streams-actions');
@@ -1871,12 +1869,12 @@
1871
1869
  // ▶ Play best: the top of the ranking (focused when the page opens), within the filter
1872
1870
  var best = allRows.length ? bestRow(filterRows(allRows)) : null;
1873
1871
  if (best) {
1874
- 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));
1875
1873
  pb.__onselect = function () { startPlayback(best.st, _d.streamId, _d.streamLabel || _d.meta.name, howHere()); };
1876
1874
  var place = !howHere() && savedPlace(_d.streamId);
1877
1875
  if (place) { // hold OK: resuming, or from the start
1878
1876
  pb.__onlongpress = function () {
1879
- 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) {
1880
1878
  startPlayback(best.st, _d.streamId, _d.streamLabel || _d.meta.name, k === 'start' ? { fromStart: true } : null);
1881
1879
  });
1882
1880
  };
@@ -1912,11 +1910,11 @@
1912
1910
  var panel = U.el('div', 'list-panel streams-panel');
1913
1911
  var listScroll = U.el('div', 'list-scroll');
1914
1912
  if (_d.streams === null) {
1915
- panel.appendChild(U.el('div', 'detail-meta', 'Loading sources…'));
1913
+ panel.appendChild(U.el('div', 'detail-meta', U.t('Loading sources…')));
1916
1914
  return panel;
1917
1915
  }
1918
1916
  if (!_d.streams.length) { // (asked again from here: an addon may have been slow or down)
1919
- 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.'));
1920
1918
  if (_d.embedded) { panel.appendChild(none); return panel; }
1921
1919
  listScroll.appendChild(none); // (in the list, above Re-scan: the list sits at the panel's top)
1922
1920
  (Stremio.streamNotes ? Stremio.streamNotes(addonType(), _d.streamId) : []).forEach(function (n) { // (why, when an addon says: AIOStreams)
@@ -1926,8 +1924,8 @@
1926
1924
  listScroll.appendChild(note);
1927
1925
  });
1928
1926
  var again = U.el('div', 'stream focusable rescan-row');
1929
- again.appendChild(document.createTextNode('↻ Re-scan for sources'));
1930
- 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')));
1931
1929
  again.__onselect = function () { rescanStreams(); };
1932
1930
  if (!_d._epFocus) { _d._epFocus = again; }
1933
1931
  listScroll.appendChild(again);
@@ -1951,7 +1949,7 @@
1951
1949
  });
1952
1950
  var gone = list.length - keptList.length;
1953
1951
  if (gone) {
1954
- 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)')));
1955
1953
  list = keptList; rows = keptRows;
1956
1954
  }
1957
1955
  }
@@ -1960,8 +1958,8 @@
1960
1958
  if ((flt.addon || flt.res) && !_d.live) {
1961
1959
  var fl = [], fr = [];
1962
1960
  list.forEach(function (st, i) { if (rows[i] && matchFilter(rows[i], flt)) { fl.push(st); fr.push(rows[i]); } });
1963
- listScroll.appendChild(U.el('div', 'streams-hidden', 'Showing ' + fl.length + ' of ' + list.length + ' sources: ' +
1964
- [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(' · ') })));
1965
1963
  list = fl; rows = fr;
1966
1964
  }
1967
1965
  if (_d._keepStream) {
@@ -2001,23 +1999,23 @@
2001
1999
  var desc = Stremio.streamDescription(stream);
2002
2000
  if (size && !/(TB|GB|MB)\b/i.test(desc)) { lines.push('💾 ' + size); }
2003
2001
  if (desc) { lines.push(desc); }
2004
- if (stream._addon) { lines.push('⚙️ ' + stream._addon + (stream._also ? ' · also on ' + stream._also.join(', ') : '')); }
2005
- 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'); }
2006
- if (row && row.unsuitable) { lines.push('⛔ Marked not suitable for this title · hold OK to put it back'); }
2007
- if (row && row.worded) { lines.push('🚫 Has your word “' + row.worded + '” (Settings › Playback › Source ranking)'); }
2008
- if (row && row.sized) { lines.push('📏 Outside your size limits: ' + row.sized + ' (Settings › Playback › Source ranking)'); }
2009
- if (row && row.blocked) { lines.push('⚠ ' + row.blocked + ' isn’t allowed (Settings › Playback › Formats)'); }
2010
- if (row && row.bad.length) { lines.push('⚠ Marked “Not working” on this TV: ' + row.bad.join(', ') + ' (Settings › Playback › Formats)'); }
2011
- 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)')); }
2012
2010
  if (opens) {
2013
- 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 })));
2014
2012
  } else if (!playable) {
2015
- 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)')); }
2016
2014
  else if (stream.externalUrl) {
2017
- lines.push('— another app' + ((typeof TVApps !== 'undefined' && TVApps.available())
2018
- ? ': 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)'));
2019
2017
  }
2020
- else { lines.push('— not directly playable on the TV'); }
2018
+ else { lines.push(U.t('— not directly playable on the TV')); }
2021
2019
  }
2022
2020
  var sub = U.el('span', 's-sub', lines.join('\n'));
2023
2021
  sub.style.whiteSpace = 'pre-line';
@@ -2030,7 +2028,7 @@
2030
2028
  }
2031
2029
  node.__onselect = function () {
2032
2030
  if (opens) { openWhere(opens); return; }
2033
- 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; }
2034
2032
  startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, howHere());
2035
2033
  };
2036
2034
  return node;
@@ -2040,8 +2038,8 @@
2040
2038
  // file's own embedded stream, which no stream addon provides.
2041
2039
  if (!_d.embedded) {
2042
2040
  rescan = U.el('div', 'stream focusable rescan-row');
2043
- rescan.appendChild(document.createTextNode('↻ Re-scan for sources'));
2044
- 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')));
2045
2043
  rescan.__onselect = function () { rescanStreams(); };
2046
2044
  listScroll.appendChild(rescan);
2047
2045
  }
@@ -2073,7 +2071,7 @@
2073
2071
  // so the player lists them first ("with this source").
2074
2072
  function sourceSubsOf(st) {
2075
2073
  return U.listOf(st && st.subtitles, 50, function (t) { return typeof t.url === 'string' && /^https?:\/\//i.test(t.url); }).map(function (t, i) {
2076
- 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') };
2077
2075
  });
2078
2076
  }
2079
2077
  // The player's "Select source" list: each source with the request headers it needs
@@ -2098,7 +2096,7 @@
2098
2096
  function startPlayback(stream, videoId, label, how) {
2099
2097
  if (stream && stream.infoHash) { // (a torrent: its link from the streaming server set now)
2100
2098
  Stremio.torrentSource(stream);
2101
- 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; }
2102
2100
  }
2103
2101
  // VOD changes progress/watched state. Live playback does not, and keeping Home
2104
2102
  // untouched lets us restore the exact originating card and scroll position.
@@ -2250,7 +2248,7 @@
2250
2248
  var ch = _d && _d.channels;
2251
2249
  if (!ch) { return; }
2252
2250
  var n = ch.list.length;
2253
- 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; }
2254
2252
  if (_zap) { clearTimeout(_zap.timer); _zap = null; }
2255
2253
  var m = ch.list[pos - 1].meta;
2256
2254
  U.toast(pos + ' / ' + n + ' ' + (m.name || m.title || ''), 1600);
@@ -2278,14 +2276,14 @@
2278
2276
  if (!ch || !Player.isActive()) { return; }
2279
2277
  var gen = ++_tuneGen;
2280
2278
  ch.tuning = idx;
2281
- var m = ch.list[idx].meta, type = m.type || page.type, name = m.name || m.title || 'Live';
2282
- 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 }));
2283
2281
  Stremio.getStreams(type, m.id).then(function (list) {
2284
2282
  if (gen !== _tuneGen) { return; } // (a later channel was chosen: its own answer handles the spinner)
2285
2283
  ch.tuning = null;
2286
2284
  if (_d !== page || !Player.isActive()) { U.spinner(false); return; } // left the player meanwhile
2287
2285
  var playable = list.filter(Stremio.isPlayable);
2288
- 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; }
2289
2287
  ch.idx = idx;
2290
2288
  page.id = m.id; page.type = type; page.meta = m; page.preview = m;
2291
2289
  page.streamId = m.id; page.streamLabel = name; page.streams = list;
@@ -2295,7 +2293,7 @@
2295
2293
  ch.tuning = null;
2296
2294
  if (_d !== page || !Player.isActive()) { U.spinner(false); return; }
2297
2295
  U.spinner(false);
2298
- U.toast('Couldn\'t load ' + name);
2296
+ U.toast(U.t('Couldn\'t load {name}', { name: name }));
2299
2297
  });
2300
2298
  }
2301
2299
 
@@ -2318,12 +2316,12 @@
2318
2316
  U.spinner(false);
2319
2317
  var pick = pickLikeLast(_d.id, _d.streams);
2320
2318
  if (!pick) {
2321
- U.toast('No playable source for that episode');
2319
+ U.toast(U.t('No playable source for that episode'));
2322
2320
  if (!Player.isActive()) { drawDetail(); }
2323
2321
  return;
2324
2322
  }
2325
2323
  startPlayback(pick, v.id, _d.streamLabel);
2326
- }, 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')); });
2327
2325
  }
2328
2326
 
2329
2327
  // ----- binge: the next episode plays a source like the one you've been watching -----