stremiok 2.3.4 → 2.3.6

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 (64) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +14 -13
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +43 -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 +1972 -0
  14. package/js/lang/de.js +1972 -0
  15. package/js/lang/es.js +1972 -0
  16. package/js/lang/fi.js +1972 -0
  17. package/js/lang/fr.js +1972 -0
  18. package/js/lang/he.js +1972 -0
  19. package/js/lang/hi.js +1972 -0
  20. package/js/lang/it.js +1972 -0
  21. package/js/lang/ja.js +1972 -0
  22. package/js/lang/ko.js +1972 -0
  23. package/js/lang/languages.js +21 -0
  24. package/js/lang/pl.js +1972 -0
  25. package/js/lang/pt-BR.js +1972 -0
  26. package/js/lang/ru.js +1972 -0
  27. package/js/lang/tr.js +1972 -0
  28. package/js/lang/zh-CN.js +1972 -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 +90 -58
  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/plugins.js +270 -0
  40. package/js/stremio-account.js +8 -8
  41. package/js/stremio-sync.js +5 -5
  42. package/js/stremio.js +81 -78
  43. package/js/stvod.js +4 -4
  44. package/js/trakt.js +23 -23
  45. package/js/tvapps.js +4 -4
  46. package/js/util.js +48 -27
  47. package/js/vendor/quickjs/LICENSES.md +412 -0
  48. package/js/vendor/quickjs/crypto-js.js +6659 -0
  49. package/js/vendor/quickjs/plugin-worker-legacy.js +1364 -0
  50. package/js/vendor/quickjs/plugin-worker.js +8774 -0
  51. package/js/vendor/quickjs/quickjs.wasm +0 -0
  52. package/js/view-core.js +93 -93
  53. package/js/view-detail.js +132 -130
  54. package/js/view-discover.js +27 -27
  55. package/js/view-guide.js +13 -13
  56. package/js/view-home.js +124 -118
  57. package/js/view-search.js +25 -25
  58. package/js/view-settings.js +743 -643
  59. package/js/xtvod.js +2 -2
  60. package/js/youtube.js +17 -17
  61. package/js/ytplay.js +39 -9
  62. package/package.json +1 -1
  63. package/service/index.js +227 -13
  64. package/tizenbrew.html +1 -1
@@ -28,14 +28,14 @@
28
28
  function renderEntry(cfg) {
29
29
  var s = scr('addaddon');
30
30
  U.clear(s);
31
- s.appendChild(header(cfg.title || 'Enter value'));
31
+ s.appendChild(header(cfg.title || U.t('Enter value')));
32
32
 
33
33
  var wrap = U.el('div', 'add-wrap');
34
34
  if (cfg.hint) { wrap.appendChild(U.el('div', 'add-hint', cfg.hint)); }
35
35
 
36
36
  var input = document.createElement('input');
37
37
  input.id = 'entry-input';
38
- input.type = cfg.secret ? 'password' : 'text';
38
+ input.type = cfg.secret ? U.t('password') : 'text';
39
39
  input.className = 'focusable add-input';
40
40
  input.value = cfg.value || '';
41
41
  if (cfg.placeholder) { input.placeholder = cfg.placeholder; }
@@ -50,21 +50,21 @@
50
50
  wrap.appendChild(input);
51
51
 
52
52
  var row = U.el('div', 'add-btn-row');
53
- var confirmBtn = U.el('div', 'pill focusable', 'Confirm');
54
- var cancelBtn = U.el('div', 'pill focusable', 'Cancel');
53
+ var confirmBtn = U.el('div', 'pill focusable', U.t('Confirm'));
54
+ var cancelBtn = U.el('div', 'pill focusable', U.t('Cancel'));
55
55
  confirmBtn.__onselect = doConfirm;
56
56
  cancelBtn.__onselect = function () { App.back(); };
57
57
 
58
58
  // Order: Validate · Confirm · Cancel
59
59
  var valBtn = null;
60
60
  if (cfg.validator) {
61
- valBtn = U.el('div', 'pill focusable', 'Validate');
61
+ valBtn = U.el('div', 'pill focusable', U.t('Validate'));
62
62
  valBtn.__onselect = function () {
63
63
  var v = ('' + input.value).trim();
64
- if (!v) { U.toast('Enter a key first'); return; }
65
- U.toast('Validating…', 4000);
64
+ if (!v) { U.toast(U.t('Enter a key first')); return; }
65
+ U.toast(U.t('Validating…'), 4000);
66
66
  cfg.validator(v).then(function (ok) {
67
- U.toast(ok ? '✓ Key is valid' : '✗ Key rejected (or unreachable)', 3500);
67
+ U.toast(ok ? U.t('✓ Key is valid') : U.t('✗ Key rejected (or unreachable)'), 3500);
68
68
  });
69
69
  };
70
70
  row.appendChild(valBtn);
@@ -72,11 +72,11 @@
72
72
  row.appendChild(confirmBtn);
73
73
  // From your phone (cfg.phone: what it's for): what's sent fills the field, to check and Confirm
74
74
  if (cfg.phone && V.phoneEntry) {
75
- var phoneBtn = U.el('div', 'pill focusable', '▣ From your phone');
75
+ var phoneBtn = U.el('div', 'pill focusable', U.t('▣ From your phone'));
76
76
  phoneBtn.__onselect = function () {
77
77
  var takes = cfg.phoneText; // (text the caller takes as it is from the phone: an import's pasted file)
78
- V.phoneEntry({ title: cfg.title || 'Enter value', what: cfg.phone, validate: function (t) { return takes && takes.accepts(t) ? null : (cfg.validate ? cfg.validate(t) : null); },
79
- onText: function (t) { if (takes && takes.accepts(t)) { takes.take(t); return; } input.value = t; Focus.setFocus(confirmBtn); U.toast('From your phone: check it, then Confirm', 3500); },
78
+ V.phoneEntry({ title: cfg.title || U.t('Enter value'), what: cfg.phone, validate: function (t) { return takes && takes.accepts(t) ? null : (cfg.validate ? cfg.validate(t) : null); },
79
+ onText: function (t) { if (takes && takes.accepts(t)) { takes.take(t); return; } input.value = t; Focus.setFocus(confirmBtn); U.toast(U.t('From your phone: check it, then Confirm'), 3500); },
80
80
  onType: function () { Focus.setFocus(input); } });
81
81
  };
82
82
  row.appendChild(phoneBtn);
@@ -100,35 +100,35 @@
100
100
 
101
101
  // ================= SUBTITLE CONFIG =================
102
102
  // Every language player-lang recognizes on a track (its LANG_ALIASES), by name.
103
- var SUB_LANGS = [['off', 'Off'], ['afr', 'Afrikaans'], ['alb', 'Albanian'], ['ara', 'Arabic'],
104
- ['arg', 'Aragonese'], ['arm', 'Armenian'], ['ast', 'Asturian'], ['aze', 'Azerbaijani'],
105
- ['baq', 'Basque'], ['bel', 'Belarusian'], ['ben', 'Bengali'], ['bos', 'Bosnian'],
106
- ['bre', 'Breton'], ['bul', 'Bulgarian'], ['bur', 'Burmese'], ['cat', 'Catalan'],
107
- ['chi', 'Chinese'], ['hrv', 'Croatian'], ['cze', 'Czech'], ['dan', 'Danish'], ['prs', 'Dari'],
108
- ['dut', 'Dutch'], ['eng', 'English'], ['epo', 'Esperanto'], ['est', 'Estonian'],
109
- ['ext', 'Extremaduran'], ['fil', 'Filipino'], ['fin', 'Finnish'], ['fre', 'French'],
110
- ['glg', 'Galician'], ['geo', 'Georgian'], ['ger', 'German'], ['gre', 'Greek'],
111
- ['heb', 'Hebrew'], ['hin', 'Hindi'], ['hun', 'Hungarian'], ['ice', 'Icelandic'],
112
- ['ibo', 'Igbo'], ['ind', 'Indonesian'], ['ina', 'Interlingua'], ['gle', 'Irish'],
113
- ['ita', 'Italian'], ['jpn', 'Japanese'], ['kan', 'Kannada'], ['kaz', 'Kazakh'],
114
- ['khm', 'Khmer'], ['kor', 'Korean'], ['kur', 'Kurdish'], ['lav', 'Latvian'],
115
- ['lit', 'Lithuanian'], ['ltz', 'Luxembourgish'], ['mac', 'Macedonian'], ['may', 'Malay'],
116
- ['mal', 'Malayalam'], ['mni', 'Manipuri'], ['mar', 'Marathi'], ['mon', 'Mongolian'],
117
- ['mne', 'Montenegrin'], ['nav', 'Navajo'], ['nep', 'Nepali'], ['sme', 'Northern Sami'],
118
- ['nor', 'Norwegian'], ['oci', 'Occitan'], ['ori', 'Odia'], ['pus', 'Pashto'],
119
- ['per', 'Persian'], ['pol', 'Polish'], ['por', 'Portuguese'], ['pan', 'Punjabi'],
120
- ['rum', 'Romanian'], ['rus', 'Russian'], ['sat', 'Santali'], ['gla', 'Scottish Gaelic'],
121
- ['srp', 'Serbian'], ['snd', 'Sindhi'], ['sin', 'Sinhala'], ['slo', 'Slovak'],
122
- ['slv', 'Slovenian'], ['som', 'Somali'], ['spa', 'Spanish'], ['swa', 'Swahili'],
123
- ['swe', 'Swedish'], ['syr', 'Syriac'], ['tam', 'Tamil'], ['tat', 'Tatar'], ['tel', 'Telugu'],
124
- ['tha', 'Thai'], ['tok', 'Toki Pona'], ['tur', 'Turkish'], ['tuk', 'Turkmen'],
125
- ['ukr', 'Ukrainian'], ['urd', 'Urdu'], ['uzb', 'Uzbek'], ['vie', 'Vietnamese'],
126
- ['wel', 'Welsh']];
103
+ var SUB_LANGS = [['off', U.t('Off')], ['afr', U.t('Afrikaans')], ['alb', U.t('Albanian')], ['ara', U.t('Arabic')],
104
+ ['arg', U.t('Aragonese')], ['arm', U.t('Armenian')], ['ast', U.t('Asturian')], ['aze', U.t('Azerbaijani')],
105
+ ['baq', U.t('Basque')], ['bel', U.t('Belarusian')], ['ben', U.t('Bengali')], ['bos', U.t('Bosnian')],
106
+ ['bre', U.t('Breton')], ['bul', U.t('Bulgarian')], ['bur', U.t('Burmese')], ['cat', U.t('Catalan')],
107
+ ['chi', U.t('Chinese')], ['hrv', U.t('Croatian')], ['cze', U.t('Czech')], ['dan', U.t('Danish')], ['prs', U.t('Dari')],
108
+ ['dut', U.t('Dutch')], ['eng', 'English'], ['epo', U.t('Esperanto')], ['est', U.t('Estonian')],
109
+ ['ext', U.t('Extremaduran')], ['fil', U.t('Filipino')], ['fin', U.t('Finnish')], ['fre', U.t('French')],
110
+ ['glg', U.t('Galician')], ['geo', U.t('Georgian')], ['ger', U.t('German')], ['gre', U.t('Greek')],
111
+ ['heb', U.t('Hebrew')], ['hin', U.t('Hindi')], ['hun', U.t('Hungarian')], ['ice', U.t('Icelandic')],
112
+ ['ibo', U.t('Igbo')], ['ind', U.t('Indonesian')], ['ina', U.t('Interlingua')], ['gle', U.t('Irish')],
113
+ ['ita', U.t('Italian')], ['jpn', U.t('Japanese')], ['kan', U.t('Kannada')], ['kaz', U.t('Kazakh')],
114
+ ['khm', U.t('Khmer')], ['kor', U.t('Korean')], ['kur', U.t('Kurdish')], ['lav', U.t('Latvian')],
115
+ ['lit', U.t('Lithuanian')], ['ltz', U.t('Luxembourgish')], ['mac', U.t('Macedonian')], ['may', U.t('Malay')],
116
+ ['mal', U.t('Malayalam')], ['mni', U.t('Manipuri')], ['mar', U.t('Marathi')], ['mon', U.t('Mongolian')],
117
+ ['mne', U.t('Montenegrin')], ['nav', U.t('Navajo')], ['nep', U.t('Nepali')], ['sme', U.t('Northern Sami')],
118
+ ['nor', U.t('Norwegian')], ['oci', U.t('Occitan')], ['ori', U.t('Odia')], ['pus', U.t('Pashto')],
119
+ ['per', U.t('Persian')], ['pol', U.t('Polish')], ['por', U.t('Portuguese')], ['pan', U.t('Punjabi')],
120
+ ['rum', U.t('Romanian')], ['rus', U.t('Russian')], ['sat', U.t('Santali')], ['gla', U.t('Scottish Gaelic')],
121
+ ['srp', U.t('Serbian')], ['snd', U.t('Sindhi')], ['sin', U.t('Sinhala')], ['slo', U.t('Slovak')],
122
+ ['slv', U.t('Slovenian')], ['som', U.t('Somali')], ['spa', U.t('Spanish')], ['swa', U.t('Swahili')],
123
+ ['swe', U.t('Swedish')], ['syr', U.t('Syriac')], ['tam', U.t('Tamil')], ['tat', U.t('Tatar')], ['tel', U.t('Telugu')],
124
+ ['tha', U.t('Thai')], ['tok', U.t('Toki Pona')], ['tur', U.t('Turkish')], ['tuk', U.t('Turkmen')],
125
+ ['ukr', U.t('Ukrainian')], ['urd', U.t('Urdu')], ['uzb', U.t('Uzbek')], ['vie', U.t('Vietnamese')],
126
+ ['wel', U.t('Welsh')]];
127
127
  // A second choice, turned on when nothing is in the default language (from any source).
128
- var SUB_LANGS2 = [['none', 'None']].concat(SUB_LANGS.slice(1));
128
+ var SUB_LANGS2 = [['none', U.t('None')]].concat(SUB_LANGS.slice(1));
129
129
  // The subtitle menu with only the three languages above (and tracks of no known language).
130
- var SUB_ONLY = [['off', 'Off'], ['on', 'On']];
131
- var SUB_SIZES = [['small', 'Small'], ['medium', 'Medium'], ['large', 'Large'], ['xlarge', 'Extra Large']];
130
+ var SUB_ONLY = [['off', U.t('Off')], ['on', U.t('On')]];
131
+ var SUB_SIZES = [['small', U.t('Small')], ['medium', U.t('Medium')], ['large', U.t('Large')], ['xlarge', U.t('Extra Large')]];
132
132
 
133
133
  function labelFor(list, v) {
134
134
  for (var i = 0; i < list.length; i++) { if (list[i][0] === v) { return list[i][1]; } }
@@ -143,7 +143,7 @@
143
143
  function render() { name.textContent = caption + ': ' + labelFor(list, store.get()[key]); }
144
144
  render();
145
145
  row.appendChild(name);
146
- row.appendChild(U.el('div', 'a-url', 'Press OK to choose' + (store.warning ? '. ' + store.warning : '')));
146
+ row.appendChild(U.el('div', 'a-url', U.t('Press OK to choose') + (store.warning ? '. ' + store.warning : '')));
147
147
  row.__onselect = function () {
148
148
  pickList(caption, list, store.get()[key], function (v) {
149
149
  var cfg = store.get(); cfg[key] = v; store.set(cfg);
@@ -155,12 +155,12 @@
155
155
 
156
156
  // Audio: same languages as subtitles, with "use the first track" in place of Off, and
157
157
  // a second choice for when the first isn't on the stream.
158
- var AUDIO_LANGS = [['default', 'Default (first track)']].concat(SUB_LANGS.slice(1));
159
- var AUDIO_LANGS2 = [['none', 'None']].concat(SUB_LANGS.slice(1));
158
+ var AUDIO_LANGS = [['default', U.t('Default (first track)')]].concat(SUB_LANGS.slice(1));
159
+ var AUDIO_LANGS2 = [['none', U.t('None')]].concat(SUB_LANGS.slice(1));
160
160
  // Switching to it, one choice: Quick (picked before it plays; a later switch reloads at
161
161
  // once), or Safe (picked once it plays) whose reload waits 3, 6 or 10 s after a start or a
162
162
  // jump: the 2017 TV's player crashes on a jump made right after another (10 s it needed).
163
- var AUDIO_SWITCH = [['quick', 'Quick (no wait)'], ['safe3', 'Safe, waits 3 seconds'], ['safe6', 'Safe, waits 6 seconds'], ['safe10', 'Safe, waits 10 seconds (safest)']];
163
+ var AUDIO_SWITCH = [['quick', U.t('Quick (no wait)')], ['safe3', U.t('Safe, waits 3 seconds')], ['safe6', U.t('Safe, waits 6 seconds')], ['safe10', U.t('Safe, waits 10 seconds (safest)')]];
164
164
  function settingsAudio(wrap) {
165
165
  var store = { get: Player.getAudioCfg, set: Player.setAudioCfg };
166
166
  var switching = {
@@ -172,25 +172,24 @@
172
172
  Player.setAudioCfg(a);
173
173
  }
174
174
  };
175
- wrap.appendChild(U.el('h2', null, 'Audio'));
176
- wrap.appendChild(subPickRow('Preferred language', AUDIO_LANGS, 'lang', store));
177
- wrap.appendChild(subPickRow('Second choice', AUDIO_LANGS2, 'lang2', store));
178
- wrap.appendChild(subPickRow('Switching to it', AUDIO_SWITCH, 'mode', switching));
175
+ wrap.appendChild(U.el('h2', null, U.t('Audio')));
176
+ wrap.appendChild(subPickRow(U.t('Preferred language'), AUDIO_LANGS, 'lang', store));
177
+ wrap.appendChild(subPickRow(U.t('Second choice'), AUDIO_LANGS2, 'lang2', store));
178
+ wrap.appendChild(subPickRow(U.t('Switching to it'), AUDIO_SWITCH, 'mode', switching));
179
179
  wrap.appendChild(U.el('div', 'hint',
180
- 'The track in your preferred language plays on its own; with none, the second choice. The red key switches while watching. ' +
181
- 'Switching to it: Quick starts in your language at once. Safe is for files where Quick names your language but you hear another (the 2017 TV needs 10 seconds).'));
180
+ U.t('The track in your preferred language plays on its own; with none, the second choice. The red key switches while watching. Switching to it: Quick starts in your language at once. Safe is for files where Quick names your language but you hear another (the 2017 TV needs 10 seconds).')));
182
181
  if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') {
183
- wrap.appendChild(U.el('div', 'hint', '⚠ Under TizenBrew none of this applies: StremioK has no TV player there, and only a file’s first audio track plays. The sideloaded app can switch.'));
182
+ wrap.appendChild(U.el('div', 'hint', U.t('⚠ Under TizenBrew none of this applies: StremioK has no TV player there, and only a file’s first audio track plays. The sideloaded app can switch.')));
184
183
  }
185
184
  focusSettings();
186
185
  }
187
186
 
188
187
  // Appearance: background and accent color, applied right away and at every launch.
189
- var ACCENT_NAMES = { indigo: 'Indigo (default)', sky: 'Sky', teal: 'Teal', emerald: 'Emerald',
190
- amber: 'Amber', orange: 'Orange', rose: 'Rose', violet: 'Violet', gray: 'Gray', darkgray: 'Dark gray' };
188
+ var ACCENT_NAMES = { indigo: U.t('Indigo (default)'), sky: U.t('Sky'), teal: U.t('Teal'), emerald: U.t('Emerald'),
189
+ amber: U.t('Amber'), orange: U.t('Orange'), rose: U.t('Rose'), violet: U.t('Violet'), gray: U.t('Gray'), darkgray: U.t('Dark gray') };
191
190
  // darkest to lightest (Dark is the default)
192
- var BACKGROUNDS = [['black', 'Black', null, '#000000'], ['dark', 'Dark', null, '#0e1117'],
193
- ['gray', 'Light Gray', null, '#e4e6ea'], ['white', 'White', null, '#ffffff']];
191
+ var BACKGROUNDS = [['black', U.t('Black'), null, '#000000'], ['dark', U.t('Dark'), null, '#0e1117'],
192
+ ['gray', U.t('Light Gray'), null, '#e4e6ea'], ['white', U.t('White'), null, '#ffffff']];
194
193
  function appearance() {
195
194
  var p = Stremio.getPrefs();
196
195
  var accent = p.accent, bg = p.bg;
@@ -203,14 +202,32 @@
203
202
  // Look: Classic (the stylesheet as it is) or Modern (css/modern.css, its rules only under
204
203
  // body.look-modern). Effects, Modern's blur and motion: Auto turns them on where the TV's
205
204
  // browser can blur behind a panel (Tizen 6 and later), Light keeps them off, Full on.
206
- var LOOKS = [['classic', 'Classic'], ['modern', 'Modern']];
207
- var EFFECTS = [['auto', 'Auto (by the TV)'], ['light', 'Light'], ['full', 'Full']];
205
+ var LOOKS = [['classic', U.t('Classic')], ['modern', U.t('Modern')]];
206
+ var EFFECTS = [['auto', U.t('Auto (by the TV)')], ['light', U.t('Light')], ['full', U.t('Full')]];
208
207
  function applyAppearance() {
209
208
  var a = appearance(), p = Stremio.getPrefs();
210
209
  U.applyTheme(a.accent, a.bg);
211
210
  U.setLook(p.look, p.effects, a.bg === 'gray' || a.bg === 'white');
212
211
  U.setZoom(zoomPct() / 100);
213
212
  }
213
+ // The interface's language (js/i18n.js): Automatic (the TV's own), or one picked; each named in
214
+ // its own language. Another one: StremioK restarts in it (its phrases are read as it starts).
215
+ function languageRow() {
216
+ var langs = typeof I18N !== 'undefined' ? I18N.langs() : [['en', 'English']];
217
+ var name = function (code) { return (langs.filter(function (l) { return l[0] === code; })[0] || langs[0])[1]; };
218
+ var auto = typeof I18N !== 'undefined' ? I18N.auto() : 'en';
219
+ var list = [['auto', U.t('Automatic (the TV’s: {language})', { language: name(auto) })]].concat(langs);
220
+ return subPickRow(U.t('Language'), list, 'lang', {
221
+ get: function () { return { lang: Stremio.getPrefs().lang || 'auto' }; },
222
+ set: function (cfg) {
223
+ Stremio.setPref('lang', cfg.lang);
224
+ var now = typeof I18N !== 'undefined' ? I18N.lang() : 'en', next = cfg.lang === 'auto' ? auto : cfg.lang;
225
+ if (next === now) { return; }
226
+ U.toast(U.t('Restarting in {language}…', { language: name(next) }));
227
+ setTimeout(function () { try { window.location.reload(); } catch (e) {} }, 1200);
228
+ }
229
+ });
230
+ }
214
231
  function settingsAppearance(wrap) {
215
232
  var store = { get: appearance, set: function (cfg) {
216
233
  Stremio.setPref('accent', cfg.accent);
@@ -218,30 +235,31 @@
218
235
  applyAppearance();
219
236
  } };
220
237
  var accents = U.ACCENT_KEYS.map(function (k) { return [k, ACCENT_NAMES[k] || k, null, U.accentColor(k)]; });
221
- wrap.appendChild(U.el('h2', null, 'Appearance'));
238
+ wrap.appendChild(U.el('h2', null, U.t('Appearance')));
239
+ wrap.appendChild(languageRow());
222
240
  var looks = { get: function () { var p = Stremio.getPrefs(); return { look: p.look, effects: p.effects }; },
223
241
  set: function (cfg) { Stremio.setPref('look', cfg.look); Stremio.setPref('effects', cfg.effects); applyAppearance(); markHomeDirty(); } };
224
- wrap.appendChild(subPickRow('Look', LOOKS, 'look', looks));
225
- wrap.appendChild(subPickRow('Effects', EFFECTS, 'effects', looks));
226
- wrap.appendChild(subPickRow('Background', BACKGROUNDS, 'bg', store));
227
- wrap.appendChild(subPickRow('Accent color', accents, 'accent', store));
228
- wrap.appendChild(subPickRow('Zoom', ZOOMS, 'zoom', {
242
+ wrap.appendChild(subPickRow(U.t('Look'), LOOKS, 'look', looks));
243
+ wrap.appendChild(subPickRow(U.t('Effects'), EFFECTS, 'effects', looks));
244
+ wrap.appendChild(subPickRow(U.t('Background'), BACKGROUNDS, 'bg', store));
245
+ wrap.appendChild(subPickRow(U.t('Accent color'), accents, 'accent', store));
246
+ wrap.appendChild(subPickRow(U.t('Zoom'), ZOOMS, 'zoom', {
229
247
  get: function () { return { zoom: '' + zoomPct() }; },
230
248
  set: function (cfg) { Stremio.setPref('zoom', +cfg.zoom); applyAppearance(); }
231
249
  }));
232
- wrap.appendChild(subPickRow('Poster orientation', POSTER_SHAPES, 'posterShape', {
250
+ wrap.appendChild(subPickRow(U.t('Poster orientation'), POSTER_SHAPES, 'posterShape', {
233
251
  get: function () { return { posterShape: Stremio.getPrefs().posterShape }; },
234
252
  set: function (cfg) { Stremio.setPref('posterShape', cfg.posterShape); markHomeDirty(); } // Home redraws on return
235
253
  }));
236
- wrap.appendChild(subPickRow('Ratings on posters', [['off', 'Off'], ['on', 'On']], 'posterRatings', {
254
+ wrap.appendChild(subPickRow(U.t('Ratings on posters'), [['off', U.t('Off')], ['on', U.t('On')]], 'posterRatings', {
237
255
  get: function () { return { posterRatings: Stremio.getPrefs().posterRatings ? 'on' : 'off' }; },
238
256
  set: function (cfg) { Stremio.setPref('posterRatings', cfg.posterRatings === 'on'); markHomeDirty(); }
239
257
  }));
240
- wrap.appendChild(subPickRow('Watched titles', [['show', 'Show'], ['dim', 'Dim'], ['hide', 'Hide']], 'watchedCards', {
258
+ wrap.appendChild(subPickRow(U.t('Watched titles'), [['show', U.t('Show')], ['dim', U.t('Dim')], ['hide', U.t('Hide')]], 'watchedCards', {
241
259
  get: function () { return { watchedCards: Stremio.getPrefs().watchedCards }; },
242
260
  set: function (cfg) { Stremio.setPref('watchedCards', cfg.watchedCards); markHomeDirty(); } // (Home and Discover drawn again with it)
243
261
  }));
244
- wrap.appendChild(subPickRow('Hide spoilers', [['off', 'Off'], ['pictures', 'Pictures'], ['all', 'Pictures and synopses']], 'spoilers', {
262
+ wrap.appendChild(subPickRow(U.t('Hide spoilers'), [['off', U.t('Off')], ['pictures', U.t('Pictures')], ['all', U.t('Pictures and synopses')]], 'spoilers', {
245
263
  get: function () { return { spoilers: Stremio.getPrefs().spoilers }; },
246
264
  set: function (cfg) { Stremio.setPref('spoilers', cfg.spoilers); }
247
265
  }));
@@ -250,19 +268,19 @@
250
268
  // Home: the tab a launch opens on, how many titles a row holds, the TV's home bar, and the
251
269
  // pages ordering the top menu, the Home rows and the Search rows.
252
270
  function settingsHome(wrap) {
253
- wrap.appendChild(U.el('h2', null, 'Home'));
254
- wrap.appendChild(subPickRow('Start on', V.HOME_TABS.map(function (t) { return [t.key, t.label]; }), 'startTab', {
271
+ wrap.appendChild(U.el('h2', null, U.t('Home')));
272
+ wrap.appendChild(subPickRow(U.t('Start on'), V.HOME_TABS.map(function (t) { return [t.key, t.label]; }), 'startTab', {
255
273
  get: function () { return { startTab: Stremio.getPrefs().startTab }; },
256
274
  set: function (cfg) { Stremio.setPref('startTab', cfg.startTab); } // (the next launch: Home stays where it is now)
257
275
  }));
258
- wrap.appendChild(subPickRow('Titles in a Home row', [['30', '30'], ['50', '50'], ['100', '100'], ['200', '200'], ['all', 'Unlimited']], 'rowCards', {
259
- warning: 'Unlimited: Home can take much longer to load, an addon may refuse so many requests, and very long rows can slow an older TV',
276
+ wrap.appendChild(subPickRow(U.t('Titles in a Home row'), [['30', '30'], ['50', '50'], ['100', '100'], ['200', '200'], ['all', U.t('Unlimited')]], 'rowCards', {
277
+ warning: U.t('Unlimited: Home can take much longer to load, an addon may refuse so many requests, and very long rows can slow an older TV'),
260
278
  get: function () { return { rowCards: '' + Stremio.getPrefs().rowCards }; },
261
279
  set: function (cfg) { Stremio.setPref('rowCards', cfg.rowCards === 'all' ? 'all' : +cfg.rowCards); clearCatalogCache(); } // (the rows read again, with more pages or fewer)
262
280
  }));
263
281
  if (typeof HubPreview !== 'undefined' && HubPreview.available()) { // (the sideloaded app: see js/hubpreview.js)
264
282
  // one choice: the tiles' order, or none (sent at once, whatever the wait)
265
- wrap.appendChild(subPickRow('Home bar preview', [['recent', 'Most recent first'], ['watching', 'As in Watching'], ['off', 'Off']], 'homeBar', {
283
+ wrap.appendChild(subPickRow(U.t('Home bar preview'), [['recent', U.t('Most recent first')], ['watching', U.t('As in Watching')], ['off', U.t('Off')]], 'homeBar', {
266
284
  get: function () { var p = Stremio.getPrefs(); return { homeBar: p.homePreview ? p.homePreviewOrder : 'off' }; },
267
285
  set: function (cfg) {
268
286
  Stremio.setPref('homePreview', cfg.homeBar !== 'off');
@@ -271,13 +289,13 @@
271
289
  }
272
290
  }));
273
291
  }
274
- var menu = sectionRow('Menu ›', 'Order the top menu, and show or hide its tabs', 'menuorder');
292
+ var menu = sectionRow(U.t('Menu ›'), U.t('Order the top menu, and show or hide its tabs'), 'menuorder');
275
293
  menu.className += ' cfg-row';
276
294
  wrap.appendChild(menu);
277
- var feeds = sectionRow('Home feeds ›', 'Order the Home rows, and show or hide each one', 'feeds');
295
+ var feeds = sectionRow(U.t('Home feeds ›'), U.t('Order the Home rows, and show or hide each one'), 'feeds');
278
296
  feeds.className += ' cfg-row';
279
297
  wrap.appendChild(feeds);
280
- var sfeeds = sectionRow('Search results ›', 'Order the Search rows (one per catalog that can search), and show or hide each one', 'searchfeeds');
298
+ var sfeeds = sectionRow(U.t('Search results ›'), U.t('Order the Search rows (one per catalog that can search), and show or hide each one'), 'searchfeeds');
281
299
  sfeeds.className += ' cfg-row';
282
300
  wrap.appendChild(sfeeds);
283
301
  var back = _focusChild === 'menuorder' ? menu : _focusChild === 'feeds' ? feeds : _focusChild === 'searchfeeds' ? sfeeds : null;
@@ -291,10 +309,11 @@
291
309
  // with it plays, "Not working" after failed starts that point at it. OK switches one
292
310
  // between Working and Not working (your choice then sticks); sources with a "Not
293
311
  // working" format or a resolution you don't allow go to the bottom of the source list.
294
- var FORMAT_GROUPS = ['Video profile', 'Video', 'HDR', 'Audio', 'File', 'Other'];
295
- var FORMAT_STATUS = { ok: 'Working', bad: 'Not working', unknown: 'Not sure yet' };
312
+ var FORMAT_GROUPS = ['Video profile', 'Video', 'HDR', 'Audio', 'File', 'Other']; // (the groups js/stremio.js names: shown as FORMAT_GROUP_NAMES)
313
+ var FORMAT_GROUP_NAMES = { 'Video profile': U.t('Video profile'), Video: U.t('Video'), HDR: 'HDR', Audio: U.t('Audio'), File: U.t('File'), Other: U.t('Other') };
314
+ var FORMAT_STATUS = { ok: U.t('Working'), bad: U.t('Not working'), unknown: U.t('Not sure yet') };
296
315
  function settingsFormats(wrap, focusKey) {
297
- wrap.appendChild(U.el('h2', null, 'Formats'));
316
+ wrap.appendChild(U.el('h2', null, U.t('Formats')));
298
317
  var pref = null;
299
318
  function row(key, name, sub, cls, onSelect) {
300
319
  var r = U.el('div', 'addon-item focusable cfg-row format-row ' + cls);
@@ -308,35 +327,34 @@
308
327
  }
309
328
  // automatic "Not working" (what's already known stays either way)
310
329
  var auto = Stremio.getPrefs().formatsAuto;
311
- row('auto', 'Mark “Not working” automatically: ' + (auto ? 'On' : 'Off'),
312
- auto ? 'Formats that keep failing to start are marked Not working · OK to turn off'
313
- : 'Failures aren’t recorded; what’s marked stays, and what plays still counts · OK to turn on',
330
+ row('auto', U.t('Mark “Not working” automatically:') + ' ' + (auto ? U.t('On') : U.t('Off')),
331
+ auto ? U.t('Formats that keep failing to start are marked Not working · OK to turn off')
332
+ : U.t('Failures aren’t recorded; what’s marked stays, and what plays still counts · OK to turn on'),
314
333
  'format-' + (auto ? 'ok' : 'unknown'), function () { Stremio.setPref('formatsAuto', !auto); });
315
334
 
316
335
  // allowed resolutions: yours to set, all allowed to begin with
317
- wrap.appendChild(U.el('div', 'formats-group', 'Resolutions'));
336
+ wrap.appendChild(U.el('div', 'formats-group', U.t('Resolutions')));
318
337
  Stremio.resList().forEach(function (r) {
319
- row('res:' + r.res, r.label + ': ' + (r.allowed ? 'Allowed' : 'Not allowed'),
320
- (r.res === 0 ? 'Sources that don’t say · ' : '') + 'OK to ' + (r.allowed ? 'not allow it' : 'allow it'),
338
+ row('res:' + r.res, r.label + ': ' + (r.allowed ? U.t('Allowed') : U.t('Not allowed')),
339
+ (r.res === 0 ? U.t('Sources that don’t say') + ' · ' : '') + (r.allowed ? U.t('OK to not allow it') : U.t('OK to allow it')),
321
340
  'format-' + (r.allowed ? 'ok' : 'bad'), function () { Stremio.setResAllowed(r.res, !r.allowed); });
322
341
  });
323
342
 
324
343
  var list = Stremio.formatList();
325
344
  if (!list.length) {
326
345
  wrap.appendChild(U.el('div', 'hint',
327
- 'No formats yet. Each time you play a source, its formats are added here: its video profile ' +
328
- '(resolution, codec, bit depth, HDR), audio and file type, as working, or not working if it won’t start.'));
346
+ U.t('No formats yet. Each time you play a source, its formats are added here: its video profile (resolution, codec, bit depth, HDR), audio and file type, as working, or not working if it won’t start.')));
329
347
  }
330
348
  FORMAT_GROUPS.forEach(function (g) {
331
349
  var items = list.filter(function (f) { return f.group === g; });
332
350
  if (!items.length) { return; }
333
351
  items.sort(function (a, b) { return (a.order - b.order) || (a.label < b.label ? -1 : 1); }); // profiles: 4K first
334
- wrap.appendChild(U.el('div', 'formats-group', g));
352
+ wrap.appendChild(U.el('div', 'formats-group', FORMAT_GROUP_NAMES[g] || g));
335
353
  items.forEach(function (f) {
336
354
  var sub = [];
337
- if (f.ok) { sub.push('played ' + f.ok + (f.ok > 1 ? ' times' : ' time')); }
338
- if (f.fail) { sub.push('didn’t start ' + f.fail + (f.fail > 1 ? ' times' : ' time')); }
339
- sub.push(f.set ? 'set by you' : 'OK to mark it ' + (f.status === 'ok' ? 'Not working' : 'Working'));
355
+ if (f.ok) { sub.push(U.tn(f.ok, 'played {n} time', 'played {n} times')); }
356
+ if (f.fail) { sub.push(U.tn(f.fail, 'didn’t start {n} time', 'didn’t start {n} times')); }
357
+ sub.push(f.set ? U.t('set by you') : (f.status === 'ok' ? U.t('OK to mark it Not working') : U.t('OK to mark it Working')));
340
358
  row(f.key, f.label + ': ' + FORMAT_STATUS[f.status], sub.join(' · '), 'format-' + f.status, function () {
341
359
  Stremio.setFormat(f.key, f.status === 'ok' ? 'bad' : 'ok');
342
360
  });
@@ -344,16 +362,15 @@
344
362
  });
345
363
  if (list.length) {
346
364
  var reset = U.el('div', 'addon-item focusable');
347
- reset.appendChild(U.el('div', 'a-name', 'Forget all formats'));
348
- reset.appendChild(U.el('div', 'a-url', 'Start learning again from the next source you play (resolutions stay as set)'));
365
+ reset.appendChild(U.el('div', 'a-name', U.t('Forget all formats')));
366
+ reset.appendChild(U.el('div', 'a-url', U.t('Start learning again from the next source you play (resolutions stay as set)')));
349
367
  reset.__onselect = function () {
350
- confirm('Forget what’s known about every format?', 'Forget', function () { Stremio.resetFormats(); redrawFormats(null); });
368
+ confirm(U.t('Forget what’s known about every format?'), U.t('Forget'), function () { Stremio.resetFormats(); redrawFormats(null); });
351
369
  };
352
370
  wrap.appendChild(reset);
353
371
  }
354
372
  wrap.appendChild(U.el('div', 'hint',
355
- 'Sources at a resolution that isn’t allowed, or with a “Not working” format, go to the bottom of the ' +
356
- 'source list; ▶ Play best and Next episode skip them.'));
373
+ U.t('Sources at a resolution that isn’t allowed, or with a “Not working” format, go to the bottom of the source list; ▶ Play best and Next episode skip them.')));
357
374
  if (pref) { Focus.setScope(scr('settings'), pref); } else { focusSettings(); }
358
375
  }
359
376
  function redrawFormats(focusKey) {
@@ -377,30 +394,31 @@
377
394
  // of its sections. [title, description, section] rows; Appearance and Home are pages of their
378
395
  // own (their settings right on them; Home's Menu, Home feeds and Search results open pages).
379
396
  var SETTINGS_GROUPS = {
380
- content: { title: 'Content', rows: [
381
- ['Addons', 'Catalog, stream & subtitle addons', 'addons'],
382
- ['Streaming server', 'Stremio’s streaming server or TorrServer on your network: torrents, and videos the TV can’t play', 'server'],
383
- ['Integrations', 'API keys (OMDb, TMDB, MDBList), where-to-watch country', 'integrations'],
384
- ['IPTV', 'Manage M3U playlist URLs', 'iptv'],
385
- ['YouTube', 'Your YouTube channels, playlists and searches; YouTube in Search', 'youtube'],
386
- ['Streaming apps', 'Your apps (Prime Video, Netflix, …) that open a title\'s "where to watch" sources', 'appshortcuts'],
387
- ['USB drive', 'The Local tab: what\'s on your drive, matched to titles; hidden files', 'usb'],
388
- ['Network folders', 'Folders a NAS or computer shares over WebDAV, in the Local tab: their videos as sources', 'netfolders'],
389
- ['Media servers', 'Your Jellyfin or Emby server: its libraries on Home, its files as sources', 'mediaservers'],
390
- ['Import configuration file', 'Import addons, API keys & IPTV playlists', 'import'],
391
- ['Export configuration', 'Your addons, playlists, API keys and settings, to your phone', 'export']] },
392
- playback: { title: 'Playback', rows: [
393
- ['Audio', 'Preferred and second-choice audio language', 'audio'],
394
- ['Subtitles', 'Default language, size, color, background, position, font', 'subtitles'],
395
- ['Skipping', 'Intros, recaps and previews, and the next episode at the credits: ask, or on their own after a countdown', 'skipping'],
396
- ['Seeking & buffering', 'How far ◀ ▶ jump; a bigger buffer for slow connections; reconnecting live channels', 'seeking'],
397
- ['Source ranking', 'How sources are ordered (played before, resolution, release type…), and your addons: their order, on or off', 'ranking'],
398
- ['Formats', 'Allowed resolutions, and what plays on this TV, learned as you watch', 'formats'],
399
- ['Private viewing', 'Play without anything recorded: no progress, Continue Watching, watched marks or Trakt', 'private']] },
400
- diagnostics: { title: 'Diagnostics', rows: [
401
- ['Logs', 'Recent problems (failed downloads, playback and script errors), secrets masked; how long launches took', 'logs'],
402
- ['Storage', 'What StremioK keeps on the TV; the TV’s database: on or off, tidying it up; clearing saved copies', 'storage'],
403
- ['Installed apps', 'The TV’s apps with their IDs; OK on one opens it', 'tvapps']] }
397
+ content: { title: U.t('Content'), rows: [
398
+ [U.t('Addons'), U.t('Catalog, stream & subtitle addons'), 'addons'],
399
+ [U.t('Streaming server'), U.t('Stremio’s streaming server or TorrServer on your network: torrents, and videos the TV can’t play'), 'server'],
400
+ [U.t('Integrations'), U.t('API keys (OMDb, TMDB, MDBList), where-to-watch country'), 'integrations'],
401
+ ['IPTV', U.t('Manage M3U playlist URLs'), 'iptv'],
402
+ ['YouTube', U.t('Your YouTube channels, playlists and searches; YouTube in Search'), 'youtube'],
403
+ [U.t('Streaming apps'), U.t('Your apps (Prime Video, Netflix, …) that open a title\'s "where to watch" sources'), 'appshortcuts'],
404
+ [U.t('USB drive'), U.t('The Local tab: what\'s on your drive, matched to titles; hidden files'), 'usb'],
405
+ [U.t('Network folders'), U.t('Folders a NAS or computer shares over WebDAV, in the Local tab: their videos as sources'), 'netfolders'],
406
+ [U.t('Media servers'), U.t('Your Jellyfin or Emby server: its libraries on Home, its files as sources'), 'mediaservers'],
407
+ [U.t('Nuvio plugins'), U.t('Programs written for the Nuvio apps that look for sources: someone else’s code, run on your TV'), 'plugins'],
408
+ [U.t('Import configuration file'), U.t('Import addons, API keys & IPTV playlists'), 'import'],
409
+ [U.t('Export configuration'), U.t('Your addons, playlists, API keys and settings, to your phone'), 'export']] },
410
+ playback: { title: U.t('Playback'), rows: [
411
+ [U.t('Audio'), U.t('Preferred and second-choice audio language'), 'audio'],
412
+ [U.t('Subtitles'), U.t('Default language, size, color, background, position, font'), 'subtitles'],
413
+ [U.t('Skipping'), U.t('Intros, recaps and previews, and the next episode at the credits: ask, or on their own after a countdown'), 'skipping'],
414
+ [U.t('Seeking & buffering'), U.t('How far ◀ ▶ jump; a bigger buffer for slow connections; reconnecting live channels'), 'seeking'],
415
+ [U.t('Source ranking'), U.t('How sources are ordered (played before, resolution, release type…), and your addons: their order, on or off'), 'ranking'],
416
+ [U.t('Formats'), U.t('Allowed resolutions, and what plays on this TV, learned as you watch'), 'formats'],
417
+ [U.t('Private viewing'), U.t('Play without anything recorded: no progress, Continue Watching, watched marks or Trakt'), 'private']] },
418
+ diagnostics: { title: U.t('Diagnostics'), rows: [
419
+ [U.t('Logs'), U.t('Recent problems (failed downloads, playback and script errors), secrets masked; how long launches took'), 'logs'],
420
+ [U.t('Storage'), U.t('What StremioK keeps on the TV; the TV’s database: on or off, tidying it up; clearing saved copies'), 'storage'],
421
+ [U.t('Installed apps'), U.t('The TV’s apps with their IDs; OK on one opens it'), 'tvapps']] }
404
422
  };
405
423
 
406
424
  // Return true if BACK stepped a settings section back to the menu.
@@ -450,6 +468,7 @@
450
468
  else if (_settingsSection === 'usb') { settingsUsb(wrap); }
451
469
  else if (_settingsSection === 'netfolders') { settingsNetFolders(wrap); }
452
470
  else if (_settingsSection === 'mediaservers') { settingsMediaServers(wrap); }
471
+ else if (_settingsSection === 'plugins') { settingsPlugins(wrap); }
453
472
  else if (_settingsSection === 'private') { settingsPrivate(wrap); }
454
473
  else if (_settingsSection === 'appshortcuts') { settingsAppShortcuts(wrap); }
455
474
  else if (_settingsSection === 'import') { settingsImport(wrap); }
@@ -487,21 +506,21 @@
487
506
  IPTV.onProgress(function (n) {
488
507
  var el = _iptvStatusEl;
489
508
  if (el && document.documentElement.contains(el) && /^(Checking|Reading)/.test(el.textContent)) {
490
- el.textContent = 'Reading playlists… ' + ('' + n).replace(/\B(?=(\d{3})+(?!\d))/g, ',') + ' channels';
509
+ el.textContent = U.t('Reading playlists… {n} channels', { n: ('' + n).replace(/\B(?=(\d{3})+(?!\d))/g, ',') });
491
510
  }
492
511
  });
493
512
  }
494
513
 
495
514
  // TizenBrew serves every module from the same address, so they all share one storage:
496
515
  // another module you install can read what StremioK saves (see the README).
497
- var TIZENBREW_NOTE = '⚠ Installed with TizenBrew: other TizenBrew modules can read what StremioK saves, including API keys and addon links with their tokens. Only install modules you trust; the sideloaded app keeps its data to itself.';
516
+ var TIZENBREW_NOTE = U.t('⚠ Installed with TizenBrew: other TizenBrew modules can read what StremioK saves, including API keys and addon links with their tokens. Only install modules you trust; the sideloaded app keeps its data to itself.');
498
517
  function settingsMenu(wrap) {
499
- wrap.appendChild(U.el('h2', null, 'Settings'));
500
- wrap.appendChild(sectionRow('Content', 'Addons, API keys, IPTV playlists, media servers, streaming apps, importing a configuration file', 'content'));
501
- wrap.appendChild(sectionRow('Playback', 'Audio and subtitles, source ranking, feed sources, formats', 'playback'));
502
- wrap.appendChild(sectionRow('Appearance', 'Look, background, accent color, zoom, posters, spoilers', 'appearance'));
503
- wrap.appendChild(sectionRow('Home', 'The tab it opens on, the top menu, Home feeds, Search results', 'home'));
504
- wrap.appendChild(sectionRow('Diagnostics', 'Logs, storage, installed apps; how StremioK was installed', 'diagnostics'));
518
+ wrap.appendChild(U.el('h2', null, U.t('Settings')));
519
+ wrap.appendChild(sectionRow(U.t('Content'), U.t('Addons, API keys, IPTV playlists, media servers, streaming apps, importing a configuration file'), 'content'));
520
+ wrap.appendChild(sectionRow(U.t('Playback'), U.t('Audio and subtitles, source ranking, feed sources, formats'), 'playback'));
521
+ wrap.appendChild(sectionRow(U.t('Appearance'), U.t('Look, background, accent color, zoom, posters, spoilers'), 'appearance'));
522
+ wrap.appendChild(sectionRow(U.t('Home'), U.t('The tab it opens on, the top menu, Home feeds, Search results'), 'home'));
523
+ wrap.appendChild(sectionRow(U.t('Diagnostics'), U.t('Logs, storage, installed apps; how StremioK was installed'), 'diagnostics'));
505
524
  if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
506
525
  focusBack(wrap);
507
526
  }
@@ -516,18 +535,21 @@
516
535
  function settingsGroup(wrap, key) {
517
536
  var g = SETTINGS_GROUPS[key];
518
537
  wrap.appendChild(U.el('h2', null, g.title));
519
- g.rows.forEach(function (row) { wrap.appendChild(sectionRow(row[0], row[1], row[2])); });
538
+ g.rows.forEach(function (row) {
539
+ if (row[2] === 'plugins' && !(typeof Plugins !== 'undefined' && Plugins.supported())) { return; } // (a TV that can't run them: not offered)
540
+ wrap.appendChild(sectionRow(row[0], row[1], row[2]));
541
+ });
520
542
  if (key === 'diagnostics') {
521
543
  if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
522
544
  // How StremioK was installed, and whether its YouTube service (channels, trailers) answers
523
545
  if (typeof YTPlay !== 'undefined' && YTPlay.installLabel) {
524
546
  // (and which video player plays: the TV's own, or the page's, as under TizenBrew)
525
- var player = ' · Video player: ' + ((window.webapis && webapis.avplay) ? 'the TV’s own' : YTPlay.installMode() === 'tizenbrew' ? 'the page’s (TizenBrew has no TV player: one audio track)' : 'the browser’s');
526
- var about = U.el('div', 'hint settings-about', 'Installed as: ' + YTPlay.installLabel() + player + ' · YouTube service: checking…');
547
+ var player = ' · ' + U.t('Video player: {player}', { player: (window.webapis && webapis.avplay) ? U.t('the TV’s own') : YTPlay.installMode() === 'tizenbrew' ? U.t('the page’s (TizenBrew has no TV player: one audio track)') : U.t('the browser’s') });
548
+ var about = U.el('div', 'hint settings-about', U.t('Installed as: {how}', { how: YTPlay.installLabel() }) + player + ' · ' + U.t('YouTube service: checking…'));
527
549
  wrap.appendChild(about);
528
550
  YTPlay.isRunning().then(function (up) {
529
- about.textContent = 'Installed as: ' + YTPlay.installLabel() + player + ' · YouTube service: ' +
530
- (up ? 'running' : YTPlay.installMode() === 'wgt' ? 'starts when needed' : 'not running');
551
+ about.textContent = U.t('Installed as: {how}', { how: YTPlay.installLabel() }) + player + ' · ' +
552
+ (up ? U.t('YouTube service: running') : YTPlay.installMode() === 'wgt' ? U.t('YouTube service: starts when needed') : U.t('YouTube service: not running'));
531
553
  });
532
554
  }
533
555
  }
@@ -537,20 +559,20 @@
537
559
  var _addonFocus = null; // { url, ctl }: the ▲ / ▼ just pressed, focused again once redrawn
538
560
  // What an addon gives StremioK, from its manifest: catalogs (how many), search, details,
539
561
  // sources, subtitles; and the kinds of titles.
540
- var TYPE_NAMES = { movie: 'Movies', series: 'Series', anime: 'Anime', tv: 'TV', channel: 'Channels', events: 'Events', sport: 'Sports', radio: 'Radio', other: 'Other' };
562
+ var TYPE_NAMES = { movie: U.t('Movies'), series: U.t('Series'), anime: U.t('Anime'), tv: U.t('TV'), channel: U.t('Channels'), events: U.t('Events'), sport: U.t('Sports'), radio: U.t('Radio'), other: U.t('Other') };
541
563
  function addonGives(m) {
542
564
  var res = (m.resources || []).map(function (r) { return typeof r === 'string' ? r : r && r.name; });
543
565
  var cats = m.catalogs || [], bits = [], types = [];
544
- if (cats.length) { bits.push('Catalogs (' + cats.length + ')'); }
545
- if (cats.some(function (c) { return (c.extra || []).some(function (e) { return e && e.name === 'search'; }) || (c.extraSupported || []).indexOf('search') !== -1; })) { bits.push('Search'); }
546
- if (res.indexOf('meta') !== -1) { bits.push('Details'); }
547
- if (res.indexOf('stream') !== -1) { bits.push('Sources'); }
548
- if (res.indexOf('subtitles') !== -1) { bits.push('Subtitles'); }
566
+ if (cats.length) { bits.push(U.t('Catalogs ({n})', { n: cats.length })); }
567
+ if (cats.some(function (c) { return (c.extra || []).some(function (e) { return e && e.name === 'search'; }) || (c.extraSupported || []).indexOf('search') !== -1; })) { bits.push(U.t('Search')); }
568
+ if (res.indexOf('meta') !== -1) { bits.push(U.t('Details')); }
569
+ if (res.indexOf('stream') !== -1) { bits.push(U.t('Sources')); }
570
+ if (res.indexOf('subtitles') !== -1) { bits.push(U.t('Subtitles')); }
549
571
  (m.types || []).forEach(function (t) {
550
572
  var n = TYPE_NAMES[t] || (('' + t).charAt(0).toUpperCase() + ('' + t).slice(1));
551
573
  if (types.indexOf(n) === -1) { types.push(n); }
552
574
  });
553
- return 'Gives: ' + (bits.length ? bits.join(' · ') : 'nothing StremioK uses') + (types.length ? ' · ' + types.slice(0, 8).join(', ') : '');
575
+ return U.t('Gives: {what}', { what: bits.length ? bits.join(' · ') : U.t('nothing StremioK uses') }) + (types.length ? ' · ' + types.slice(0, 8).join(', ') : '');
554
576
  }
555
577
  // An addon's logo tile: its initial (the first character, an emoji whole; "?" for one that
556
578
  // didn't load; drawn by the CSS from data-initial, so the row's text is still its name),
@@ -571,23 +593,23 @@
571
593
  return tile;
572
594
  }
573
595
  function settingsAddons(wrap) {
574
- wrap.appendChild(U.el('h2', null, 'Addons'));
596
+ wrap.appendChild(U.el('h2', null, U.t('Addons')));
575
597
  // Home-network links from addons on the internet (see Stremio.blocksLocal)
576
598
  var allow = !!Stremio.getPrefs().allowLocal;
577
599
  var lan = U.el('div', 'addon-item focusable cfg-row');
578
- lan.appendChild(U.el('div', 'a-name', 'Local-network links from internet addons: ' + (allow ? 'Allowed' : 'Blocked')));
579
- lan.appendChild(U.el('div', 'a-url', (allow ? 'An addon on the internet may send links into your home network (router, NAS, cameras…)'
580
- : 'Links an internet addon points into your home network are left out (your own network’s addons and playlists aren’t affected)') +
581
- ' · OK to ' + (allow ? 'block' : 'allow')));
600
+ lan.appendChild(U.el('div', 'a-name', U.t('Local-network links from internet addons:') + ' ' + (allow ? U.t('Allowed') : U.t('Blocked'))));
601
+ lan.appendChild(U.el('div', 'a-url', (allow ? U.t('An addon on the internet may send links into your home network (router, NAS, cameras…)')
602
+ : U.t('Links an internet addon points into your home network are left out (your own network’s addons and playlists aren’t affected)')) +
603
+ ' · ' + (allow ? U.t('OK to block') : U.t('OK to allow'))));
582
604
  lan.__onselect = function () { Stremio.setAllowLocal(!allow); clearCatalogCache(); renderSettings(); };
583
605
  wrap.appendChild(lan);
584
- wrap.appendChild(subPickRow('Wait for addons', ADDON_WAITS, 'addonWait', {
606
+ wrap.appendChild(subPickRow(U.t('Wait for addons'), ADDON_WAITS, 'addonWait', {
585
607
  get: function () { return { addonWait: '' + Stremio.getPrefs().addonWait }; },
586
608
  set: function (cfg) { Stremio.setPref('addonWait', +cfg.addonWait || 0); }
587
609
  }));
588
610
  Stremio.loadAddons().then(function (addons) {
589
611
  var urls = Stremio.getAddonUrls(), want = null;
590
- if (urls.length > 1) { wrap.appendChild(U.el('div', 'hint', '▲ / ▼ set the order: a title\'s details come from the highest addon that has them (its page says which), and the higher addon comes first where several answer.')); }
612
+ if (urls.length > 1) { wrap.appendChild(U.el('div', 'hint', U.t('▲ / ▼ set the order: a title\'s details come from the highest addon that has them (its page says which), and the higher addon comes first where several answer.'))); }
591
613
  urls.forEach(function (url) {
592
614
  var off = !!(Stremio.isAddonOff && Stremio.isAddonOff(url)), kept = off && Stremio.savedManifest ? Stremio.savedManifest(url) : null;
593
615
  var loaded = addons.find(function (a) { return a.url === url; }) || (kept ? { url: url, manifest: kept } : null); // (one that's off: its saved manifest)
@@ -596,17 +618,17 @@
596
618
  var item = U.el('div', 'addon-item focusable playlist-item has-logo');
597
619
  item.appendChild(addonTile(loaded && loaded.manifest, url));
598
620
  var why = !loaded && Stremio.manifestProblem ? Stremio.manifestProblem(url) : ''; // "too large (over 2 MB)", "not an addon manifest"…
599
- var nm = U.el('div', 'a-name', (loaded ? (loaded.manifest.name || 'Addon') : off ? 'Addon' : '(failed to load' + (why ? ': ' + why : '') + ')') + (off ? ' (off)' : ''));
621
+ var nm = U.el('div', 'a-name', (loaded ? (loaded.manifest.name || U.t('Addon')) : off ? U.t('Addon') : (why ? U.t('(failed to load: {why})', { why: why }) : U.t('(failed to load)'))) + (off ? ' ' + U.t('(off)') : ''));
600
622
  var origin = Stremio.addonOrigin ? Stremio.addonOrigin(url) : '', ob = originBadge(origin);
601
623
  if (ob) { nm.appendChild(ob); }
602
624
  item.appendChild(nm);
603
625
  item.appendChild(U.el('div', 'a-url', U.redactUrl(url) + (origin ? ' · ' + ORIGIN_BADGE[origin][2] : ''))); // (personal tokens masked)
604
626
  if (loaded) { item.appendChild(U.el('div', 'a-url addon-gives', addonGives(loaded.manifest))); }
605
627
  var said = !loaded && Stremio.manifestDetail ? Stremio.manifestDetail(url) : ''; // the addon's own error message
606
- if (said) { item.appendChild(U.el('div', 'a-url addon-said', 'The addon says: ' + said)); }
628
+ if (said) { item.appendChild(U.el('div', 'a-url addon-said', U.t('The addon says: {said}', { said: said }))); }
607
629
  var note = Stremio.thirdPartyNote ? Stremio.thirdPartyNote(loaded ? loaded.manifest.id : url) : ''; // (WatchHub)
608
630
  if (note) { item.appendChild(U.el('div', 'a-url addon-said', '⚠ ' + note)); }
609
- var name = loaded ? (loaded.manifest.name || 'Addon') : 'this addon';
631
+ var name = loaded ? (loaded.manifest.name || U.t('Addon')) : U.t('this addon');
610
632
  item.__onselect = function () {
611
633
  addonActions(name, url);
612
634
  };
@@ -617,18 +639,18 @@
617
639
  });
618
640
 
619
641
  var addRow = U.el('div', 'addon-item focusable add-row');
620
- addRow.appendChild(U.el('div', 'a-name', '+ Add addon'));
621
- addRow.appendChild(U.el('div', 'a-url', 'Enter a Stremio addon manifest URL on its own page'));
642
+ addRow.appendChild(U.el('div', 'a-name', U.t('+ Add addon')));
643
+ addRow.appendChild(U.el('div', 'a-url', U.t('Enter a Stremio addon manifest URL on its own page')));
622
644
  addRow.__onselect = function () {
623
645
  App.openEntry({
624
- title: 'Add addon', phone: 'addon',
625
- hint: 'Type a Stremio addon manifest URL. Nothing is saved until you Confirm.',
646
+ title: U.t('Add addon'), phone: 'addon',
647
+ hint: U.t('Type a Stremio addon manifest URL. Nothing is saved until you Confirm.'),
626
648
  value: 'https://', placeholder: 'https://addon.example/manifest.json',
627
649
  validate: function (v) { return U.urlProblem(v) || null; }, // (U.parseUrl: http(s), a real host, no user:password@)
628
650
  onConfirm: function (v) {
629
651
  var added = Stremio.addAddon(v), note = Stremio.thirdPartyNote(added || v);
630
652
  refreshAddonRows(added || null);
631
- U.toast(note ? 'Addon added. ' + note : 'Addon added', note ? 8000 : undefined);
653
+ U.toast(note ? U.t('Addon added. {note}', { note: note }) : U.t('Addon added'), note ? 8000 : undefined);
632
654
  App.back(); renderSettings();
633
655
  }
634
656
  });
@@ -636,11 +658,11 @@
636
658
  wrap.appendChild(addRow);
637
659
  if (typeof StremioAccount !== 'undefined') {
638
660
  var acct = U.el('div', 'addon-item focusable add-row');
639
- var an = U.el('div', 'a-name', 'Import addons from your Stremio account');
661
+ var an = U.el('div', 'a-name', U.t('Import addons from your Stremio account'));
640
662
  an.appendChild(originBadge('stremio'));
641
663
  acct.appendChild(an);
642
- acct.appendChild(U.el('div', 'a-url', typeof StremioSync !== 'undefined' && StremioSync.isConnected() ? 'From the account connected in Integrations: tick the addons to add'
643
- : 'Sign in on your phone with a QR code, then tick the addons to add (StremioK signs out straight after)'));
664
+ acct.appendChild(U.el('div', 'a-url', typeof StremioSync !== 'undefined' && StremioSync.isConnected() ? U.t('From the account connected in Integrations: tick the addons to add')
665
+ : U.t('Sign in on your phone with a QR code, then tick the addons to add (StremioK signs out straight after)')));
644
666
  acct.__onselect = stremioImport;
645
667
  wrap.appendChild(acct);
646
668
  }
@@ -651,15 +673,15 @@
651
673
  var aname = U.el('div', 'a-name', 'AIOManager' + (am.base ? ' · ' + shortHost(am.base) : ''));
652
674
  aname.appendChild(originBadge('aiomanager'));
653
675
  aio.appendChild(aname);
654
- aio.appendChild(U.el('div', 'a-url', am.base && am.key ? (am.at ? 'Last synced ' + U.dayLabel(am.at) + ' · ' : '') + 'OK for ↻ Sync: refresh, add new, remove the ones gone from it'
655
- : 'Your AIOManager’s address and API key, then ↻ Sync your addons with it'));
676
+ aio.appendChild(U.el('div', 'a-url', am.base && am.key ? (am.at ? U.t('Last synced {when}', { when: U.dayLabel(am.at) }) + ' · ' : '') + U.t('OK for ↻ Sync: refresh, add new, remove the ones gone from it')
677
+ : U.t('Your AIOManager’s address and API key, then ↻ Sync your addons with it')));
656
678
  aio.__onselect = function () { _settingsSection = 'aiomanager'; renderSettings(); };
657
679
  wrap.appendChild(aio);
658
680
  if (_focusChild === 'aiomanager') { want = aio; _focusChild = null; }
659
681
  }
660
682
 
661
683
  wrap.appendChild(U.el('div', 'hint',
662
- 'StremioK hosts no content — add Stremio addon manifest URLs for catalogs, streams and subtitles.'));
684
+ U.t('StremioK hosts no content — add Stremio addon manifest URLs for catalogs, streams and subtitles.')));
663
685
  _addonFocus = null;
664
686
  if (want) { Focus.setScope(scr('settings'), want); } else { focusSettings(); }
665
687
  });
@@ -674,36 +696,36 @@
674
696
  U.spinner(true);
675
697
  StremioAccount.addons(StremioSync.authKey()).then(function (list) { U.spinner(false); importPick(list); }, function (e) {
676
698
  U.spinner(false);
677
- U.toast('Couldn’t import: ' + ((e && e.message) || 'unknown'), 5000);
699
+ U.toast(U.t('Couldn’t import: {why}', { why: (e && e.message) || U.t('unknown') }), 5000);
678
700
  });
679
701
  return;
680
702
  }
681
- stremioSignIn('Import addons from your Stremio account', function (key, body, gone, fail) {
703
+ stremioSignIn(U.t('Import addons from your Stremio account'), function (key, body, gone, fail) {
682
704
  U.clear(body);
683
- body.appendChild(U.el('div', 'tc-line', 'Reading your addons…'));
705
+ body.appendChild(U.el('div', 'tc-line', U.t('Reading your addons…')));
684
706
  var read = StremioAccount.addons(key);
685
707
  read.then(function () { StremioAccount.signOut(key); }, function () { StremioAccount.signOut(key); }); // (signed out as soon as it's read)
686
708
  return read.then(function (list) {
687
709
  if (gone()) { return; }
688
- if (!list.length) { fail(new Error('your account has no addons StremioK can use')); return; }
710
+ if (!list.length) { fail(new Error(U.t('your account has no addons StremioK can use'))); return; }
689
711
  closeModal();
690
712
  importPick(list);
691
713
  });
692
714
  });
693
715
  }
694
716
  function importPick(list) {
695
- if (!list.length) { U.toast('Your Stremio account has no addons StremioK can use', 5000); return; }
717
+ if (!list.length) { U.toast(U.t('Your Stremio account has no addons StremioK can use'), 5000); return; }
696
718
  var mine = Stremio.getAddonUrls();
697
719
  var items = list.map(function (x, i) {
698
720
  var have = mine.indexOf(x.url) !== -1 || mine.indexOf(Stremio.normalizeUrl ? Stremio.normalizeUrl(x.url) : x.url) !== -1;
699
721
  return { key: '' + i, label: x.name + ' · ' + shortHost(x.url), have: have };
700
722
  });
701
- pickMany('Your Stremio addons: tick the ones to add', items, { button: function (n) { return 'Import ' + n + ' addon' + (n === 1 ? '' : 's'); } }, function (keys) {
723
+ pickMany(U.t('Your Stremio addons: tick the ones to add'), items, { button: function (n) { return U.tn(n, 'Import {n} addon', 'Import {n} addons'); } }, function (keys) {
702
724
  var n = 0, last = null;
703
725
  keys.forEach(function (k) { var added = Stremio.addAddon(list[+k].url); if (added) { n++; last = added; if (Stremio.setAddonOrigin) { Stremio.setAddonOrigin(added, 'stremio'); } } });
704
726
  clearCatalogCache();
705
727
  refreshAddonRows(last);
706
- U.toast('Imported ' + n + ' addon' + (n === 1 ? '' : 's'), 3000);
728
+ U.toast(U.tn(n, 'Imported {n} addon', 'Imported {n} addons'), 3000);
707
729
  renderSettings();
708
730
  });
709
731
  }
@@ -716,9 +738,9 @@
716
738
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
717
739
  box.appendChild(U.el('div', 'modal-msg', title));
718
740
  var body = U.el('div', 'trakt-connect');
719
- body.appendChild(U.el('div', 'tc-line', 'Asking Stremio for a code…'));
741
+ body.appendChild(U.el('div', 'tc-line', U.t('Asking Stremio for a code…')));
720
742
  box.appendChild(body);
721
- var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
743
+ var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
722
744
  cancel.__onselect = function () { closeModal(); };
723
745
  row.appendChild(cancel);
724
746
  box.appendChild(row);
@@ -738,19 +760,19 @@
738
760
  U.clear(body);
739
761
  var qrSpot = U.el('div', 'tc-qr-spot');
740
762
  body.appendChild(qrSpot);
741
- var goTo = body.appendChild(U.el('div', 'tc-line', 'On your phone or computer, go to:'));
763
+ var goTo = body.appendChild(U.el('div', 'tc-line', U.t('On your phone or computer, go to:')));
742
764
  (typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
743
765
  var qr = U.qrCanvas(c.link, 8);
744
766
  if (!qr || !qrSpot.parentNode) { return; }
745
767
  qr.className = 'tc-qr';
746
- qrSpot.appendChild(U.el('div', 'tc-line', 'Scan with your phone:'));
768
+ qrSpot.appendChild(U.el('div', 'tc-line', U.t('Scan with your phone:')));
747
769
  qrSpot.appendChild(qr);
748
- goTo.textContent = 'or go to';
770
+ goTo.textContent = U.t('or go to');
749
771
  }, function () {});
750
772
  body.appendChild(U.el('div', 'tc-url', c.link));
751
- body.appendChild(U.el('div', 'tc-line', 'Code:'));
773
+ body.appendChild(U.el('div', 'tc-line', U.t('Code:')));
752
774
  body.appendChild(U.el('div', 'tc-code', c.code));
753
- body.appendChild(U.el('div', 'tc-line small', 'Sign in to Stremio there and approve. Waiting…'));
775
+ body.appendChild(U.el('div', 'tc-line small', U.t('Sign in to Stremio there and approve. Waiting…')));
754
776
  return StremioAccount.wait(c.code, stopped).then(function (key) {
755
777
  if (gone) { StremioAccount.signOut(key); return; }
756
778
  return signedIn(key, body, stopped, fail);
@@ -766,7 +788,7 @@
766
788
  // refuses is forgotten (the address stays) and asked for again.
767
789
  var AIOM_KEY = 'stremiok.aiomanager';
768
790
  // Where an addon came from (Stremio.addonOrigin): a letter badge, and the words for it.
769
- var ORIGIN_BADGE = { stremio: ['S', 'src-s', 'From Stremio'], aiomanager: ['A', 'src-a', 'From AIOManager'], config: ['C', 'src-c', 'From a configuration file'] };
791
+ var ORIGIN_BADGE = { stremio: ['S', 'src-s', U.t('From Stremio')], aiomanager: ['A', 'src-a', U.t('From AIOManager')], config: ['C', 'src-c', U.t('From a configuration file')] };
770
792
  function originBadge(kind) { var b = ORIGIN_BADGE[kind]; return b ? U.el('span', 'src-badge ' + b[1], b[0]) : null; }
771
793
  function aiomSaved() {
772
794
  var x = U.store.get(AIOM_KEY, {}) || {};
@@ -786,8 +808,8 @@
786
808
  ['https://aiomanager.fortheweak.cloud', 'Yeb’s'], ['https://aiomanager.stremio.ru', 'Kuu’s']];
787
809
  function aiomAskAddress(then) {
788
810
  var am = aiomSaved();
789
- pickList('Your AIOManager', AIOM_PUBLIC.map(function (x) { return [x[0], x[1] + ' · ' + shortHost(x[0])]; })
790
- .concat([['other', 'Another address… (your own: type it, or ▣ from your phone)']]), am.base || null, function (k) {
811
+ pickList(U.t('Your AIOManager'), AIOM_PUBLIC.map(function (x) { return [x[0], x[1] + ' · ' + shortHost(x[0])]; })
812
+ .concat([['other', U.t('Another address… (your own: type it, or ▣ from your phone)')]]), am.base || null, function (k) {
791
813
  if (k === 'other') { aiomTypeAddress(then); return; }
792
814
  aiomSetBase(k);
793
815
  if (then) { then(); } else { renderSettings(); }
@@ -801,8 +823,8 @@
801
823
  function aiomTypeAddress(then) {
802
824
  var am = aiomSaved();
803
825
  App.openEntry({
804
- title: 'Your AIOManager’s address', phone: 'aiom',
805
- hint: 'The address you open AIOManager at (your instance), e.g. https://aiomanager.example.com. Kept on the TV.',
826
+ title: U.t('Your AIOManager’s address'), phone: 'aiom',
827
+ hint: U.t('The address you open AIOManager at (your instance), e.g. https://aiomanager.example.com. Kept on the TV.'),
806
828
  value: am.base || 'https://', placeholder: 'https://aiomanager.example.com',
807
829
  validate: function (v) { return U.urlProblem(v) || null; },
808
830
  onConfirm: function (v) { aiomSetBase(('' + v).trim().replace(/\/+$/, '')); App.back(); if (then) { then(); } else { renderSettings(); } }
@@ -810,15 +832,15 @@
810
832
  }
811
833
  function aiomAskKey(then) {
812
834
  App.openEntry({
813
- title: 'Your AIOManager API key', phone: 'aiomkey', secret: true,
814
- hint: 'Your account’s API key, from AIOManager (the account’s settings). Kept on the TV like your other API keys; StremioK only reads your addons with it.',
815
- value: '', placeholder: 'API key',
816
- validate: function (v) { return /^[\x21-\x7e]{6,300}$/.test(('' + v).trim()) ? null : 'That doesn’t look like an API key'; },
835
+ title: U.t('Your AIOManager API key'), phone: 'aiomkey', secret: true,
836
+ hint: U.t('Your account’s API key, from AIOManager (the account’s settings). Kept on the TV like your other API keys; StremioK only reads your addons with it.'),
837
+ value: '', placeholder: U.t('API key'),
838
+ validate: function (v) { return /^[\x21-\x7e]{6,300}$/.test(('' + v).trim()) ? null : U.t('That doesn’t look like an API key'); },
817
839
  onConfirm: function (v) { aiomSave({ key: ('' + v).trim() }); App.back(); if (then) { then(); } else { renderSettings(); } }
818
840
  });
819
841
  }
820
842
  function settingsAiom(wrap) {
821
- wrap.appendChild(U.el('h2', null, 'Addons › AIOManager'));
843
+ wrap.appendChild(U.el('h2', null, U.t('Addons › AIOManager')));
822
844
  wrap.appendChild(U.el('div', 'hint', 'Your addons from AIOManager: its address and your account’s API key, then ↻ Sync. Each change is yours to tick; nothing is sent back to AIOManager.'));
823
845
  var am = aiomSaved();
824
846
  function row(name, sub, fn) {
@@ -829,14 +851,14 @@
829
851
  wrap.appendChild(r);
830
852
  return r;
831
853
  }
832
- row('Address: ' + (am.base || 'Not set'), 'Your AIOManager instance · OK to ' + (am.base ? 'change' : 'set'), function () { aiomAskAddress(); });
833
- row('API key: ' + (am.key ? '••••' + am.key.slice(-4) : 'Not set'), 'Your account’s, from AIOManager · OK to ' + (am.key ? 'change' : 'set'), function () { aiomAskKey(); });
854
+ row(U.t('Address:') + ' ' + (am.base || U.t('Not set')), U.t('Your AIOManager instance') + ' · ' + (am.base ? U.t('OK to change') : U.t('OK to set')), function () { aiomAskAddress(); });
855
+ row(U.t('API key:') + ' ' + (am.key ? '••••' + am.key.slice(-4) : U.t('Not set')), U.t('Your account’s, from AIOManager') + ' · ' + (am.key ? U.t('OK to change') : U.t('OK to set')), function () { aiomAskKey(); });
834
856
  if (am.base && am.key) {
835
- row('↻ Sync with AIOManager', (am.at ? 'Last synced ' + U.dayLabel(am.at) + (am.count ? ' · ' + am.count + ' addon' + (am.count === 1 ? '' : 's') + ' in AIOManager' : '') : 'Not synced yet') +
836
- ' · refresh, add new, remove the ones gone from it', aiomSync);
857
+ row(U.t('↻ Sync with AIOManager'), (am.at ? U.t('Last synced {when}', { when: U.dayLabel(am.at) }) + (am.count ? ' · ' + U.tn(am.count, '{n} addon in AIOManager', '{n} addons in AIOManager') : '') : U.t('Not synced yet')) +
858
+ ' · ' + U.t('refresh, add new, remove the ones gone from it'), aiomSync);
837
859
  }
838
860
  if (am.base || am.key) {
839
- row('Forget AIOManager', 'Its address, your API key and what came from it, cleared (your addons stay)', function () { U.store.remove(AIOM_KEY); U.toast('AIOManager forgotten', 2500); renderSettings(); });
861
+ row(U.t('Forget AIOManager'), U.t('Its address, your API key and what came from it, cleared (your addons stay)'), function () { U.store.remove(AIOM_KEY); U.toast(U.t('AIOManager forgotten'), 2500); renderSettings(); });
840
862
  }
841
863
  focusSettings();
842
864
  }
@@ -845,7 +867,7 @@
845
867
  if (!am.base) { aiomAskAddress(aiomSync); return; }
846
868
  if (!am.key) { aiomAskKey(aiomSync); return; }
847
869
  function norm(u) { return (Stremio.normalizeAddonUrl && Stremio.normalizeAddonUrl(u)) || u; }
848
- U.toast('Reading your AIOManager addons…', 4000);
870
+ U.toast(U.t('Reading your AIOManager addons…'), 4000);
849
871
  YTPlay.aiomAddons(am.base, am.key).then(function (r) {
850
872
  var there = (r && Array.isArray(r.addons) ? r.addons : []).filter(function (x) { return x && U.parseUrl(x.url); });
851
873
  var byNorm = {};
@@ -858,11 +880,11 @@
858
880
  var add = there.filter(function (x) { return x.enabled !== false && mineNorm.indexOf(norm(x.url)) === -1; });
859
881
  var gone = mine.filter(function (u) { var x = byNorm[norm(u)]; return fromIt(u) && (!x || x.enabled === false); });
860
882
  var items = [];
861
- if (shared.length) { items.push({ key: 'refresh', label: '↻ Refresh the ' + shared.length + ' addon' + (shared.length === 1 ? '' : 's') + ' you have from AIOManager' }); }
862
- add.forEach(function (x, i) { items.push({ key: 'add:' + i, label: '+ Add · ' + U.drawable(x.name || shortHost(x.url)).slice(0, 50) + ' · ' + shortHost(x.url) }); });
883
+ if (shared.length) { items.push({ key: 'refresh', label: U.tn(shared.length, '↻ Refresh the {n} addon you have from AIOManager', '↻ Refresh the {n} addons you have from AIOManager') }); }
884
+ add.forEach(function (x, i) { items.push({ key: 'add:' + i, label: U.t('+ Add') + ' · ' + U.drawable(x.name || shortHost(x.url)).slice(0, 50) + ' · ' + shortHost(x.url) }); });
863
885
  gone.forEach(function (u, i) {
864
886
  var x = byNorm[norm(u)];
865
- items.push({ key: 'rm:' + i, label: '− Remove · ' + (x && x.name ? U.drawable(x.name).slice(0, 50) + ' · ' : '') + shortHost(u), note: x ? 'off in AIOManager' : 'gone from AIOManager' });
887
+ items.push({ key: 'rm:' + i, label: U.t('− Remove') + ' · ' + (x && x.name ? U.drawable(x.name).slice(0, 50) + ' · ' : '') + shortHost(u), note: x ? U.t('off in AIOManager') : U.t('gone from AIOManager') });
866
888
  });
867
889
  function done(n, addedUrls) { // what came from it: as before, and what this sync added (still in your list)
868
890
  var now = (addedUrls || []).map(norm);
@@ -871,8 +893,8 @@
871
893
  if (n) { clearCatalogCache(); refreshAddonRows(null); }
872
894
  renderSettings();
873
895
  }
874
- if (!items.length) { U.toast('Nothing to sync: AIOManager has no addons StremioK can use', 4000); done(0); return; }
875
- pickMany('Sync with AIOManager: tick what to do', items, { button: function (n) { return 'Apply ' + n; } }, function (keys) {
896
+ if (!items.length) { U.toast(U.t('Nothing to sync: AIOManager has no addons StremioK can use'), 4000); done(0); return; }
897
+ pickMany(U.t('Sync with AIOManager: tick what to do'), items, { button: function (n) { return U.t('Apply {n}', { n: n }); } }, function (keys) {
876
898
  var added = 0, removed = 0, addedUrls = [];
877
899
  keys.forEach(function (k) {
878
900
  if (k.indexOf('add:') === 0) { var got = Stremio.addAddon(add[+k.slice(4)].url); if (got) { added++; addedUrls.push(got); Stremio.setAddonOrigin(got, 'aiomanager'); } }
@@ -881,10 +903,10 @@
881
903
  var refreshing = keys.indexOf('refresh') !== -1 ? shared.filter(function (u) { return Stremio.getAddonUrls().indexOf(u) !== -1; }) : [];
882
904
  U.settleAll(refreshing.map(function (u) { return function () { return Stremio.refreshAddon(u); }; }), 2).then(function (rs) {
883
905
  var refreshed = (rs || []).filter(function (x) { return x && x.ok; }).length, parts = [];
884
- if (added) { parts.push(added + ' added'); }
885
- if (removed) { parts.push(removed + ' removed'); }
886
- if (refreshing.length) { parts.push(refreshed + ' refreshed' + (refreshed < refreshing.length ? ' (' + (refreshing.length - refreshed) + ' didn’t answer)' : '')); }
887
- U.toast('Synced: ' + (parts.join(', ') || 'nothing changed'), 4000);
906
+ if (added) { parts.push(U.t('{n} added', { n: added })); }
907
+ if (removed) { parts.push(U.t('{n} removed', { n: removed })); }
908
+ if (refreshing.length) { parts.push(U.t('{n} refreshed', { n: refreshed }) + (refreshed < refreshing.length ? ' ' + U.t('({n} didn’t answer)', { n: refreshing.length - refreshed }) : '')); }
909
+ U.toast(U.t('Synced: {what}', { what: parts.join(', ') || U.t('nothing changed') }), 4000);
888
910
  done(added + removed + refreshed, addedUrls);
889
911
  });
890
912
  });
@@ -892,11 +914,11 @@
892
914
  var why = (e && e.message) || '';
893
915
  if (/HTTP 401\b/.test(why) || (e && e.status === 401)) {
894
916
  aiomSave({ key: '' });
895
- U.toast('AIOManager refused the API key: enter it again', 4500);
917
+ U.toast(U.t('AIOManager refused the API key: enter it again'), 4500);
896
918
  aiomAskKey(aiomSync);
897
919
  return;
898
920
  }
899
- U.toast('Couldn’t read your AIOManager addons (' + (U.problem ? U.problem(e) : why) + ')', 5000);
921
+ U.toast(U.t('Couldn’t read your AIOManager addons ({why})', { why: U.problem ? U.problem(e) : why }), 5000);
900
922
  });
901
923
  }
902
924
 
@@ -909,20 +931,20 @@
909
931
  // starts again with them.
910
932
  function importText(text, here) {
911
933
  var parsed = Stremio.parseSetupList(text);
912
- if (!parsed.items.length) { U.toast('No supported entries found in that file' + (parsed.ignored ? ' (' + parsed.ignored + ' ignored)' : ''), 4500); return; }
934
+ if (!parsed.items.length) { U.toast(U.t('No supported entries found in that file') + (parsed.ignored ? ' ' + U.t('({n} ignored)', { n: parsed.ignored }) : ''), 4500); return; }
913
935
  if (here()) { App.back(); renderSettings(); }
914
- pickMany('In that file: tick what to import', parsed.items.map(function (it, i) { return { key: '' + i, label: it.label, have: it.have, note: it.note }; }),
915
- { button: function (n) { return 'Import ' + n; } }, function (keys) {
936
+ pickMany(U.t('In that file: tick what to import'), parsed.items.map(function (it, i) { return { key: '' + i, label: it.label, have: it.have, note: it.note }; }),
937
+ { button: function (n) { return U.t('Import {n}', { n: n }); } }, function (keys) {
916
938
  var imported = Stremio.applySetupEntries(keys.map(function (k) { return parsed.items[+k]; })), parts = [];
917
- if (imported.addons) { parts.push(imported.addons + ' addon' + (imported.addons === 1 ? '' : 's')); }
918
- if (imported.playlists) { parts.push(imported.playlists + ' playlist' + (imported.playlists === 1 ? '' : 's')); }
919
- if (imported.omdb) { parts.push('OMDb key'); }
920
- if (imported.tmdb) { parts.push('TMDB key'); }
921
- if (imported.mdblist) { parts.push('MDBList key'); }
922
- if (imported.settings) { parts.push('your settings'); }
939
+ if (imported.addons) { parts.push(U.tn(imported.addons, '{n} addon', '{n} addons')); }
940
+ if (imported.playlists) { parts.push(U.tn(imported.playlists, '{n} playlist', '{n} playlists')); }
941
+ if (imported.omdb) { parts.push(U.t('OMDb key')); }
942
+ if (imported.tmdb) { parts.push(U.t('TMDB key')); }
943
+ if (imported.mdblist) { parts.push(U.t('MDBList key')); }
944
+ if (imported.settings) { parts.push(U.t('your settings')); }
923
945
  if (imported.addons || imported.playlists) { clearCatalogCache(); }
924
- var message = parts.length ? ('Imported: ' + parts.join(', ')) : 'Nothing imported';
925
- if (parsed.ignored) { message += ' (' + parsed.ignored + ' ignored)'; }
946
+ var message = parts.length ? U.t('Imported: {what}', { what: parts.join(', ') }) : U.t('Nothing imported');
947
+ if (parsed.ignored) { message += ' ' + U.t('({n} ignored)', { n: parsed.ignored }); }
926
948
  if (imported.settings) { // (every part of StremioK reads them afresh)
927
949
  U.toast(message + '. StremioK starts again with them…', 4000);
928
950
  setTimeout(function () { try { window.location.reload(); } catch (e) {} }, 2500);
@@ -935,42 +957,42 @@
935
957
  // Settings › Content › Export configuration: what goes in, all ticked at first, given to your
936
958
  // phone (V.phoneGive) as the file Import configuration file reads (Stremio.exportSetup).
937
959
  function settingsExport(wrap) {
938
- wrap.appendChild(U.el('h2', null, 'Export configuration'));
960
+ wrap.appendChild(U.el('h2', null, U.t('Export configuration')));
939
961
  var row = U.el('div', 'addon-item focusable add-row');
940
- row.appendChild(U.el('div', 'a-name', '⇧ Export to your phone'));
941
- row.appendChild(U.el('div', 'a-url', 'Your addons, IPTV playlists, API keys and settings, as a file to import later'));
962
+ row.appendChild(U.el('div', 'a-name', U.t('⇧ Export to your phone')));
963
+ row.appendChild(U.el('div', 'a-url', U.t('Your addons, IPTV playlists, API keys and settings, as a file to import later')));
942
964
  row.__onselect = function () {
943
965
  var groups = Stremio.exportGroups();
944
- pickMany('Tick what to export', groups.map(function (g) { return { key: g.key, label: g.label }; }),
945
- { on: groups.map(function (g) { return g.key; }), button: function (n) { return 'Export ' + n; } }, function (keys) {
946
- V.phoneGive('Export configuration', Stremio.exportSetup(keys, appVersion()),
947
- 'It holds your addon links, playlist logins, API keys and MAC addresses: keep the file private. Not in it: your Trakt sign-in, history and progress.');
966
+ pickMany(U.t('Tick what to export'), groups.map(function (g) { return { key: g.key, label: g.label }; }),
967
+ { on: groups.map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
968
+ V.phoneGive(U.t('Export configuration'), Stremio.exportSetup(keys, appVersion()),
969
+ U.t('It holds your addon links, playlist logins, API keys and MAC addresses: keep the file private. Not in it: your Trakt sign-in, history and progress.'));
948
970
  });
949
971
  };
950
972
  wrap.appendChild(row);
951
- wrap.appendChild(U.el('div', 'hint', 'To restore it (after a reinstall, or on another TV): Import configuration file › ▣ From your phone, then choose the file there (or paste it).'));
973
+ wrap.appendChild(U.el('div', 'hint', U.t('To restore it (after a reinstall, or on another TV): Import configuration file › ▣ From your phone, then choose the file there (or paste it).')));
952
974
  focusSettings();
953
975
  }
954
976
  function settingsImport(wrap) {
955
- wrap.appendChild(U.el('h2', null, 'Import configuration file'));
977
+ wrap.appendChild(U.el('h2', null, U.t('Import configuration file')));
956
978
  var lastUrl = U.store.get(IMPORT_URL_KEY, '') || '';
957
979
  var listRow = U.el('div', 'addon-item focusable add-row');
958
- var ln = U.el('div', 'a-name', '+ Import configuration file');
980
+ var ln = U.el('div', 'a-name', U.t('+ Import configuration file'));
959
981
  ln.appendChild(originBadge('config'));
960
982
  listRow.appendChild(ln);
961
- listRow.appendChild(U.el('div', 'a-url', lastUrl ? ('Last used: ' + lastUrl + ' · OK to import again')
962
- : 'Addon URLs, API keys and IPTV playlist URLs'));
983
+ listRow.appendChild(U.el('div', 'a-url', lastUrl ? U.t('Last used: {link} · OK to import again', { link: lastUrl })
984
+ : U.t('Addon URLs, API keys and IPTV playlist URLs')));
963
985
  listRow.__onselect = function () {
964
986
  App.openEntry({
965
- title: 'Import configuration file', phone: 'config',
966
- hint: 'Enter a text-file URL containing one addon URL, API key or M3U/M3U8 playlist URL per line. Lines starting with # are ignored. The URL is remembered for next time.',
987
+ title: U.t('Import configuration file'), phone: 'config',
988
+ hint: U.t('Enter a text-file URL containing one addon URL, API key or M3U/M3U8 playlist URL per line. Lines starting with # are ignored. The URL is remembered for next time.'),
967
989
  value: lastUrl || 'https://', placeholder: 'https://example.com/stremiok.txt',
968
990
  validate: function (v) { return U.urlProblem(v) || null; }, // (U.parseUrl: http(s), a real host, no user:password@)
969
991
  onConfirm: function (v) {
970
992
  // Saved even if the fetch fails, so a typo can be fixed instead of retyped.
971
993
  U.store.set(IMPORT_URL_KEY, v);
972
994
  lastUrl = v;
973
- U.toast('Fetching configuration file…', 5000);
995
+ U.toast(U.t('Fetching configuration file…'), 5000);
974
996
  // (what you confirmed is imported even if you've moved on; only the screen
975
997
  // you're on stays: back to Settings only from this entry, still showing)
976
998
  var entry = scr('addaddon'), mine = ++_importGen;
@@ -980,8 +1002,8 @@
980
1002
  }, function (err) {
981
1003
  if (!here()) { return; }
982
1004
  var why = U.problem(err);
983
- U.toast(/^too large/.test(why) ? 'That file is ' + why + ': a configuration file is a short list of URLs and keys.'
984
- : 'Could not fetch that configuration file (' + why + '; check the URL / CORS).', 5000);
1005
+ U.toast(/^Too large/.test((err && err.message) || '') ? U.t('That file is {why}: a configuration file is a short list of URLs and keys.', { why: why })
1006
+ : U.t('Could not fetch that configuration file ({why}; check the URL / CORS).', { why: why }), 5000);
985
1007
  });
986
1008
  },
987
1009
  // From your phone, the file itself pasted (not a link): imported as it is
@@ -991,7 +1013,7 @@
991
1013
  };
992
1014
  wrap.appendChild(listRow);
993
1015
  wrap.appendChild(U.el('div', 'hint',
994
- 'Accepted lines: addon URLs, M3U/M3U8 URLs, and OMDb, TMDB or MDBList API keys.'));
1016
+ U.t('Accepted lines: addon URLs, M3U/M3U8 URLs, and OMDb, TMDB or MDBList API keys.')));
995
1017
  focusSettings();
996
1018
  }
997
1019
 
@@ -1011,15 +1033,15 @@
1011
1033
  });
1012
1034
  }
1013
1035
  function playlistInfo(p) {
1014
- if (p.off) { return 'Off — its channels aren’t shown'; }
1036
+ if (p.off) { return U.t('Off — its channels aren’t shown'); }
1015
1037
  var st = Stremio.iptvStatus(p.id), parts = [];
1016
- if (!st.url) { return 'Not read yet'; }
1017
- parts.push(thousands(st.count || 0) + ' channel' + (st.count === 1 ? '' : 's') + (st.groups ? ' in ' + st.groups + ' group' + (st.groups === 1 ? '' : 's') : ''));
1018
- if (st.fetchedAt) { var d = new Date(st.fetchedAt); parts.push('downloaded ' + U.dayLabel(st.fetchedAt) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes())); }
1019
- if (st.dropped) { parts.push(thousands(st.dropped) + ' more left out (a playlist keeps its first 30,000)'); }
1020
- if (p.genres) { parts.push(p.genres.length + ' group' + (p.genres.length === 1 ? '' : 's') + ' chosen'); }
1021
- if (st.cut) { parts.push('stopped short' + (st.cut > 0 ? ' of ' + thousands(st.cut) : '') + ': OK on it, then Channel groups, reads only what you want'); }
1022
- if (st.uncached) { parts.push('too large to save on the TV: downloaded each launch'); }
1038
+ if (!st.url) { return U.t('Not read yet'); }
1039
+ parts.push(U.tn(st.count || 0, '{n} channel', '{n} channels', { n: thousands(st.count || 0) }) + (st.groups ? ' ' + U.tn(st.groups, 'in {n} group', 'in {n} groups') : ''));
1040
+ if (st.fetchedAt) { var d = new Date(st.fetchedAt); parts.push(U.t('downloaded {when}', { when: U.dayLabel(st.fetchedAt) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes()) })); }
1041
+ if (st.dropped) { parts.push(U.t('{n} more left out (a playlist keeps its first 30,000)', { n: thousands(st.dropped) })); }
1042
+ if (p.genres) { parts.push(U.tn(p.genres.length, '{n} group chosen', '{n} groups chosen')); }
1043
+ if (st.cut) { parts.push(st.cut > 0 ? U.t('stopped short of {n}: OK on it, then Channel groups, reads only what you want', { n: thousands(st.cut) }) : U.t('stopped short: OK on it, then Channel groups, reads only what you want')); }
1044
+ if (st.uncached) { parts.push(U.t('too large to save on the TV: downloaded each launch')); }
1023
1045
  var g = guideInfo(p);
1024
1046
  if (g) { parts.push(g); }
1025
1047
  return parts.join(' · ');
@@ -1027,51 +1049,51 @@
1027
1049
  // Its TV guide (js/epg.js): being read, read (for how many of its channels), or why not.
1028
1050
  function guideInfo(p) {
1029
1051
  var g = typeof EPG !== 'undefined' && EPG.status ? EPG.status(p.id) : null;
1030
- if (!g) { return typeof EPG !== 'undefined' && EPG.available && EPG.available() ? 'no TV guide' : ''; }
1052
+ if (!g) { return typeof EPG !== 'undefined' && EPG.available && EPG.available() ? U.t('no TV guide') : ''; }
1031
1053
  if (g.state === 'ready') {
1032
1054
  var d = new Date(g.at);
1033
- return 'TV guide: ' + thousands(g.channels) + ' channel' + (g.channels === 1 ? '' : 's') + ', ' + thousands(g.programmes) + ' programs' + (g.partial ? ' (part of it: too large)' : '') +
1034
- (g.at ? ', read ' + U.dayLabel(g.at) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes()) : '') + (g.error ? ' (the last read failed: ' + g.error + ')' : '');
1055
+ return U.t('TV guide: {channels}, {programs} programs', { channels: U.tn(g.channels, '{n} channel', '{n} channels', { n: thousands(g.channels) }), programs: thousands(g.programmes) }) + (g.partial ? ' ' + U.t('(part of it: too large)') : '') +
1056
+ (g.at ? ', ' + U.t('read {when}', { when: U.dayLabel(g.at) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes()) }) : '') + (g.error ? ' ' + U.t('(the last read failed: {why})', { why: g.error }) : '');
1035
1057
  }
1036
- if (g.state === 'failed') { return '⚠ TV guide: ' + (g.error || 'couldn’t be read'); }
1037
- return 'TV guide: reading…';
1058
+ if (g.state === 'failed') { return '⚠ ' + U.t('TV guide: {why}', { why: g.error || U.t('couldn’t be read') }); }
1059
+ return U.t('TV guide: reading…');
1038
1060
  }
1039
1061
  function playlistProblem(p) {
1040
1062
  var st = Stremio.iptvStatus(p.id);
1041
1063
  if (p.off || !st.error) { return ''; }
1042
- return '⚠ ' + (st.stale ? 'Couldn’t refresh it (showing the saved copy): ' : '') + st.error;
1064
+ return '⚠ ' + (st.stale ? U.t('Couldn’t refresh it (showing the saved copy):') + ' ' : '') + st.error;
1043
1065
  }
1044
1066
  // + Add Xtream account: its server, username and password, a page each (a whole Xtream link
1045
1067
  // in the server's fills the rest); checked with the server, then added (Stremio.iptvAddXtream).
1046
1068
  function addXtream() {
1047
1069
  function done(base, user, pass) {
1048
- U.toast('Checking the account…', 15000);
1070
+ U.toast(U.t('Checking the account…'), 15000);
1049
1071
  IPTV.xtreamCheck(base, user, pass).then(function (r) {
1050
- if (r.unreachable) { U.toast('Couldn’t reach the server: check its address (nothing was saved)', 5000); return; }
1051
- if (r.refused) { U.toast('The server refused that username and password' + (r.status ? ' (' + r.status + ')' : '') + ': nothing was saved', 5000); return; }
1072
+ if (r.unreachable) { U.toast(U.t('Couldn’t reach the server: check its address (nothing was saved)'), 5000); return; }
1073
+ if (r.refused) { U.toast(U.t('The server refused that username and password{code}: nothing was saved', { code: r.status ? ' (' + r.status + ')' : '' }), 5000); return; }
1052
1074
  Stremio.iptvAddXtream(base, user, pass);
1053
1075
  refreshAddonRows('local:iptv');
1054
- U.toast('Xtream account added: reading its channels and TV guide…', 4000);
1076
+ U.toast(U.t('Xtream account added: reading its channels and TV guide…'), 4000);
1055
1077
  renderSettings();
1056
1078
  });
1057
1079
  }
1058
1080
  App.openEntry({
1059
- title: 'Xtream account: server', phone: 'playlist',
1060
- hint: 'The server address your provider gave you (http://line.example.com:8080), or a whole Xtream link. RETURN cancels.',
1081
+ title: U.t('Xtream account: server'), phone: 'playlist',
1082
+ hint: U.t('The server address your provider gave you (http://line.example.com:8080), or a whole Xtream link. RETURN cancels.'),
1061
1083
  value: 'http://', placeholder: 'http://line.example.com:8080',
1062
- validate: function (v) { return IPTV.xtreamParts(v) ? null : 'That isn’t a server address'; },
1084
+ validate: function (v) { return IPTV.xtreamParts(v) ? null : U.t('That isn’t a server address'); },
1063
1085
  onConfirm: function (v) {
1064
1086
  var x = IPTV.xtreamParts(v);
1065
1087
  App.back();
1066
1088
  if (x.user && x.pass) { done(x.base, x.user, x.pass); return; }
1067
1089
  App.openEntry({
1068
- title: 'Xtream account: username', hint: 'Your account’s username. RETURN cancels.', value: x.user, placeholder: 'username',
1069
- validate: function (u) { return ('' + u).trim() ? null : 'Type the username'; },
1090
+ title: U.t('Xtream account: username'), hint: U.t('Your account’s username. RETURN cancels.'), value: x.user, placeholder: 'username',
1091
+ validate: function (u) { return ('' + u).trim() ? null : U.t('Type the username'); },
1070
1092
  onConfirm: function (u) {
1071
1093
  App.back();
1072
1094
  App.openEntry({
1073
- title: 'Xtream account: password', hint: 'Your account’s password (kept on the TV, in the playlist’s link). RETURN cancels.', value: '', placeholder: 'password', secret: true,
1074
- validate: function (p) { return ('' + p) ? null : 'Type the password'; },
1095
+ title: U.t('Xtream account: password'), hint: U.t('Your account’s password (kept on the TV, in the playlist’s link). RETURN cancels.'), value: '', placeholder: U.t('password'), secret: true,
1096
+ validate: function (p) { return ('' + p) ? null : U.t('Type the password'); },
1075
1097
  onConfirm: function (p) { App.back(); done(x.base, ('' + u).trim(), '' + p); }
1076
1098
  });
1077
1099
  }
@@ -1083,29 +1105,29 @@
1083
1105
  // the service), then added (Stremio.iptvAddStalker).
1084
1106
  function addStalker() {
1085
1107
  function done(portal, mac) {
1086
- U.toast('Checking the portal…', 60000);
1108
+ U.toast(U.t('Checking the portal…'), 60000);
1087
1109
  IPTV.stalkerCheck(portal, mac).then(function (r) {
1088
- if (r.noService) { U.toast('Stalker portals are read by StremioK’s service, which a desktop browser doesn’t have (nothing was saved)', 5000); return; }
1089
- if (r.unreachable) { U.toast('Couldn’t read the portal' + (r.why ? ' (' + r.why + ')' : '') + ': nothing was saved', 6000); return; }
1090
- if (r.refused) { U.toast('The portal refused that MAC address' + (r.why ? ' (' + r.why + ')' : '') + ': nothing was saved', 6000); return; }
1110
+ if (r.noService) { U.toast(U.t('Stalker portals are read by StremioK’s service, which a desktop browser doesn’t have (nothing was saved)'), 5000); return; }
1111
+ if (r.unreachable) { U.toast(U.t('Couldn’t read the portal{why}: nothing was saved', { why: r.why ? ' (' + r.why + ')' : '' }), 6000); return; }
1112
+ if (r.refused) { U.toast(U.t('The portal refused that MAC address{why}: nothing was saved', { why: r.why ? ' (' + r.why + ')' : '' }), 6000); return; }
1091
1113
  Stremio.iptvAddStalker(portal, mac);
1092
1114
  refreshAddonRows('local:iptv');
1093
- U.toast('Stalker portal added: ' + r.count + ' channels' + (r.cut ? (r.cut.total ? ' of ' + r.cut.total : ' so far') + ': see Stalker channels' : ''), r.cut ? 6000 : 4000);
1115
+ U.toast(!r.cut ? U.t('Stalker portal added: {n} channels', { n: r.count }) : r.cut.total ? U.t('Stalker portal added: {n} channels of {total}: see Stalker channels', { n: r.count, total: r.cut.total }) : U.t('Stalker portal added: {n} channels so far: see Stalker channels', { n: r.count }), r.cut ? 6000 : 4000);
1094
1116
  renderSettings();
1095
1117
  });
1096
1118
  }
1097
1119
  App.openEntry({
1098
- title: 'Stalker portal: address', phone: 'playlist',
1099
- hint: 'The portal address your provider gave you (http://portal.example.com/c/). RETURN cancels.',
1120
+ title: U.t('Stalker portal: address'), phone: 'playlist',
1121
+ hint: U.t('The portal address your provider gave you (http://portal.example.com/c/). RETURN cancels.'),
1100
1122
  value: 'http://', placeholder: 'http://portal.example.com/c/',
1101
- validate: function (v) { return IPTV.stalkerPortal(v) ? null : 'That isn’t a portal address'; },
1123
+ validate: function (v) { return IPTV.stalkerPortal(v) ? null : U.t('That isn’t a portal address'); },
1102
1124
  onConfirm: function (v) {
1103
1125
  var portal = IPTV.stalkerPortal(v);
1104
1126
  App.back();
1105
1127
  App.openEntry({
1106
- title: 'Stalker portal: MAC address', phone: 'mac',
1107
- hint: 'The MAC address your provider registered for you (00:1A:79:…), kept on the TV. RETURN cancels.', value: '00:1A:79:', placeholder: '00:1A:79:00:00:00',
1108
- validate: function (m) { return IPTV.macOf(m) ? null : 'A MAC address is six pairs, like 00:1A:79:12:34:56'; },
1128
+ title: U.t('Stalker portal: MAC address'), phone: 'mac',
1129
+ hint: U.t('The MAC address your provider registered for you (00:1A:79:…), kept on the TV. RETURN cancels.'), value: '00:1A:79:', placeholder: U.t('00:1A:79:00:00:00'),
1130
+ validate: function (m) { return IPTV.macOf(m) ? null : U.t('A MAC address is six pairs, like 00:1A:79:12:34:56'); },
1109
1131
  onConfirm: function (m) { App.back(); done(portal, IPTV.macOf(m)); }
1110
1132
  });
1111
1133
  }
@@ -1113,24 +1135,24 @@
1113
1135
  }
1114
1136
  // Streaming server: Stremio's or TorrServer, on your network (see Stremio.server). Picking one
1115
1137
  // asks for its address; Test says whether it answers.
1116
- var SERVERS = [['', 'Off'], ['stremio', 'Stremio server'], ['torrserver', 'TorrServer']];
1138
+ var SERVERS = [['', U.t('Off')], ['stremio', U.t('Stremio server')], ['torrserver', U.t('TorrServer')]];
1117
1139
  var SERVER_PORT = { stremio: 11470, torrserver: 8090 };
1118
- var TORRENT_WAITS = [['45', '45 seconds'], ['60', '1 minute'], ['120', '2 minutes'], ['180', '3 minutes'], ['300', '5 minutes']];
1140
+ var TORRENT_WAITS = [['45', U.t('45 seconds')], ['60', U.t('1 minute')], ['120', U.t('2 minutes')], ['180', U.t('3 minutes')], ['300', U.t('5 minutes')]];
1119
1141
  function askServerAddress(kind, url) {
1120
1142
  var eg = 'http://192.168.0.10:' + SERVER_PORT[kind];
1121
1143
  App.openEntry({
1122
- title: (kind === 'stremio' ? 'Stremio server' : 'TorrServer') + ': address',
1123
- hint: 'Its address on your network, like ' + eg + '. RETURN cancels.',
1144
+ title: U.t('{server}: address', { server: kind === 'stremio' ? U.t('Stremio server') : 'TorrServer' }),
1145
+ hint: U.t('Its address on your network, like {example}. RETURN cancels.', { example: eg }),
1124
1146
  value: url || 'http://', placeholder: eg, phone: 'server',
1125
1147
  validate: function (v) { return Stremio.serverAddressProblem(v); },
1126
1148
  onConfirm: function (v) { Stremio.setServer({ kind: kind, url: v }); App.back(); renderSettings(); }
1127
1149
  });
1128
1150
  }
1129
1151
  function settingsServer(wrap) {
1130
- wrap.appendChild(U.el('h2', null, 'Streaming server'));
1152
+ wrap.appendChild(U.el('h2', null, U.t('Streaming server')));
1131
1153
  wrap.appendChild(U.el('div', 'hint', 'Torrent-only sources play through it; Stremio’s can also convert a video the TV can’t play.'));
1132
1154
  var sv = Stremio.server();
1133
- wrap.appendChild(subPickRow('Server', SERVERS, 'kind', {
1155
+ wrap.appendChild(subPickRow(U.t('Server'), SERVERS, 'kind', {
1134
1156
  get: function () { return { kind: Stremio.server().kind }; },
1135
1157
  set: function (cfg) {
1136
1158
  var cur = Stremio.server();
@@ -1140,31 +1162,31 @@
1140
1162
  }));
1141
1163
  if (!sv.kind) { return; }
1142
1164
  var addr = U.el('div', 'addon-item focusable cfg-row');
1143
- addr.appendChild(U.el('div', 'a-name', 'Address: ' + sv.url));
1144
- addr.appendChild(U.el('div', 'a-url', 'Press OK to change'));
1165
+ addr.appendChild(U.el('div', 'a-name', U.t('Address:') + ' ' + sv.url));
1166
+ addr.appendChild(U.el('div', 'a-url', U.t('Press OK to change')));
1145
1167
  addr.__onselect = function () { askServerAddress(sv.kind, sv.url); };
1146
1168
  wrap.appendChild(addr);
1147
- var test = U.el('div', 'addon-item focusable cfg-row'), said = U.el('div', 'a-url', 'Press OK to see whether it answers');
1148
- test.appendChild(U.el('div', 'a-name', 'Test'));
1169
+ var test = U.el('div', 'addon-item focusable cfg-row'), said = U.el('div', 'a-url', U.t('Press OK to see whether it answers'));
1170
+ test.appendChild(U.el('div', 'a-name', U.t('Test')));
1149
1171
  test.appendChild(said);
1150
1172
  test.__onselect = function () {
1151
- said.textContent = 'Asking…';
1173
+ said.textContent = U.t('Asking…');
1152
1174
  Stremio.testServer().then(function (r) { said.textContent = (r.ok ? '✓ ' : '✗ ') + r.text; });
1153
1175
  };
1154
1176
  wrap.appendChild(test);
1155
- wrap.appendChild(subPickRow('Wait for a torrent to start', TORRENT_WAITS, 'wait', {
1177
+ wrap.appendChild(subPickRow(U.t('Wait for a torrent to start'), TORRENT_WAITS, 'wait', {
1156
1178
  get: function () { return { wait: '' + Stremio.server().wait }; },
1157
1179
  set: function (cfg) { Stremio.setServer({ kind: Stremio.server().kind, wait: +cfg.wait }); }
1158
1180
  }));
1159
1181
  if (sv.kind === 'stremio') {
1160
- wrap.appendChild(subPickRow('Convert videos the TV can’t play', [['on', 'On'], ['off', 'Off']], 'convert', {
1182
+ wrap.appendChild(subPickRow(U.t('Convert videos the TV can’t play'), [['on', U.t('On')], ['off', U.t('Off')]], 'convert', {
1161
1183
  get: function () { return { convert: Stremio.server().convert ? 'on' : 'off' }; },
1162
1184
  set: function (cfg) { Stremio.setServer({ kind: 'stremio', convert: cfg.convert === 'on' }); }
1163
1185
  }));
1164
1186
  }
1165
1187
  }
1166
1188
 
1167
- var IPTV_EVERY = [['0', 'Off'], ['1', 'Every hour'], ['3', 'Every 3 hours'], ['6', 'Every 6 hours'], ['12', 'Every 12 hours']];
1189
+ var IPTV_EVERY = [['0', U.t('Off')], ['1', U.t('Every hour')], ['3', U.t('Every 3 hours')], ['6', U.t('Every 6 hours')], ['12', U.t('Every 12 hours')]];
1168
1190
  function settingsIptv(wrap) {
1169
1191
  wrap.appendChild(U.el('h2', null, 'IPTV'));
1170
1192
  var playlists = Stremio.iptvGetPlaylists ? Stremio.iptvGetPlaylists() : [];
@@ -1173,7 +1195,7 @@
1173
1195
  // Combined load status — turns silent per-playlist fetch failures into a visible message.
1174
1196
  var statusEl = null;
1175
1197
  if (playlists.some(function (p) { return !p.off; }) && Stremio.iptvLoad) {
1176
- statusEl = U.el('div', 'hint', 'Checking playlists…');
1198
+ statusEl = U.el('div', 'hint', U.t('Checking playlists…'));
1177
1199
  wrap.appendChild(statusEl);
1178
1200
  _iptvStatusEl = statusEl; // (updated as big playlists are read, see below)
1179
1201
  }
@@ -1192,7 +1214,7 @@
1192
1214
  }
1193
1215
  var btns = orderButtons(function (dir, name) { move(dir, name)(); }, ctl);
1194
1216
  var item = ctl(U.el('div', 'addon-item focusable playlist-item'), 'item');
1195
- item.appendChild(U.el('div', 'a-name', label + (playlist.off ? ' (off)' : '')));
1217
+ item.appendChild(U.el('div', 'a-name', label + (playlist.off ? ' ' + U.t('(off)') : '')));
1196
1218
  item.appendChild(U.el('div', 'a-url', U.redactUrl(playlist.url) + (playlist.mac ? ' · MAC ' + playlist.mac.slice(0, 8) + ':••:••:••' : ''))); // (credentials masked; a Stalker portal's MAC too)
1197
1219
  var info = U.el('div', 'a-url playlist-info', playlistInfo(playlist));
1198
1220
  var problem = U.el('div', 'a-url addon-said', playlistProblem(playlist));
@@ -1222,46 +1244,45 @@
1222
1244
  groups += st.groups || 0;
1223
1245
  if (st.error) { failed++; }
1224
1246
  });
1225
- statusEl.textContent = (failed ? '⚠ ' : '✓ ') + 'Loaded ' + thousands(channels) + ' channels from ' +
1226
- on + ' playlist(s) in ' + groups + ' group(s).' + (failed ? (' ' + failed + ' playlist(s) reported an error.') : '') +
1227
- (on < playlists.length ? ' ' + (playlists.length - on) + ' switched off.' : '');
1247
+ statusEl.textContent = (failed ? '⚠ ' : '✓ ') + U.t('Loaded {channels} channels from {playlists} playlist(s) in {groups} group(s).', { channels: thousands(channels), playlists: on, groups: groups }) + (failed ? (' ' + U.t('{n} playlist(s) reported an error.', { n: failed })) : '') +
1248
+ (on < playlists.length ? ' ' + U.t('{n} switched off.', { n: playlists.length - on }) : '');
1228
1249
  });
1229
1250
  }
1230
1251
 
1231
1252
  var add = U.el('div', 'addon-item focusable add-row');
1232
- add.appendChild(U.el('div', 'a-name', '+ Add playlist'));
1233
- add.appendChild(U.el('div', 'a-url', 'Enter another M3U/M3U8 playlist URL'));
1253
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add playlist')));
1254
+ add.appendChild(U.el('div', 'a-url', U.t('Enter another M3U/M3U8 playlist URL')));
1234
1255
  add.__onselect = function () {
1235
1256
  App.openEntry({
1236
- title: 'Add IPTV playlist', phone: 'playlist',
1237
- hint: 'Type an M3U/M3U8 playlist URL. Nothing is saved until you Confirm.',
1257
+ title: U.t('Add IPTV playlist'), phone: 'playlist',
1258
+ hint: U.t('Type an M3U/M3U8 playlist URL. Nothing is saved until you Confirm.'),
1238
1259
  value: 'https://', placeholder: 'https://example.com/playlist.m3u',
1239
1260
  validate: function (v) { return U.urlProblem(v) || null; }, // (U.parseUrl: http(s), a real host, no user:password@)
1240
1261
  onConfirm: function (v) {
1241
1262
  Stremio.iptvAddPlaylist(v);
1242
1263
  refreshAddonRows('local:iptv');
1243
- U.toast('Playlist added');
1264
+ U.toast(U.t('Playlist added'));
1244
1265
  App.back(); renderSettings();
1245
1266
  }
1246
1267
  });
1247
1268
  };
1248
1269
  wrap.appendChild(add);
1249
1270
  var xt = U.el('div', 'addon-item focusable add-row');
1250
- xt.appendChild(U.el('div', 'a-name', '+ Add Xtream account'));
1251
- xt.appendChild(U.el('div', 'a-url', 'Its server, username and password: its channels and TV guide added'));
1271
+ xt.appendChild(U.el('div', 'a-name', U.t('+ Add Xtream account')));
1272
+ xt.appendChild(U.el('div', 'a-url', U.t('Its server, username and password: its channels and TV guide added')));
1252
1273
  xt.__onselect = addXtream;
1253
1274
  wrap.appendChild(xt);
1254
1275
  var sk = U.el('div', 'addon-item focusable add-row');
1255
- sk.appendChild(U.el('div', 'a-name', '+ Add Stalker portal'));
1256
- sk.appendChild(U.el('div', 'a-url', 'Its address and MAC address: its channels added'));
1276
+ sk.appendChild(U.el('div', 'a-name', U.t('+ Add Stalker portal')));
1277
+ sk.appendChild(U.el('div', 'a-url', U.t('Its address and MAC address: its channels added')));
1257
1278
  sk.__onselect = addStalker;
1258
1279
  wrap.appendChild(sk);
1259
1280
  if (playlists.length && Stremio.iptvRefreshEvery) { // (all of them, with their guides, as Reload does)
1260
- wrap.appendChild(subPickRow('Auto-refresh', IPTV_EVERY, 'every',
1281
+ wrap.appendChild(subPickRow(U.t('Auto-refresh'), IPTV_EVERY, 'every',
1261
1282
  { get: function () { return { every: String(Stremio.iptvRefreshEvery()) }; }, set: function (c) { Stremio.iptvSetRefreshEvery(+c.every); } }));
1262
1283
  }
1263
- wrap.appendChild(subPickRow('Stalker channels', [['pages', 'First 100 pages (about 1,400 channels)'], ['all', 'Whole portal (up to 30,000 channels)']], 'stalker', {
1264
- warning: 'Whole portal can take many minutes on every Reload and Auto-refresh, the IPTV rows wait for a first read, and a portal may slow down, cut off or block a MAC address that asks so much',
1284
+ wrap.appendChild(subPickRow(U.t('Stalker channels'), [['pages', U.t('First 100 pages (about 1,400 channels)')], ['all', U.t('Whole portal (up to 30,000 channels)')]], 'stalker', {
1285
+ warning: U.t('Whole portal can take many minutes on every Reload and Auto-refresh, the IPTV rows wait for a first read, and a portal may slow down, cut off or block a MAC address that asks so much'),
1265
1286
  get: function () { return { stalker: IPTV.stalkerAll() ? 'all' : 'pages' }; },
1266
1287
  set: function (c) {
1267
1288
  var on = c.stalker === 'all', was = IPTV.stalkerAll();
@@ -1269,20 +1290,20 @@
1269
1290
  if (!on || was) { return; }
1270
1291
  var mine = playlists.filter(IPTV.isStalker); // (read again now: leave StremioK open meanwhile)
1271
1292
  if (!mine.length) { return; }
1272
- U.toast('Reading the whole portal: this can take many minutes, leave StremioK open', 6000);
1293
+ U.toast(U.t('Reading the whole portal: this can take many minutes, leave StremioK open'), 6000);
1273
1294
  mine.forEach(function (p) { Stremio.iptvReload(p.id).then(function () { refreshAddonRows('local:iptv'); }); });
1274
1295
  }
1275
1296
  }));
1276
1297
 
1277
1298
  if (typeof StVod !== 'undefined' && StVod.keepMinutes) { // (what the service keeps of a portal's films and series)
1278
- wrap.appendChild(subPickRow('Stalker films and series', [['10', 'Kept 10 minutes'], ['5', 'Kept 5 minutes'], ['0', 'Off (asked each time)']], 'keep', {
1299
+ wrap.appendChild(subPickRow(U.t('Stalker films and series'), [['10', U.t('Kept 10 minutes')], ['5', U.t('Kept 5 minutes')], ['0', U.t('Off (asked each time)')]], 'keep', {
1279
1300
  get: function () { return { keep: String(StVod.keepMinutes()) }; },
1280
1301
  set: function (c) { StVod.setKeepMinutes(+c.keep); }
1281
1302
  }));
1282
1303
  }
1283
1304
 
1284
1305
  wrap.appendChild(U.el('div', 'hint',
1285
- 'Channels are grouped into IPTV and Radio rows on Home. ▲ / ▼ set the playlists\' order: a channel in two playlists comes from the first.'));
1306
+ U.t('Channels are grouped into IPTV and Radio rows on Home. ▲ / ▼ set the playlists\' order: a channel in two playlists comes from the first.')));
1286
1307
  var s = scr('settings'), want = null;
1287
1308
  if (_iptvFocus) {
1288
1309
  var nodes = wrap.querySelectorAll('.playlist-row .focusable');
@@ -1300,11 +1321,11 @@
1300
1321
  // also be added by holding OK on one, wherever it's shown.)
1301
1322
  var _ytFocus = null; // { id, ctl } to focus once the page is drawn again
1302
1323
  function ytDescribe(x) {
1303
- var what = { channel: 'Channel', playlist: 'Playlist', search: 'Search' }[YouTube.sourceKind(x.src)];
1324
+ var kind = YouTube.sourceKind(x.src), what = { channel: U.t('Channel'), playlist: U.t('Playlist'), search: U.t('Search') }[kind];
1304
1325
  var bits = [what + ': ' + x.src.replace(/^search:/i, '')];
1305
1326
  if (x.kind !== 'auto') { bits.push(YouTube.KIND_NAMES[x.kind]); }
1306
- if (what === 'Search' && x.sort !== 'relevance') { bits.push('by ' + YouTube.SORT_NAMES[x.sort].toLowerCase()); }
1307
- if (x.type !== 'YouTube') { bits.push('type “' + x.type + '”'); }
1327
+ if (kind === 'search' && x.sort !== 'relevance') { bits.push(U.t('by {order}', { order: YouTube.SORT_NAMES[x.sort].toLowerCase() })); }
1328
+ if (x.type !== 'YouTube') { bits.push(U.t('type “{type}”', { type: x.type })); }
1308
1329
  return bits.join(' · ');
1309
1330
  }
1310
1331
  function ytChanged(focus) {
@@ -1317,35 +1338,35 @@
1317
1338
  validate: validate || function () { return null; },
1318
1339
  onConfirm: function (v) { App.back(); onConfirm(('' + v).trim()); } }); // (back on Settings, then redrawn on the change)
1319
1340
  }
1320
- var YT_SOURCE_HINT = 'A channel (like @ScreenJunkies, or its link), a playlist link, or words to search YouTube for (like “honest trailers”).';
1341
+ var YT_SOURCE_HINT = U.t('A channel (like @ScreenJunkies, or its link), a playlist link, or words to search YouTube for (like “honest trailers”).');
1321
1342
  // YouTubio's catalogs as yours (its own feeds need its sign-in: left out), then its
1322
1343
  // addon can go.
1323
1344
  function copyFrom(y) {
1324
1345
  var info = YouTube.fromYouTubio(y.url);
1325
- confirm('Copy ' + info.list.length + ' catalog' + (info.list.length === 1 ? '' : 's') + ' from YouTubio (' + y.host + ') to your YouTube?' +
1326
- (info.left ? ' ' + info.left + ' of its own (subscriptions, its search…) need its sign-in or are YouTube in Search already: left out.' : ''), 'Copy', function () {
1346
+ confirm(U.tn(info.list.length, 'Copy {n} catalog from YouTubio ({host}) to your YouTube?', 'Copy {n} catalogs from YouTubio ({host}) to your YouTube?', { host: y.host }) +
1347
+ (info.left ? ' ' + U.t('{n} of its own (subscriptions, its search…) need its sign-in or are YouTube in Search already: left out.', { n: info.left }) : ''), U.t('Copy'), function () {
1327
1348
  var r = YouTube.copyYouTubio(y.url);
1328
1349
  ytChanged(OPT('copy'));
1329
- U.toast(r.added + ' catalog' + (r.added === 1 ? '' : 's') + ' copied' + (r.already ? ', ' + r.already + ' you had already' : ''), 3500);
1350
+ U.toast(U.tn(r.added, '{n} catalog copied', '{n} catalogs copied') + (r.already ? ', ' + U.t('{n} you had already', { n: r.already }) : ''), 3500);
1330
1351
  setTimeout(function () {
1331
- confirm('Remove the YouTubio addon? Its catalogs are in your YouTube now.', 'Remove', function () {
1352
+ confirm(U.t('Remove the YouTubio addon? Its catalogs are in your YouTube now.'), U.t('Remove'), function () {
1332
1353
  Stremio.removeAddon(y.url);
1333
1354
  refreshAddonRows();
1334
1355
  ytChanged(null);
1335
- U.toast('YouTubio removed');
1356
+ U.toast(U.t('YouTubio removed'));
1336
1357
  });
1337
1358
  }, 400);
1338
1359
  });
1339
1360
  }
1340
1361
  function OPT(name) { return { id: 'opt', ctl: name }; } // (a settings row, to come back to)
1341
1362
  function optRow(node, name) { node.setAttribute('data-pl', 'opt'); node.setAttribute('data-ctl', name); return node; }
1342
- function sbModeShort(cat, mode) { return mode === 'show' && (cat === 'poi_highlight' || cat === 'exclusive_access') ? 'On' : YouTube.SB_MODE_NAMES[mode].split(' (')[0]; }
1363
+ function sbModeShort(cat, mode) { return mode === 'show' && (cat === 'poi_highlight' || cat === 'exclusive_access') ? U.t('On') : YouTube.SB_MODE_NAMES[mode].split(' (')[0]; }
1343
1364
  // SponsorBlock sections: each, and what's done with it.
1344
1365
  function sbSections(focusCat) {
1345
1366
  var modes = YouTube.sbModes();
1346
- pickList('SponsorBlock sections', YouTube.SB_CATS.map(function (k) { return [k, YouTube.SB_NAMES[k] + ' · ' + sbModeShort(k, modes[k])]; }), focusCat || null, function (cat) {
1347
- var names = cat === 'poi_highlight' ? { show: 'On: “◆ Highlight” on the UP bar goes to it', off: 'Off' }
1348
- : cat === 'exclusive_access' ? { show: 'On: a note when the video starts', off: 'Off' } : YouTube.SB_MODE_NAMES;
1367
+ pickList(U.t('SponsorBlock sections'), YouTube.SB_CATS.map(function (k) { return [k, YouTube.SB_NAMES[k] + ' · ' + sbModeShort(k, modes[k])]; }), focusCat || null, function (cat) {
1368
+ var names = cat === 'poi_highlight' ? { show: U.t('On: “◆ Highlight” on the UP bar goes to it'), off: U.t('Off') }
1369
+ : cat === 'exclusive_access' ? { show: U.t('On: a note when the video starts'), off: U.t('Off') } : YouTube.SB_MODE_NAMES;
1349
1370
  pickList(YouTube.SB_NAMES[cat], YouTube.sbModesFor(cat).map(function (m) { return [m, names[m]]; }), modes[cat], function (m) {
1350
1371
  YouTube.setSbMode(cat, m);
1351
1372
  ytChanged(OPT('sbcats'));
@@ -1354,66 +1375,66 @@
1354
1375
  });
1355
1376
  }
1356
1377
  function ytActions(x) {
1357
- var opts = [['rename', 'Rename · ' + x.name], ['src', 'Source · ' + x.src.replace(/^search:/i, '')],
1358
- ['kind', 'Search type · ' + YouTube.KIND_NAMES[x.kind]], ['sort', 'Sort order · ' + YouTube.SORT_NAMES[x.sort]],
1359
- ['type', 'Type · ' + x.type], ['off', x.off ? 'Turn on' : 'Turn off'], ['remove', 'Remove']];
1378
+ var opts = [['rename', U.t('Rename') + ' · ' + x.name], ['src', U.t('Source') + ' · ' + x.src.replace(/^search:/i, '')],
1379
+ ['kind', U.t('Search type') + ' · ' + YouTube.KIND_NAMES[x.kind]], ['sort', U.t('Sort order') + ' · ' + YouTube.SORT_NAMES[x.sort]],
1380
+ ['type', U.t('Type') + ' · ' + x.type], ['off', x.off ? U.t('Turn on') : U.t('Turn off')], ['remove', U.t('Remove')]];
1360
1381
  pickList(x.name, opts, null, function (a) {
1361
1382
  var focus = { id: x.id, ctl: 'item' };
1362
1383
  if (a === 'rename') {
1363
- ytEntry('Rename YouTube catalog', 'Its name on Home and in Discover.', x.name, x.name,
1364
- function (v) { return ('' + v).trim() ? null : 'Type a name'; }, function (v) { YouTube.update(x.id, { name: v }); ytChanged(focus); });
1384
+ ytEntry(U.t('Rename YouTube catalog'), U.t('Its name on Home and in Discover.'), x.name, x.name,
1385
+ function (v) { return ('' + v).trim() ? null : U.t('Type a name'); }, function (v) { YouTube.update(x.id, { name: v }); ytChanged(focus); });
1365
1386
  } else if (a === 'src') {
1366
- ytEntry('YouTube catalog source', YT_SOURCE_HINT, x.src.replace(/^search:/i, ''), '@channel, a playlist link, or words',
1367
- function (v) { return ('' + v).trim() ? null : 'Type a channel, a playlist or words'; }, function (v) { YouTube.update(x.id, { src: v }); ytChanged(focus); });
1387
+ ytEntry(U.t('YouTube catalog source'), YT_SOURCE_HINT, x.src.replace(/^search:/i, ''), U.t('@channel, a playlist link, or words'),
1388
+ function (v) { return ('' + v).trim() ? null : U.t('Type a channel, a playlist or words'); }, function (v) { YouTube.update(x.id, { src: v }); ytChanged(focus); });
1368
1389
  } else if (a === 'kind') {
1369
- pickList('Search type', YouTube.KINDS.map(function (k) { return [k, YouTube.KIND_NAMES[k]]; }), x.kind, function (k) { YouTube.update(x.id, { kind: k }); ytChanged(focus); });
1390
+ pickList(U.t('Search type'), YouTube.KINDS.map(function (k) { return [k, YouTube.KIND_NAMES[k]]; }), x.kind, function (k) { YouTube.update(x.id, { kind: k }); ytChanged(focus); });
1370
1391
  } else if (a === 'sort') {
1371
- pickList('Sort order (searches)', YouTube.SORTS.map(function (k) { return [k, YouTube.SORT_NAMES[k]]; }), x.sort, function (k) { YouTube.update(x.id, { sort: k }); ytChanged(focus); });
1392
+ pickList(U.t('Sort order (searches)'), YouTube.SORTS.map(function (k) { return [k, YouTube.SORT_NAMES[k]]; }), x.sort, function (k) { YouTube.update(x.id, { sort: k }); ytChanged(focus); });
1372
1393
  } else if (a === 'type') {
1373
- ytEntry('YouTube catalog type', 'Where it\'s listed: its Home tab and Discover type, like “Podcasts”. Leave it empty for “YouTube”.', x.type, 'YouTube',
1394
+ ytEntry(U.t('YouTube catalog type'), U.t('Where it\'s listed: its Home tab and Discover type, like “Podcasts”. Leave it empty for “YouTube”.'), x.type, 'YouTube',
1374
1395
  null, function (v) { YouTube.update(x.id, { type: v || 'YouTube' }); ytChanged(focus); });
1375
1396
  } else if (a === 'off') {
1376
1397
  YouTube.update(x.id, { off: !x.off }); ytChanged(focus);
1377
1398
  } else if (a === 'remove') {
1378
- confirm('Remove the YouTube catalog “' + x.name + '”?', 'Remove', function () { YouTube.remove(x.id); ytChanged(null); });
1399
+ confirm(U.t('Remove the YouTube catalog “{name}”?', { name: x.name }), U.t('Remove'), function () { YouTube.remove(x.id); ytChanged(null); });
1379
1400
  }
1380
1401
  });
1381
1402
  }
1382
1403
  function settingsYouTube(wrap) {
1383
1404
  wrap.appendChild(U.el('h2', null, 'YouTube'));
1384
- if (typeof YouTube === 'undefined') { wrap.appendChild(U.el('div', 'hint', 'Not available here.')); focusSettings(); return; }
1405
+ if (typeof YouTube === 'undefined') { wrap.appendChild(U.el('div', 'hint', U.t('Not available here.'))); focusSettings(); return; }
1385
1406
  var on = YouTube.searchOn();
1386
1407
  var srch = U.el('div', 'addon-item focusable cfg-row');
1387
- srch.appendChild(U.el('div', 'a-name', 'YouTube in Search: ' + (on ? 'On' : 'Off')));
1388
- srch.appendChild(U.el('div', 'a-url', (on ? 'Search shows YouTube videos and channels (as rows: YouTube · Videos, YouTube · Channels)' : 'Search leaves YouTube out') + ' · OK to turn ' + (on ? 'off' : 'on')));
1408
+ srch.appendChild(U.el('div', 'a-name', U.t('YouTube in Search:') + ' ' + (on ? U.t('On') : U.t('Off'))));
1409
+ srch.appendChild(U.el('div', 'a-url', (on ? U.t('Search shows YouTube videos and channels (as rows: YouTube · Videos, YouTube · Channels)') : U.t('Search leaves YouTube out')) + ' · ' + (on ? U.t('OK to turn off') : U.t('OK to turn on'))));
1389
1410
  srch.__onselect = function () { YouTube.setSearch(!on); ytChanged(OPT('search')); };
1390
1411
  wrap.appendChild(optRow(srch, 'search'));
1391
1412
  var orig = YouTube.originalTitles(), tRow = U.el('div', 'addon-item focusable cfg-row');
1392
- tRow.appendChild(U.el('div', 'a-name', 'Video titles: ' + (orig ? 'Original' : 'English')));
1393
- tRow.appendChild(U.el('div', 'a-url', (orig ? 'In the language they were uploaded in' : 'In English where YouTube has a translation (the uploader\'s, or its own)') + ' · OK for ' + (orig ? 'English' : 'the original')));
1413
+ tRow.appendChild(U.el('div', 'a-name', U.t('Video titles:') + ' ' + (orig ? U.t('Original') : U.t('English'))));
1414
+ tRow.appendChild(U.el('div', 'a-url', (orig ? U.t('In the language they were uploaded in') : U.t('In English where YouTube has a translation (the uploader\'s, or its own)')) + ' · ' + (orig ? U.t('OK for English') : U.t('OK for the original'))));
1394
1415
  tRow.__onselect = function () { YouTube.setOriginalTitles(!orig); ytChanged(OPT('titles')); };
1395
1416
  wrap.appendChild(optRow(tRow, 'titles'));
1396
1417
 
1397
1418
  // SponsorBlock (sections viewers marked) and DeArrow (titles / thumbnails they wrote)
1398
1419
  var sb = YouTube.sbOn(), modes = YouTube.sbModes();
1399
1420
  var sbRow = U.el('div', 'addon-item focusable cfg-row');
1400
- sbRow.appendChild(U.el('div', 'a-name', 'SponsorBlock: ' + (sb ? 'On' : 'Off')));
1401
- sbRow.appendChild(U.el('div', 'a-url', (sb ? 'Sponsors, self-promotion and other sections other viewers marked in a video: skipped, offered or shown on the bar, as set below' : 'Videos play as they are') + ' · OK to turn ' + (sb ? 'off' : 'on')));
1421
+ sbRow.appendChild(U.el('div', 'a-name', 'SponsorBlock: ' + (sb ? U.t('On') : U.t('Off'))));
1422
+ sbRow.appendChild(U.el('div', 'a-url', (sb ? U.t('Sponsors, self-promotion and other sections other viewers marked in a video: skipped, offered or shown on the bar, as set below') : U.t('Videos play as they are')) + ' · ' + (sb ? U.t('OK to turn off') : U.t('OK to turn on'))));
1402
1423
  sbRow.__onselect = function () { YouTube.setSbOn(!sb); ytChanged(OPT('sb')); };
1403
1424
  wrap.appendChild(optRow(sbRow, 'sb'));
1404
1425
  if (sb) {
1405
1426
  var cats = U.el('div', 'addon-item focusable cfg-row');
1406
- cats.appendChild(U.el('div', 'a-name', 'SponsorBlock sections'));
1407
- cats.appendChild(U.el('div', 'a-url', YouTube.SB_CATS.filter(function (k) { return modes[k] !== 'off'; }).map(function (k) { return YouTube.SB_NAMES[k] + ': ' + sbModeShort(k, modes[k]); }).join(' · ') || 'All off'));
1427
+ cats.appendChild(U.el('div', 'a-name', U.t('SponsorBlock sections')));
1428
+ cats.appendChild(U.el('div', 'a-url', YouTube.SB_CATS.filter(function (k) { return modes[k] !== 'off'; }).map(function (k) { return YouTube.SB_NAMES[k] + ': ' + sbModeShort(k, modes[k]); }).join(' · ') || U.t('All off')));
1408
1429
  cats.__onselect = function () { sbSections(); };
1409
1430
  wrap.appendChild(optRow(cats, 'sbcats'));
1410
1431
  }
1411
1432
  var da = YouTube.dearrow();
1412
- [['titles', 'DeArrow titles', 'Titles other viewers rewrote to say what a video is (the original on its page)', 'YouTube\'s titles'],
1413
- ['thumbs', 'DeArrow thumbnails', 'A still from the video in place of a clickbait thumbnail, where viewers chose one', 'YouTube\'s thumbnails']].forEach(function (d) {
1433
+ [['titles', U.t('DeArrow titles'), U.t('Titles other viewers rewrote to say what a video is (the original on its page)'), U.t('YouTube\'s titles')],
1434
+ ['thumbs', U.t('DeArrow thumbnails'), U.t('A still from the video in place of a clickbait thumbnail, where viewers chose one'), U.t('YouTube\'s thumbnails')]].forEach(function (d) {
1414
1435
  var onD = da[d[0]], r = U.el('div', 'addon-item focusable cfg-row');
1415
- r.appendChild(U.el('div', 'a-name', d[1] + ': ' + (onD ? 'On' : 'Off')));
1416
- r.appendChild(U.el('div', 'a-url', (onD ? d[2] : d[3]) + ' · OK to turn ' + (onD ? 'off' : 'on')));
1436
+ r.appendChild(U.el('div', 'a-name', d[1] + ': ' + (onD ? U.t('On') : U.t('Off'))));
1437
+ r.appendChild(U.el('div', 'a-url', (onD ? d[2] : d[3]) + ' · ' + (onD ? U.t('OK to turn off') : U.t('OK to turn on'))));
1417
1438
  r.__onselect = function () { var p = {}; p[d[0]] = !onD; YouTube.setDearrow(p); ytChanged(OPT('da' + d[0])); };
1418
1439
  wrap.appendChild(optRow(r, 'da' + d[0]));
1419
1440
  });
@@ -1425,7 +1446,7 @@
1425
1446
  function ctl(node, name) { node.setAttribute('data-pl', x.id); node.setAttribute('data-ctl', name); return node; }
1426
1447
  var btns = orderButtons(function (dir, name) { if (YouTube.move(x.id, dir)) { ytChanged({ id: x.id, ctl: name }); } }, ctl);
1427
1448
  var item = ctl(U.el('div', 'addon-item focusable playlist-item yt-catalog'), 'item');
1428
- item.appendChild(U.el('div', 'a-name', x.name + (x.off ? ' (off)' : '')));
1449
+ item.appendChild(U.el('div', 'a-name', x.name + (x.off ? ' ' + U.t('(off)') : '')));
1429
1450
  item.appendChild(U.el('div', 'a-url', ytDescribe(x)));
1430
1451
  item.__onselect = function () { ytActions(x); };
1431
1452
  btns.forEach(function (b) { frow.appendChild(b); }); frow.appendChild(item);
@@ -1433,13 +1454,13 @@
1433
1454
  });
1434
1455
 
1435
1456
  var add = U.el('div', 'addon-item focusable add-row');
1436
- add.appendChild(U.el('div', 'a-name', '+ Add catalog'));
1437
- add.appendChild(U.el('div', 'a-url', 'A channel, a playlist or a search (or hold OK on a channel / playlist wherever it\'s shown)'));
1457
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add catalog')));
1458
+ add.appendChild(U.el('div', 'a-url', U.t('A channel, a playlist or a search (or hold OK on a channel / playlist wherever it\'s shown)')));
1438
1459
  add.__onselect = function () {
1439
- ytEntry('Add YouTube catalog', YT_SOURCE_HINT, '', '@channel, a playlist link, or words', function (v) { return ('' + v).trim() ? null : 'Type a channel, a playlist or words'; }, function (src) {
1460
+ ytEntry(U.t('Add YouTube catalog'), YT_SOURCE_HINT, '', U.t('@channel, a playlist link, or words'), function (v) { return ('' + v).trim() ? null : U.t('Type a channel, a playlist or words'); }, function (src) {
1440
1461
  var id = YouTube.add({ src: src });
1441
- if (!id) { U.toast('Couldn\'t add it (40 catalogs at most)'); return; }
1442
- U.toast('Added: OK on it to rename it or change what it lists', 3500);
1462
+ if (!id) { U.toast(U.t('Couldn\'t add it (40 catalogs at most)')); return; }
1463
+ U.toast(U.t('Added: OK on it to rename it or change what it lists'), 3500);
1443
1464
  ytChanged({ id: id, ctl: 'item' });
1444
1465
  });
1445
1466
  };
@@ -1447,11 +1468,11 @@
1447
1468
  var ytb = YouTube.youTubioAddons();
1448
1469
  if (ytb.length) { // (a YouTubio addon installed: its catalogs can come over)
1449
1470
  var copy = optRow(U.el('div', 'addon-item focusable add-row'), 'copy');
1450
- copy.appendChild(U.el('div', 'a-name', '+ Copy from YouTubio'));
1451
- copy.appendChild(U.el('div', 'a-url', ytb.map(function (y) { return y.host + ': ' + y.count + ' catalog' + (y.count === 1 ? '' : 's'); }).join(' · ')));
1471
+ copy.appendChild(U.el('div', 'a-name', U.t('+ Copy from YouTubio')));
1472
+ copy.appendChild(U.el('div', 'a-url', ytb.map(function (y) { return y.host + ': ' + U.tn(y.count, '{n} catalog', '{n} catalogs'); }).join(' · ')));
1452
1473
  copy.__onselect = function () {
1453
1474
  if (ytb.length === 1) { copyFrom(ytb[0]); return; }
1454
- pickList('Copy from which YouTubio?', ytb.map(function (y, i) { return ['' + i, y.host + ' · ' + y.count + ' catalogs · addon ' + (i + 1)]; }), null, function (i) { copyFrom(ytb[+i]); });
1475
+ pickList(U.t('Copy from which YouTubio?'), ytb.map(function (y, i) { return ['' + i, y.host + ' · ' + U.tn(y.count, '{n} catalog', '{n} catalogs') + ' · ' + U.t('addon {n}', { n: i + 1 })]; }), null, function (i) { copyFrom(ytb[+i]); });
1455
1476
  };
1456
1477
  wrap.appendChild(copy);
1457
1478
  }
@@ -1473,24 +1494,24 @@
1473
1494
  var val = Stremio.getIntegrations()[key] || '';
1474
1495
  var r = U.el('div', 'addon-item focusable');
1475
1496
  r.appendChild(U.el('div', 'a-name', title));
1476
- r.appendChild(U.el('div', 'a-url', val ? ('Set — ' + maskKey(val)) : 'Not set — press OK to enter'));
1497
+ r.appendChild(U.el('div', 'a-url', val ? U.t('Set — {key}', { key: maskKey(val) }) : U.t('Not set — press OK to enter')));
1477
1498
  r.__onselect = function () {
1478
1499
  App.openEntry({
1479
1500
  title: title,
1480
- hint: 'Paste your key, then Confirm. Use Validate to test it. Leave blank and Confirm to clear.',
1501
+ hint: U.t('Paste your key, then Confirm. Use Validate to test it. Leave blank and Confirm to clear.'),
1481
1502
  value: val, placeholder: placeholder, validator: validator,
1482
- onConfirm: function (v) { Stremio.setIntegration(key, v); U.toast(v ? 'Saved' : 'Cleared'); App.back(); renderSettings(); }
1503
+ onConfirm: function (v) { Stremio.setIntegration(key, v); U.toast(v ? U.t('Saved') : U.t('Cleared')); App.back(); renderSettings(); }
1483
1504
  });
1484
1505
  };
1485
1506
  return r;
1486
1507
  }
1487
1508
 
1488
1509
  function settingsIntegrations(wrap) {
1489
- wrap.appendChild(U.el('h2', null, 'Integrations'));
1510
+ wrap.appendChild(U.el('h2', null, U.t('Integrations')));
1490
1511
  if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
1491
- wrap.appendChild(keyRow('OMDb API key', 'omdb', 'OMDb API key', Stremio.omdbValidate));
1492
- wrap.appendChild(keyRow('TMDB API key (v3)', 'tmdb', 'TMDB v3 API key', Stremio.tmdbValidate));
1493
- wrap.appendChild(keyRow('MDBList API key', 'mdblist', 'MDBList API key', Stremio.mdblistValidate));
1512
+ wrap.appendChild(keyRow(U.t('OMDb API key'), 'omdb', U.t('OMDb API key'), Stremio.omdbValidate));
1513
+ wrap.appendChild(keyRow(U.t('TMDB API key (v3)'), 'tmdb', U.t('TMDB v3 API key'), Stremio.tmdbValidate));
1514
+ wrap.appendChild(keyRow(U.t('MDBList API key'), 'mdblist', U.t('MDBList API key'), Stremio.mdblistValidate));
1494
1515
  if (Stremio.autoWatchRegion) { wrap.appendChild(regionRow()); }
1495
1516
 
1496
1517
  // Trakt: your account (StremioK is the Trakt app: nothing to set up)
@@ -1498,45 +1519,44 @@
1498
1519
  wrap.appendChild(U.el('h2', null, 'Trakt'));
1499
1520
  wrap.appendChild(traktAccountRow());
1500
1521
  if (Trakt.connectStatus().connected) { wrap.appendChild(traktSyncRow()); }
1501
- wrap.appendChild(U.el('div', 'hint', 'Connect your Trakt account (a free one will do): the TV shows a code to enter on Trakt\'s site. ' +
1502
- 'Your watched marks and Continue Watching then sync with Trakt.'));
1522
+ wrap.appendChild(U.el('div', 'hint', U.t('Connect your Trakt account (a free one will do): the TV shows a code to enter on Trakt\'s site. Your watched marks and Continue Watching then sync with Trakt.')));
1503
1523
  }
1504
1524
 
1505
1525
  // Your Stremio account, kept in step (js/stremio-sync.js)
1506
1526
  if (typeof StremioSync !== 'undefined' && typeof StremioAccount !== 'undefined') {
1507
- wrap.appendChild(U.el('h2', null, 'Stremio account'));
1527
+ wrap.appendChild(U.el('h2', null, U.t('Stremio account')));
1508
1528
  wrap.appendChild(stremioAccountRow());
1509
- wrap.appendChild(U.el('div', 'hint', 'Connect your Stremio account (sign in on your phone): its Continue Watching, watched marks and Library then sync with StremioK, both ways.'));
1529
+ wrap.appendChild(U.el('div', 'hint', U.t('Connect your Stremio account (sign in on your phone): its Continue Watching, watched marks and Library then sync with StremioK, both ways.')));
1510
1530
  }
1511
1531
 
1512
1532
  wrap.appendChild(U.el('div', 'hint',
1513
- 'Keys are stored on this TV only. OMDb gives real IMDb per-episode ratings (used first when set); TMDB adds episode images & ratings.'));
1533
+ U.t('Keys are stored on this TV only. OMDb gives real IMDb per-episode ratings (used first when set); TMDB adds episode images & ratings.')));
1514
1534
  focusSettings();
1515
1535
  }
1516
1536
 
1517
1537
  // The country TMDB's "where to watch" services are for (a title's sources). Automatic:
1518
1538
  // the TV's language region, which a language-only setting ("en") doesn't have.
1519
- var WATCH_REGIONS = [['AR', 'Argentina'], ['AU', 'Australia'], ['AT', 'Austria'], ['BE', 'Belgium'], ['BR', 'Brazil'],
1520
- ['BG', 'Bulgaria'], ['CA', 'Canada'], ['CL', 'Chile'], ['CO', 'Colombia'], ['CZ', 'Czech Republic'], ['DK', 'Denmark'],
1521
- ['EC', 'Ecuador'], ['EG', 'Egypt'], ['EE', 'Estonia'], ['FI', 'Finland'], ['FR', 'France'], ['DE', 'Germany'],
1522
- ['GR', 'Greece'], ['HK', 'Hong Kong'], ['HU', 'Hungary'], ['IS', 'Iceland'], ['IN', 'India'], ['ID', 'Indonesia'],
1523
- ['IE', 'Ireland'], ['IL', 'Israel'], ['IT', 'Italy'], ['JP', 'Japan'], ['LV', 'Latvia'], ['LT', 'Lithuania'],
1524
- ['MY', 'Malaysia'], ['MX', 'Mexico'], ['NL', 'Netherlands'], ['NZ', 'New Zealand'], ['NO', 'Norway'], ['PE', 'Peru'],
1525
- ['PH', 'Philippines'], ['PL', 'Poland'], ['PT', 'Portugal'], ['RO', 'Romania'], ['SA', 'Saudi Arabia'],
1526
- ['SG', 'Singapore'], ['SK', 'Slovakia'], ['ZA', 'South Africa'], ['KR', 'South Korea'], ['ES', 'Spain'],
1527
- ['SE', 'Sweden'], ['CH', 'Switzerland'], ['TW', 'Taiwan'], ['TH', 'Thailand'], ['TR', 'Turkey'], ['UA', 'Ukraine'],
1528
- ['AE', 'United Arab Emirates'], ['GB', 'United Kingdom'], ['US', 'United States'], ['VE', 'Venezuela']];
1539
+ var WATCH_REGIONS = [['AR', U.t('Argentina')], ['AU', U.t('Australia')], ['AT', U.t('Austria')], ['BE', U.t('Belgium')], ['BR', U.t('Brazil')],
1540
+ ['BG', U.t('Bulgaria')], ['CA', U.t('Canada')], ['CL', U.t('Chile')], ['CO', U.t('Colombia')], ['CZ', U.t('Czech Republic')], ['DK', U.t('Denmark')],
1541
+ ['EC', U.t('Ecuador')], ['EG', U.t('Egypt')], ['EE', U.t('Estonia')], ['FI', U.t('Finland')], ['FR', U.t('France')], ['DE', U.t('Germany')],
1542
+ ['GR', U.t('Greece')], ['HK', U.t('Hong Kong')], ['HU', U.t('Hungary')], ['IS', U.t('Iceland')], ['IN', U.t('India')], ['ID', U.t('Indonesia')],
1543
+ ['IE', U.t('Ireland')], ['IL', U.t('Israel')], ['IT', U.t('Italy')], ['JP', U.t('Japan')], ['LV', U.t('Latvia')], ['LT', U.t('Lithuania')],
1544
+ ['MY', U.t('Malaysia')], ['MX', U.t('Mexico')], ['NL', U.t('Netherlands')], ['NZ', U.t('New Zealand')], ['NO', U.t('Norway')], ['PE', U.t('Peru')],
1545
+ ['PH', U.t('Philippines')], ['PL', U.t('Poland')], ['PT', U.t('Portugal')], ['RO', U.t('Romania')], ['SA', U.t('Saudi Arabia')],
1546
+ ['SG', U.t('Singapore')], ['SK', U.t('Slovakia')], ['ZA', U.t('South Africa')], ['KR', U.t('South Korea')], ['ES', U.t('Spain')],
1547
+ ['SE', U.t('Sweden')], ['CH', U.t('Switzerland')], ['TW', U.t('Taiwan')], ['TH', U.t('Thailand')], ['TR', U.t('Turkey')], ['UA', U.t('Ukraine')],
1548
+ ['AE', U.t('United Arab Emirates')], ['GB', U.t('United Kingdom')], ['US', U.t('United States')], ['VE', U.t('Venezuela')]];
1529
1549
  function regionRow() {
1530
1550
  var auto = Stremio.autoWatchRegion();
1531
- var list = [['', 'Automatic (' + (labelFor(WATCH_REGIONS, auto) || auto) + ', from the TV\'s language)']].concat(WATCH_REGIONS.map(function (c) { return [c[0], c[1] + ' (' + c[0] + ')']; }));
1551
+ var list = [['', U.t('Automatic ({country}, from the TV\'s language)', { country: labelFor(WATCH_REGIONS, auto) || auto })]].concat(WATCH_REGIONS.map(function (c) { return [c[0], c[1] + ' (' + c[0] + ')']; }));
1532
1552
  var row = U.el('div', 'addon-item focusable cfg-row');
1533
1553
  var name = U.el('div', 'a-name');
1534
- function render() { name.textContent = 'Where to watch: country: ' + labelFor(list, Stremio.getPrefs().watchRegion); }
1554
+ function render() { name.textContent = U.t('Where to watch: country:') + ' ' + labelFor(list, Stremio.getPrefs().watchRegion); }
1535
1555
  render();
1536
1556
  row.appendChild(name);
1537
- row.appendChild(U.el('div', 'a-url', 'The services TMDB lists on a title\'s page are for this country · OK to choose'));
1557
+ row.appendChild(U.el('div', 'a-url', U.t('The services TMDB lists on a title\'s page are for this country · OK to choose')));
1538
1558
  row.__onselect = function () {
1539
- pickList('Where to watch: country', list, Stremio.getPrefs().watchRegion, function (v) { Stremio.setPref('watchRegion', v); render(); });
1559
+ pickList(U.t('Where to watch: country'), list, Stremio.getPrefs().watchRegion, function (v) { Stremio.setPref('watchRegion', v); render(); });
1540
1560
  };
1541
1561
  return row;
1542
1562
  }
@@ -1544,17 +1564,17 @@
1544
1564
  function traktAccountRow() {
1545
1565
  var st = Trakt.connectStatus();
1546
1566
  var r = U.el('div', 'addon-item focusable');
1547
- r.appendChild(U.el('div', 'a-name', 'Trakt account'));
1567
+ r.appendChild(U.el('div', 'a-name', U.t('Trakt account')));
1548
1568
  r.appendChild(U.el('div', 'a-url',
1549
- st.connected && st.reconnect ? ('Trakt needs reconnecting (' + (st.user || 'Trakt') + '): its sign-in no longer works — press OK to connect again')
1550
- : st.connected ? ('Connected as ' + (st.user || 'Trakt') + ' — press OK to disconnect')
1551
- : 'Not connected — press OK to connect'));
1569
+ st.connected && st.reconnect ? U.t('Trakt needs reconnecting ({user}): its sign-in no longer works — press OK to connect again', { user: st.user || 'Trakt' })
1570
+ : st.connected ? U.t('Connected as {user} — press OK to disconnect', { user: st.user || 'Trakt' })
1571
+ : U.t('Not connected — press OK to connect')));
1552
1572
  r.__onselect = function () {
1553
1573
  if (st.connected && st.reconnect) { traktConnect(); return; }
1554
1574
  if (st.connected) {
1555
- confirm('Disconnect Trakt account?', 'Disconnect', function () {
1575
+ confirm(U.t('Disconnect Trakt account?'), U.t('Disconnect'), function () {
1556
1576
  Trakt.disconnect();
1557
- U.toast('Trakt disconnected');
1577
+ U.toast(U.t('Trakt disconnected'));
1558
1578
  markHomeDirty();
1559
1579
  renderSettings();
1560
1580
  });
@@ -1571,22 +1591,22 @@
1571
1591
  var st = Trakt.connectStatus(), r = U.el('div', 'addon-item focusable cfg-row trakt-sync');
1572
1592
  function two(n) { return (n < 10 ? '0' : '') + n; }
1573
1593
  var d = st.lastSync ? new Date(st.lastSync) : null;
1574
- var last = d ? 'Last synced ' + (U.dayLabel ? U.dayLabel(st.lastSync) + ' ' : '') + two(d.getHours()) + ':' + two(d.getMinutes()) : 'Not synced yet';
1594
+ var last = d ? U.t('Last synced {when}', { when: (U.dayLabel ? U.dayLabel(st.lastSync) + ' ' : '') + two(d.getHours()) + ':' + two(d.getMinutes()) }) : U.t('Not synced yet');
1575
1595
  var bits = [last];
1576
- if (st.pending) { bits.push(st.pending + ' change' + (st.pending === 1 ? '' : 's') + ' waiting to reach Trakt'); }
1577
- if (st.failed) { bits.push('⚠ ' + st.failed + ' change' + (st.failed === 1 ? '' : 's') + ' not sent'); }
1578
- r.appendChild(U.el('div', 'a-name', 'Trakt sync: ' + (st.failed ? 'some changes not sent' : st.pending ? 'changes waiting' : 'up to date')));
1579
- r.appendChild(U.el('div', 'a-url', bits.join(' · ') + ' · OK for options'));
1596
+ if (st.pending) { bits.push(U.tn(st.pending, '{n} change waiting to reach Trakt', '{n} changes waiting to reach Trakt')); }
1597
+ if (st.failed) { bits.push('⚠ ' + U.tn(st.failed, '{n} change not sent', '{n} changes not sent')); }
1598
+ r.appendChild(U.el('div', 'a-name', U.t('Trakt sync:') + ' ' + (st.failed ? U.t('some changes not sent') : st.pending ? U.t('changes waiting') : U.t('up to date'))));
1599
+ r.appendChild(U.el('div', 'a-url', bits.join(' · ') + ' · ' + U.t('OK for options')));
1580
1600
  (st.failedItems || []).slice(0, 6).forEach(function (f) {
1581
1601
  r.appendChild(U.el('div', 'a-url', '⚠ ' + f.what.charAt(0).toUpperCase() + f.what.slice(1) + (f.title ? ' · ' + f.title : '') + (f.err ? ' · ' + f.err : '')));
1582
1602
  });
1583
- if ((st.failedItems || []).length > 6) { r.appendChild(U.el('div', 'a-url', 'and ' + (st.failedItems.length - 6) + ' more')); }
1603
+ if ((st.failedItems || []).length > 6) { r.appendChild(U.el('div', 'a-url', U.t('and {n} more', { n: st.failedItems.length - 6 }))); }
1584
1604
  r.__onselect = function () {
1585
- var opts = [['now', st.failed ? 'Sync now (the ' + st.failed + ' not sent too)' : 'Sync now']];
1586
- if (st.failed) { opts.push(['discard', 'Let them go (not sent to Trakt)']); }
1587
- pickList('Trakt sync', opts, null, function (v) {
1588
- if (v === 'now') { Trakt.sendNow(); Trakt.refreshCaches(); U.toast('Syncing with Trakt…'); }
1589
- else if (v === 'discard') { Trakt.discardFailed(); U.toast('Not sent: left out'); }
1605
+ var opts = [['now', st.failed ? U.t('Sync now (the {n} not sent too)', { n: st.failed }) : U.t('Sync now')]];
1606
+ if (st.failed) { opts.push(['discard', U.t('Let them go (not sent to Trakt)')]); }
1607
+ pickList(U.t('Trakt sync'), opts, null, function (v) {
1608
+ if (v === 'now') { Trakt.sendNow(); Trakt.refreshCaches(); U.toast(U.t('Syncing with Trakt…')); }
1609
+ else if (v === 'discard') { Trakt.discardFailed(); U.toast(U.t('Not sent: left out')); }
1590
1610
  setTimeout(renderSettings, 1500);
1591
1611
  });
1592
1612
  };
@@ -1601,21 +1621,21 @@
1601
1621
  var d = st.lastSync ? new Date(st.lastSync) : null;
1602
1622
  var bits = [];
1603
1623
  if (st.connected) {
1604
- bits.push(d ? 'Last synced ' + (U.dayLabel ? U.dayLabel(st.lastSync) + ' ' : '') + two(d.getHours()) + ':' + two(d.getMinutes()) : 'Not synced yet');
1605
- if (st.pending) { bits.push(st.pending + ' change' + (st.pending === 1 ? '' : 's') + ' waiting'); }
1624
+ bits.push(d ? U.t('Last synced {when}', { when: (U.dayLabel ? U.dayLabel(st.lastSync) + ' ' : '') + two(d.getHours()) + ':' + two(d.getMinutes()) }) : U.t('Not synced yet'));
1625
+ if (st.pending) { bits.push(U.tn(st.pending, '{n} change waiting', '{n} changes waiting')); }
1606
1626
  if (st.err) { bits.push('⚠ ' + st.err); }
1607
1627
  }
1608
- r.appendChild(U.el('div', 'a-name', 'Stremio account' + (st.connected && st.user ? ': ' + st.user : '')));
1609
- r.appendChild(U.el('div', 'a-url', st.connected && st.reconnect ? 'Its sign-in no longer works — press OK to connect again'
1610
- : st.connected ? bits.join(' · ') + ' · OK for options' : 'Not connected — press OK to connect'));
1628
+ r.appendChild(U.el('div', 'a-name', U.t('Stremio account') + (st.connected && st.user ? ': ' + st.user : '')));
1629
+ r.appendChild(U.el('div', 'a-url', st.connected && st.reconnect ? U.t('Its sign-in no longer works — press OK to connect again')
1630
+ : st.connected ? bits.join(' · ') + ' · ' + U.t('OK for options') : U.t('Not connected — press OK to connect')));
1611
1631
  r.__onselect = function () {
1612
1632
  if (!st.connected || st.reconnect) { stremioConnect(); return; }
1613
- pickList('Stremio account', [['now', 'Sync now'], ['off', 'Disconnect']], null, function (v) {
1614
- if (v === 'now') { U.toast('Syncing with your Stremio account…'); StremioSync.sync().then(function () { markHomeDirty(); renderSettings(); }); }
1633
+ pickList(U.t('Stremio account'), [['now', U.t('Sync now')], ['off', U.t('Disconnect')]], null, function (v) {
1634
+ if (v === 'now') { U.toast(U.t('Syncing with your Stremio account…')); StremioSync.sync().then(function () { markHomeDirty(); renderSettings(); }); }
1615
1635
  else if (v === 'off') {
1616
- confirm('Disconnect your Stremio account?', 'Disconnect', function () {
1636
+ confirm(U.t('Disconnect your Stremio account?'), U.t('Disconnect'), function () {
1617
1637
  StremioSync.disconnect();
1618
- U.toast('Stremio account disconnected');
1638
+ U.toast(U.t('Stremio account disconnected'));
1619
1639
  markHomeDirty();
1620
1640
  renderSettings();
1621
1641
  });
@@ -1626,13 +1646,13 @@
1626
1646
  }
1627
1647
  // Stremio's sign-in code (a QR code): approved on your phone, the key kept (StremioSync.connect).
1628
1648
  function stremioConnect() {
1629
- stremioSignIn('Connect your Stremio account', function (key, body, gone) {
1649
+ stremioSignIn(U.t('Connect your Stremio account'), function (key, body, gone) {
1630
1650
  U.clear(body);
1631
- body.appendChild(U.el('div', 'tc-line', 'Connecting…'));
1651
+ body.appendChild(U.el('div', 'tc-line', U.t('Connecting…')));
1632
1652
  return StremioSync.connect(key).then(function (user) {
1633
1653
  if (gone()) { return; }
1634
1654
  U.clear(body);
1635
- body.appendChild(U.el('div', 'tc-line', '✓ Connected' + (user ? ' as ' + user : '') + ': syncing'));
1655
+ body.appendChild(U.el('div', 'tc-line', user ? U.t('✓ Connected as {user}: syncing', { user: user }) : U.t('✓ Connected: syncing')));
1636
1656
  markHomeDirty();
1637
1657
  setTimeout(function () { if (isModalOpen()) { onModalClose(null); closeModal(); renderSettings(); } }, 1500);
1638
1658
  });
@@ -1645,12 +1665,12 @@
1645
1665
  if (existing) { existing.parentNode.removeChild(existing); }
1646
1666
  var overlay = U.el('div', 'modal-overlay');
1647
1667
  var box = U.el('div', 'modal-box');
1648
- box.appendChild(U.el('div', 'modal-msg', 'Connect Trakt'));
1668
+ box.appendChild(U.el('div', 'modal-msg', U.t('Connect Trakt')));
1649
1669
  var body = U.el('div', 'trakt-connect');
1650
- body.appendChild(U.el('div', 'tc-line', 'Starting…'));
1670
+ body.appendChild(U.el('div', 'tc-line', U.t('Starting…')));
1651
1671
  box.appendChild(body);
1652
1672
  var row = U.el('div', 'modal-row');
1653
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
1673
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
1654
1674
  cancel.__onselect = function () { closeModal(); };
1655
1675
  row.appendChild(cancel);
1656
1676
  box.appendChild(row);
@@ -1667,49 +1687,128 @@
1667
1687
  var qrText = /\/activate\/?$/.test(url) ? url.replace(/\/+$/, '') + '/' + encodeURIComponent(code) : url;
1668
1688
  var qrSpot = U.el('div', 'tc-qr-spot');
1669
1689
  body.appendChild(qrSpot);
1670
- var goTo = body.appendChild(U.el('div', 'tc-line', 'On your phone or computer, go to:'));
1690
+ var goTo = body.appendChild(U.el('div', 'tc-line', U.t('On your phone or computer, go to:')));
1671
1691
  // (the QR library is loaded the first time this box opens: nothing else uses it)
1672
1692
  (typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
1673
1693
  var qr = U.qrCanvas(qrText, 8);
1674
1694
  if (!qr || !qrSpot.parentNode) { return; }
1675
1695
  qr.className = 'tc-qr';
1676
- qrSpot.appendChild(U.el('div', 'tc-line', 'Scan with your phone:'));
1696
+ qrSpot.appendChild(U.el('div', 'tc-line', U.t('Scan with your phone:')));
1677
1697
  qrSpot.appendChild(qr);
1678
- goTo.textContent = 'or go to';
1698
+ goTo.textContent = U.t('or go to');
1679
1699
  }, function () {});
1680
1700
  body.appendChild(U.el('div', 'tc-url', url));
1681
- body.appendChild(U.el('div', 'tc-line', 'and enter this code:'));
1701
+ body.appendChild(U.el('div', 'tc-line', U.t('and enter this code:')));
1682
1702
  body.appendChild(U.el('div', 'tc-code', code));
1683
- body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to authorize…'));
1703
+ body.appendChild(U.el('div', 'tc-line small', U.t('Waiting for you to authorize…')));
1684
1704
  },
1685
1705
  onSuccess: function (user) {
1686
1706
  U.clear(body);
1687
- body.appendChild(U.el('div', 'tc-line', '✓ Connected as ' + user));
1707
+ body.appendChild(U.el('div', 'tc-line', U.t('✓ Connected as {user}', { user: user })));
1688
1708
  markHomeDirty();
1689
1709
  setTimeout(function () { if (isModalOpen()) { onModalClose(null); closeModal(); renderSettings(); } }, 1500);
1690
1710
  },
1691
1711
  onError: function (msg) {
1692
1712
  U.clear(body);
1693
- body.appendChild(U.el('div', 'tc-line', msg || 'Could not connect.'));
1713
+ body.appendChild(U.el('div', 'tc-line', msg || U.t('Could not connect.')));
1694
1714
  }
1695
1715
  });
1696
1716
  onModalClose(cancelFlow); // canceling the overlay stops polling
1697
1717
  }
1698
1718
 
1699
1719
  // ---- Media servers: your Jellyfin servers ----
1720
+ // Settings › Content › Nuvio plugins (js/plugins.js): on / off (after a warning), the
1721
+ // repositories you added, each one's plugins on / off. Only on a TV that can run them.
1722
+ function settingsPlugins(wrap) {
1723
+ wrap.appendChild(U.el('h2', null, U.t('Nuvio plugins')));
1724
+ if (typeof Plugins === 'undefined' || !Plugins.supported()) {
1725
+ wrap.appendChild(U.el('div', 'hint', U.t('Nuvio plugins need a 2017 or newer TV and the sideloaded app.')));
1726
+ focusSettings(); return;
1727
+ }
1728
+ var on = Plugins.isEnabled(), focus = null;
1729
+ var sw = U.el('div', 'addon-item focusable cfg-row');
1730
+ sw.appendChild(U.el('div', 'a-name', U.t('Nuvio plugins:') + ' ' + (on ? U.t('On') : U.t('Off'))));
1731
+ sw.appendChild(U.el('div', 'a-url', (on ? U.t('Your plugins look for sources on title pages') : U.t('Off: no plugin runs'))
1732
+ + ' · ' + (on ? U.t('OK to turn off') : U.t('OK to turn on'))));
1733
+ sw.__onselect = function () {
1734
+ _focusChild = 'pl:switch';
1735
+ if (on) { Plugins.setEnabled(false); renderSettings(); return; }
1736
+ confirm(U.t('Nuvio plugins are someone else’s code, run on your TV. StremioK keeps them apart from your settings and files, but they can reach any website, they learn which titles you open, and they’re given your TMDB key. StremioK doesn’t check what they find, and gives no help with any particular plugin. Turn them on?'),
1737
+ U.t('Turn on'), function () { Plugins.setEnabled(true); renderSettings(); });
1738
+ };
1739
+ if (_focusChild === 'pl:switch') { focus = sw; }
1740
+ wrap.appendChild(sw);
1741
+ if (!Stremio.getIntegrations().tmdb) { wrap.appendChild(U.el('div', 'hint', U.t('Plugins look titles up by their TMDB number: add a TMDB key in Settings › Content › Integrations.'))); }
1742
+ if (Plugins.experimental()) { wrap.appendChild(U.el('div', 'hint', U.t('Experimental on this TV: plugins haven’t been tried on its generation yet, and run slower here (one at a time).'))); }
1743
+ else if (Plugins.slower()) { wrap.appendChild(U.el('div', 'hint', U.t('Plugins run slower on this TV than on 2021 and newer ones (one at a time).'))); }
1744
+ var add = U.el('div', 'addon-item focusable cfg-row');
1745
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add a repository')));
1746
+ add.appendChild(U.el('div', 'a-url', U.t('Its address (a manifest.json): its plugins are listed, each off until you turn it on')));
1747
+ add.__onselect = function () {
1748
+ App.openEntry({
1749
+ title: U.t('Nuvio plugins: repository'), hint: U.t('Its address, like https://example.com/plugins/manifest.json. RETURN cancels.'),
1750
+ value: 'https://', placeholder: 'https://example.com/plugins/manifest.json', phone: 'plugins',
1751
+ validate: function (v) { return Plugins.addressProblem(v); },
1752
+ onConfirm: function (url) {
1753
+ App.back();
1754
+ U.spinner(true, U.t('Reading the repository…'));
1755
+ Plugins.addRepo(url).then(function (r) {
1756
+ U.spinner(false);
1757
+ U.toast(U.tn(r.repo.plugins.length, 'Added “{name}”: {n} plugin (off until you turn it on)', 'Added “{name}”: {n} plugins (off until you turn them on)', { name: r.repo.name }), 5000);
1758
+ _focusChild = 'pl:' + r.repo.id;
1759
+ renderSettings();
1760
+ }, function (e) { U.spinner(false); U.toast(U.t('Couldn’t add it: {why}', { why: U.problem(e) }), 6000); });
1761
+ }
1762
+ });
1763
+ };
1764
+ wrap.appendChild(add);
1765
+ Plugins.repos().forEach(function (r) {
1766
+ var row = U.el('div', 'addon-item focusable cfg-row');
1767
+ row.appendChild(U.el('div', 'a-name', '📦 ' + r.name));
1768
+ row.appendChild(U.el('div', 'a-url', r.url + ' · ' + U.tn(r.plugins.length, '{n} plugin', '{n} plugins') + ' · ' + U.t('OK: refresh or remove')));
1769
+ row.__onselect = function () {
1770
+ pickList(r.name, [['refresh', U.t('↻ Refresh')], ['remove', U.t('Remove')]], null, function (v) {
1771
+ _focusChild = 'pl:' + r.id;
1772
+ if (v === 'refresh') {
1773
+ U.spinner(true, U.t('Reading the repository…'));
1774
+ Plugins.refreshRepo(r.id).then(function (x) {
1775
+ U.spinner(false);
1776
+ U.toast(U.t('“{name}”: {added} new, {changed} changed', { name: r.name, added: x.added, changed: x.changed }) + (x.failed ? ' · ' + U.tn(x.failed, '{n} didn’t come (kept as it was)', '{n} didn’t come (kept as they were)') : ''), 5000);
1777
+ renderSettings();
1778
+ }, function (e) { U.spinner(false); U.toast(U.t('Couldn’t refresh it: {why}', { why: U.problem(e) }), 6000); });
1779
+ } else {
1780
+ confirm(U.t('Remove “{name}” and its plugins?', { name: r.name }), U.t('Remove'), function () { Plugins.removeRepo(r.id); renderSettings(); });
1781
+ }
1782
+ });
1783
+ };
1784
+ if (_focusChild === 'pl:' + r.id) { focus = row; }
1785
+ wrap.appendChild(row);
1786
+ r.plugins.forEach(function (p) {
1787
+ var pr = U.el('div', 'addon-item focusable cfg-row');
1788
+ pr.appendChild(U.el('div', 'a-name', ' ' + (p.on ? '✓ ' : '○ ') + p.name + (p.version ? ' ' + p.version : '')));
1789
+ var kinds = p.types.map(function (t) { return t === 'tv' ? U.t('Series') : U.t('Movies'); }).join(', ');
1790
+ pr.appendChild(U.el('div', 'a-url', ' ' + kinds + ' · ' + (p.on ? U.t('On') : U.t('Off')) + ' · ' + (p.on ? U.t('OK to turn off') : U.t('OK to turn on'))));
1791
+ pr.__onselect = function () { _focusChild = 'pp:' + r.id + '.' + p.id; Plugins.setPlugin(r.id, p.id, !p.on); renderSettings(); };
1792
+ if (_focusChild === 'pp:' + r.id + '.' + p.id) { focus = pr; }
1793
+ wrap.appendChild(pr);
1794
+ });
1795
+ });
1796
+ wrap.appendChild(U.el('div', 'hint', U.t('Repositories come only from addresses you add. Their sources show with your addons’ (From: Nuvio plugins). The plugin format is the Nuvio project’s; StremioK isn’t affiliated with it.')));
1797
+ if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
1798
+ }
1700
1799
  function settingsMediaServers(wrap) {
1701
- wrap.appendChild(U.el('h2', null, 'Media servers'));
1800
+ wrap.appendChild(U.el('h2', null, U.t('Media servers')));
1702
1801
  var have = typeof Jellyfin !== 'undefined';
1703
1802
  var add = U.el('div', 'addon-item focusable cfg-row');
1704
- add.appendChild(U.el('div', 'a-name', '+ Add a Jellyfin or Emby server'));
1705
- add.appendChild(U.el('div', 'a-url', 'Its address on your network, then a user name and password, or Jellyfin’s Quick Connect'));
1803
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add a Jellyfin or Emby server')));
1804
+ add.appendChild(U.el('div', 'a-url', U.t('Its address on your network, then a user name and password, or Jellyfin’s Quick Connect')));
1706
1805
  add.__onselect = function () { askJellyfinAddress(''); };
1707
1806
  if (have) { wrap.appendChild(add); }
1708
1807
  var hasPlex = typeof Plex !== 'undefined';
1709
1808
  if (hasPlex) {
1710
1809
  var addPx = U.el('div', 'addon-item focusable cfg-row');
1711
- addPx.appendChild(U.el('div', 'a-name', '+ Add a Plex server'));
1712
- addPx.appendChild(U.el('div', 'a-url', 'A code to enter at plex.tv/link, then which of your servers'));
1810
+ addPx.appendChild(U.el('div', 'a-name', U.t('+ Add a Plex server')));
1811
+ addPx.appendChild(U.el('div', 'a-url', U.t('A code to enter at plex.tv/link, then which of your servers')));
1713
1812
  addPx.__onselect = function () { plexLink(); };
1714
1813
  wrap.appendChild(addPx);
1715
1814
  }
@@ -1720,11 +1819,11 @@
1720
1819
  all.forEach(function (x) {
1721
1820
  var srv = x.srv, mod = x.mod;
1722
1821
  var r = U.el('div', 'addon-item focusable cfg-row'), libs = mod.libraries(srv);
1723
- r.appendChild(U.el('div', 'a-name', srv.name + ' · ' + x.kind + ' ' + srv.version + (srv.off ? ' · Off' : '')));
1724
- r.appendChild(U.el('div', 'a-url', srv.url + (srv.user ? ' · signed in as ' + srv.user : '') + (srv.off ? ' · its rows, sources and watched marks set aside' : libs.length ? ' · ' + libs.map(function (l) { return l.name; }).join(', ') : '')));
1822
+ r.appendChild(U.el('div', 'a-name', srv.name + ' · ' + x.kind + ' ' + srv.version + (srv.off ? ' · ' + U.t('Off') : '')));
1823
+ r.appendChild(U.el('div', 'a-url', srv.url + (srv.user ? ' · ' + U.t('signed in as {user}', { user: srv.user }) : '') + (srv.off ? ' · ' + U.t('its rows, sources and watched marks set aside') : libs.length ? ' · ' + libs.map(function (l) { return l.name; }).join(', ') : '')));
1725
1824
  r.__onselect = function () {
1726
- var opts = srv.off ? [['on', 'Turn on']] : [['off', 'Turn off'], ['reload', 'Reload']];
1727
- pickList(srv.name, opts.concat([['remove', 'Sign out and remove']]), null, function (v) {
1825
+ var opts = srv.off ? [['on', U.t('Turn on')]] : [['off', U.t('Turn off')], ['reload', U.t('Reload')]];
1826
+ pickList(srv.name, opts.concat([['remove', U.t('Sign out and remove')]]), null, function (v) {
1728
1827
  if (v === 'on' || v === 'off') {
1729
1828
  mod.setOn(srv.id, v === 'on');
1730
1829
  markHomeDirty();
@@ -1735,10 +1834,10 @@
1735
1834
  } else if (v === 'reload') {
1736
1835
  mod.reload(srv.id);
1737
1836
  markHomeDirty();
1738
- U.toast('Reading “' + srv.name + '” again…');
1837
+ U.toast(U.t('Reading “{name}” again…', { name: srv.name }));
1739
1838
  setTimeout(function () { if (_settingsSection === 'mediaservers') { renderSettings(); } }, 1500);
1740
1839
  } else if (v === 'remove') {
1741
- confirm('Sign out of “' + srv.name + '” and remove it?', 'Remove', function () { mod.remove(srv.id); markHomeDirty(); renderSettings(); });
1840
+ confirm(U.t('Sign out of “{name}” and remove it?', { name: srv.name }), U.t('Remove'), function () { mod.remove(srv.id); markHomeDirty(); renderSettings(); });
1742
1841
  }
1743
1842
  });
1744
1843
  };
@@ -1746,23 +1845,23 @@
1746
1845
  wrap.appendChild(r);
1747
1846
  });
1748
1847
  if (all.length) {
1749
- wrap.appendChild(subPickRow('Wait for a server', SERVER_WAITS, 'serverWait', {
1848
+ wrap.appendChild(subPickRow(U.t('Wait for a server'), SERVER_WAITS, 'serverWait', {
1750
1849
  get: function () { return { serverWait: '' + Stremio.getPrefs().serverWait }; },
1751
1850
  set: function (cfg) { Stremio.setPref('serverWait', +cfg.serverWait || 0); }
1752
1851
  }));
1753
1852
  }
1754
- wrap.appendChild(U.el('div', 'hint', 'Jellyfin 10.9 or newer, Emby 4.7 or newer, Plex. Their files play as they are (nothing converted), so the TV must play their format.'));
1853
+ wrap.appendChild(U.el('div', 'hint', U.t('Jellyfin 10.9 or newer, Emby 4.7 or newer, Plex. Their files play as they are (nothing converted), so the TV must play their format.')));
1755
1854
  if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
1756
1855
  }
1757
1856
  function askJellyfinAddress(value) {
1758
1857
  App.openEntry({
1759
- title: 'Jellyfin or Emby server: address',
1760
- hint: 'Its address on your network, like http://192.168.0.50:8096. RETURN cancels.',
1858
+ title: U.t('Jellyfin or Emby server: address'),
1859
+ hint: U.t('Its address on your network, like http://192.168.0.50:8096. RETURN cancels.'),
1761
1860
  value: value || 'http://', placeholder: 'http://192.168.0.50:8096', phone: 'jellyfin',
1762
1861
  validate: function (v) { return Jellyfin.addressProblem(v); },
1763
1862
  onConfirm: function (v) {
1764
1863
  App.back();
1765
- U.spinner(true, 'Asking the server…');
1864
+ U.spinner(true, U.t('Asking the server…'));
1766
1865
  Jellyfin.probe(v).then(function (info) { U.spinner(false); if (info.kind === 'emby') { jellyfinPassword(info, ''); } else { jellyfinSignIn(info); } }, function (e) {
1767
1866
  U.spinner(false);
1768
1867
  U.toast(e.message, 6000);
@@ -1776,18 +1875,18 @@
1776
1875
  _settingsSection = 'mediaservers';
1777
1876
  _focusChild = 'jf:' + srv.id;
1778
1877
  renderSettings();
1779
- U.toast('✓ Signed in to “' + srv.name + '”' + (srv.user ? ' as ' + srv.user : ''));
1878
+ U.toast(srv.user ? U.t('✓ Signed in to “{name}” as {user}', { name: srv.name, user: srv.user }) : U.t('✓ Signed in to “{name}”', { name: srv.name }));
1780
1879
  }
1781
1880
  // Plex: its code to enter at plex.tv/link (a QR of the page too), then which server.
1782
1881
  function plexLink() {
1783
1882
  var existing = document.querySelector('.modal-overlay');
1784
1883
  if (existing) { existing.parentNode.removeChild(existing); }
1785
1884
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
1786
- box.appendChild(U.el('div', 'modal-msg', 'Add a Plex server'));
1885
+ box.appendChild(U.el('div', 'modal-msg', U.t('Add a Plex server')));
1787
1886
  var body = U.el('div', 'trakt-connect');
1788
- body.appendChild(U.el('div', 'tc-line', 'Asking Plex for a code…'));
1887
+ body.appendChild(U.el('div', 'tc-line', U.t('Asking Plex for a code…')));
1789
1888
  box.appendChild(body);
1790
- var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
1889
+ var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
1791
1890
  cancel.__onselect = function () { closeModal(); };
1792
1891
  row.appendChild(cancel);
1793
1892
  box.appendChild(row);
@@ -1795,7 +1894,7 @@
1795
1894
  document.body.appendChild(overlay);
1796
1895
  showModal(overlay, cancel);
1797
1896
  function addIt(res) {
1798
- U.spinner(true, 'Finding “' + res.name + '”…');
1897
+ U.spinner(true, U.t('Finding “{name}”…', { name: res.name }));
1799
1898
  Plex.add(res).then(function (srv) { U.spinner(false); jellyfinDone(srv); }, function (e) { U.spinner(false); U.toast(e.message, 8000); });
1800
1899
  }
1801
1900
  var stop = Plex.link({
@@ -1803,24 +1902,24 @@
1803
1902
  U.clear(body);
1804
1903
  var qrSpot = U.el('div', 'tc-qr-spot');
1805
1904
  body.appendChild(qrSpot);
1806
- var goTo = body.appendChild(U.el('div', 'tc-line', 'On your phone or computer, go to:'));
1905
+ var goTo = body.appendChild(U.el('div', 'tc-line', U.t('On your phone or computer, go to:')));
1807
1906
  (typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
1808
1907
  var qr = U.qrCanvas(url, 8);
1809
1908
  if (!qr || !qrSpot.parentNode) { return; }
1810
1909
  qr.className = 'tc-qr';
1811
- qrSpot.appendChild(U.el('div', 'tc-line', 'Scan with your phone:'));
1910
+ qrSpot.appendChild(U.el('div', 'tc-line', U.t('Scan with your phone:')));
1812
1911
  qrSpot.appendChild(qr);
1813
- goTo.textContent = 'or go to';
1912
+ goTo.textContent = U.t('or go to');
1814
1913
  }, function () {});
1815
1914
  body.appendChild(U.el('div', 'tc-url', url.replace(/^https:\/\//, '')));
1816
- body.appendChild(U.el('div', 'tc-line', 'sign in, and enter this code:'));
1915
+ body.appendChild(U.el('div', 'tc-line', U.t('sign in, and enter this code:')));
1817
1916
  body.appendChild(U.el('div', 'tc-code', code));
1818
- body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to enter it…'));
1917
+ body.appendChild(U.el('div', 'tc-line small', U.t('Waiting for you to enter it…')));
1819
1918
  },
1820
1919
  onServers: function (list) {
1821
1920
  if (isModalOpen()) { onModalClose(null); closeModal(); }
1822
1921
  if (list.length === 1) { addIt(list[0]); return; }
1823
- pickList('Which Plex server?', list.map(function (x, i) { return ['' + i, x.name + (x.owned ? '' : ' (shared with you)')]; }), null, function (v) { addIt(list[+v]); });
1922
+ pickList(U.t('Which Plex server?'), list.map(function (x, i) { return ['' + i, x.name + (x.owned ? '' : ' ' + U.t('(shared with you)'))]; }), null, function (v) { addIt(list[+v]); });
1824
1923
  },
1825
1924
  onError: function (msg) { U.clear(body); body.appendChild(U.el('div', 'tc-line', msg)); }
1826
1925
  });
@@ -1831,13 +1930,13 @@
1831
1930
  var existing = document.querySelector('.modal-overlay');
1832
1931
  if (existing) { existing.parentNode.removeChild(existing); }
1833
1932
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
1834
- box.appendChild(U.el('div', 'modal-msg', 'Sign in to “' + info.name + '”'));
1933
+ box.appendChild(U.el('div', 'modal-msg', U.t('Sign in to “{name}”', { name: info.name })));
1835
1934
  var body = U.el('div', 'trakt-connect');
1836
- body.appendChild(U.el('div', 'tc-line', 'Starting Quick Connect…'));
1935
+ body.appendChild(U.el('div', 'tc-line', U.t('Starting Quick Connect…')));
1837
1936
  box.appendChild(body);
1838
1937
  var row = U.el('div', 'modal-row');
1839
- var pw = U.el('div', 'pill focusable modal-btn', 'User name and password');
1840
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
1938
+ var pw = U.el('div', 'pill focusable modal-btn', U.t('User name and password'));
1939
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
1841
1940
  row.appendChild(pw); row.appendChild(cancel);
1842
1941
  box.appendChild(row);
1843
1942
  overlay.appendChild(box);
@@ -1846,9 +1945,9 @@
1846
1945
  var stop = Jellyfin.quickConnect(info, {
1847
1946
  onCode: function (code) {
1848
1947
  U.clear(body);
1849
- body.appendChild(U.el('div', 'tc-line', 'In Jellyfin on your phone or computer, open your profile › Quick Connect, and enter:'));
1948
+ body.appendChild(U.el('div', 'tc-line', U.t('In Jellyfin on your phone or computer, open your profile › Quick Connect, and enter:')));
1850
1949
  body.appendChild(U.el('div', 'tc-code', code));
1851
- body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to enter it…'));
1950
+ body.appendChild(U.el('div', 'tc-line small', U.t('Waiting for you to enter it…')));
1852
1951
  },
1853
1952
  onSuccess: function (srv) { if (isModalOpen()) { onModalClose(null); closeModal(); } jellyfinDone(srv); },
1854
1953
  onError: function (msg) { U.clear(body); body.appendChild(U.el('div', 'tc-line', msg)); }
@@ -1859,16 +1958,16 @@
1859
1958
  }
1860
1959
  function jellyfinPassword(info, user) {
1861
1960
  App.openEntry({
1862
- title: Jellyfin.kindName(info) + ' “' + info.name + '”: user name', hint: 'Your ' + Jellyfin.kindName(info) + ' user name. RETURN cancels.', value: user || '', placeholder: 'user name',
1863
- validate: function (v) { return ('' + v).trim() ? null : 'Your user name'; },
1961
+ title: U.t('{server} “{name}”: user name', { server: Jellyfin.kindName(info), name: info.name }), hint: U.t('Your {server} user name. RETURN cancels.', { server: Jellyfin.kindName(info) }), value: user || '', placeholder: U.t('user name'),
1962
+ validate: function (v) { return ('' + v).trim() ? null : U.t('Your user name'); },
1864
1963
  onConfirm: function (u) {
1865
1964
  App.back();
1866
1965
  App.openEntry({
1867
- title: Jellyfin.kindName(info) + ' “' + info.name + '”: password', hint: 'Its password (not kept: only the sign-in the server gives back). RETURN cancels.', value: '', placeholder: 'password', secret: true,
1966
+ title: U.t('{server} “{name}”: password', { server: Jellyfin.kindName(info), name: info.name }), hint: U.t('Its password (not kept: only the sign-in the server gives back). RETURN cancels.'), value: '', placeholder: U.t('password'), secret: true,
1868
1967
  validate: function () { return null; },
1869
1968
  onConfirm: function (p) {
1870
1969
  App.back();
1871
- U.spinner(true, 'Signing in…');
1970
+ U.spinner(true, U.t('Signing in…'));
1872
1971
  Jellyfin.signIn(info, ('' + u).trim(), p).then(function (srv) { U.spinner(false); jellyfinDone(srv); }, function (e) {
1873
1972
  U.spinner(false);
1874
1973
  U.toast(e.message, 6000);
@@ -1880,71 +1979,71 @@
1880
1979
  }
1881
1980
 
1882
1981
  function settingsSubtitles(wrap) {
1883
- wrap.appendChild(U.el('h2', null, 'Subtitles'));
1884
- wrap.appendChild(subPickRow('Default language', SUB_LANGS, 'lang'));
1885
- wrap.appendChild(subPickRow('Second choice', SUB_LANGS2, 'lang2'));
1886
- wrap.appendChild(subPickRow('Second subtitle (at the top)', SUB_LANGS, 'second'));
1887
- wrap.appendChild(subPickRow('Only my languages', SUB_ONLY, 'only'));
1982
+ wrap.appendChild(U.el('h2', null, U.t('Subtitles')));
1983
+ wrap.appendChild(subPickRow(U.t('Default language'), SUB_LANGS, 'lang'));
1984
+ wrap.appendChild(subPickRow(U.t('Second choice'), SUB_LANGS2, 'lang2'));
1985
+ wrap.appendChild(subPickRow(U.t('Second subtitle (at the top)'), SUB_LANGS, 'second'));
1986
+ wrap.appendChild(subPickRow(U.t('Only my languages'), SUB_ONLY, 'only'));
1888
1987
  // lines to leave out: those with one of your words (a subtitle site's ads, a file's name…)
1889
1988
  var skip = Player.getSubCfg().skip || [];
1890
1989
  var sk = U.el('div', 'addon-item focusable cfg-row');
1891
- sk.appendChild(U.el('div', 'a-name', 'Skip lines with: ' + (skip.length ? skip.join(', ') : 'None')));
1892
- sk.appendChild(U.el('div', 'a-url', 'Press OK to change · a subtitle line with one of these in it isn’t shown (capitals or not)'));
1990
+ sk.appendChild(U.el('div', 'a-name', U.t('Skip lines with:') + ' ' + (skip.length ? skip.join(', ') : U.t('None'))));
1991
+ sk.appendChild(U.el('div', 'a-url', U.t('Press OK to change · a subtitle line with one of these in it isn’t shown (capitals or not)')));
1893
1992
  sk.__onselect = function () {
1894
- App.openEntry({ title: 'Skip subtitle lines with', value: skip.join(', '), placeholder: 'OPENSUBTITLES, .SRT',
1895
- hint: 'Words (or bits of them) separated by commas, capitals or not: lines with one aren’t shown. For example OPENSUBTITLES (ads) and .SRT (file names). Leave it empty for none.',
1993
+ App.openEntry({ title: U.t('Skip subtitle lines with'), value: skip.join(', '), placeholder: U.t('OPENSUBTITLES, .SRT'),
1994
+ hint: U.t('Words (or bits of them) separated by commas, capitals or not: lines with one aren’t shown. For example OPENSUBTITLES (ads) and .SRT (file names). Leave it empty for none.'),
1896
1995
  validate: function () { return null; },
1897
1996
  onConfirm: function (v) { var c = Player.getSubCfg(); c.skip = ('' + v).split(','); Player.setSubCfg(c); App.back(); renderSettings(); } });
1898
1997
  };
1899
1998
  wrap.appendChild(sk);
1900
- var look = sectionRow('Appearance ›', 'Size, color, background, edge, position, font', 'subtitlelook'); // (their own page: settingsSubtitleLook)
1999
+ var look = sectionRow(U.t('Appearance ›'), U.t('Size, color, background, edge, position, font'), 'subtitlelook'); // (their own page: settingsSubtitleLook)
1901
2000
  wrap.appendChild(look);
1902
2001
  if (_focusChild === 'subtitlelook') { _focusChild = null; Focus.setScope(scr('settings'), look); } else { focusSettings(); }
1903
2002
  }
1904
2003
  // Subtitles › Appearance: how subtitles look.
1905
2004
  function settingsSubtitleLook(wrap) {
1906
- wrap.appendChild(U.el('h2', null, 'Subtitle appearance'));
1907
- wrap.appendChild(subPickRow('Size', SUB_SIZES, 'size'));
2005
+ wrap.appendChild(U.el('h2', null, U.t('Subtitle appearance')));
2006
+ wrap.appendChild(subPickRow(U.t('Size'), SUB_SIZES, 'size'));
1908
2007
  // [id, label] for the picker (colors with a swatch)
1909
2008
  function plain(list) { return list.map(function (x) { return [x[0], x[1]]; }); }
1910
- wrap.appendChild(subPickRow('Color', Player.SUB_COLORS.map(function (x) { return [x[0], x[1], null, x[2]]; }), 'color'));
1911
- wrap.appendChild(subPickRow('Background', plain(Player.SUB_BGS), 'bg'));
1912
- wrap.appendChild(subPickRow('Edge', plain(Player.SUB_EDGES), 'edge'));
1913
- wrap.appendChild(subPickRow('Position', plain(Player.SUB_POSITIONS), 'pos'));
1914
- wrap.appendChild(subPickRow('Font', Player.SUB_FONTS, 'font'));
2009
+ wrap.appendChild(subPickRow(U.t('Color'), Player.SUB_COLORS.map(function (x) { return [x[0], x[1], null, x[2]]; }), 'color'));
2010
+ wrap.appendChild(subPickRow(U.t('Background'), plain(Player.SUB_BGS), 'bg'));
2011
+ wrap.appendChild(subPickRow(U.t('Edge'), plain(Player.SUB_EDGES), 'edge'));
2012
+ wrap.appendChild(subPickRow(U.t('Position'), plain(Player.SUB_POSITIONS), 'pos'));
2013
+ wrap.appendChild(subPickRow(U.t('Font'), Player.SUB_FONTS, 'font'));
1915
2014
  focusSettings();
1916
2015
  }
1917
2016
 
1918
2017
  // Skipping: intros and recaps skipped on their own after a countdown (with Cancel), or asked.
1919
- var SKIP_CHOICES = [['0', 'Ask (a Skip button)'], ['5', 'After 5 seconds'], ['10', 'After 10 seconds'], ['15', 'After 15 seconds'], ['30', 'After 30 seconds']];
2018
+ var SKIP_CHOICES = [['0', U.t('Ask (a Skip button)')], ['5', U.t('After 5 seconds')], ['10', U.t('After 10 seconds')], ['15', U.t('After 15 seconds')], ['30', U.t('After 30 seconds')]];
1920
2019
  // Settings › Addons: how long an addon's answer is waited for (an addon that sleeps when
1921
2020
  // unused fails the first time while it wakes up).
1922
- var SERVER_WAITS = [['0', 'Normal (20 s)'], ['45', '45 seconds'], ['90', '90 seconds'], ['180', '180 seconds']]; // (a media server's answer)
1923
- var ADDON_WAITS = [['0', 'Normal (12 s; sources 15, search 25)'], ['20', '20 seconds'], ['30', '30 seconds'], ['45', '45 seconds'], ['60', '60 seconds']];
1924
- var NEXT_CHOICES = [['0', 'Ask'], ['5', 'After 5 seconds'], ['10', 'After 10 seconds'], ['15', 'After 15 seconds'], ['30', 'After 30 seconds']];
2021
+ var SERVER_WAITS = [['0', U.t('Normal (20 s)')], ['45', U.t('45 seconds')], ['90', U.t('90 seconds')], ['180', U.t('180 seconds')]]; // (a media server's answer)
2022
+ var ADDON_WAITS = [['0', U.t('Normal (12 s; sources 15, search 25)')], ['20', U.t('20 seconds')], ['30', U.t('30 seconds')], ['45', U.t('45 seconds')], ['60', U.t('60 seconds')]];
2023
+ var NEXT_CHOICES = [['0', U.t('Ask')], ['5', U.t('After 5 seconds')], ['10', U.t('After 10 seconds')], ['15', U.t('After 15 seconds')], ['30', U.t('After 30 seconds')]];
1925
2024
  // Seeking & buffering: how far LEFT / RIGHT jump; a bigger buffer for slow connections; how
1926
2025
  // often a live channel that drops is opened again.
1927
- var RECONNECTS = [['off', 'Off'], ['few', 'A few times (3 in 5 minutes)'], ['always', 'Keep trying']];
2026
+ var RECONNECTS = [['off', U.t('Off')], ['few', U.t('A few times (3 in 5 minutes)')], ['always', U.t('Keep trying')]];
1928
2027
  // (an HLS source through the service, with its own headers on every piece: see player-core's viaService)
1929
- var HLS_ROUTES = [['off', 'Off'], ['headers', 'Sources that need headers'], ['all', 'All HLS sources']];
2028
+ var HLS_ROUTES = [['off', U.t('Off')], ['headers', U.t('Sources that need headers')], ['all', U.t('All HLS sources')]];
1930
2029
  function settingsSeeking(wrap) {
1931
- wrap.appendChild(U.el('h2', null, 'Seeking & buffering'));
2030
+ wrap.appendChild(U.el('h2', null, U.t('Seeking & buffering')));
1932
2031
  var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect, hls: c.hls }; },
1933
2032
  set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect, hls: cfg.hls }); } };
1934
- wrap.appendChild(subPickRow('Seek step', [['5', '5 s'], ['10', '10 s'], ['15', '15 s'], ['30', '30 s']], 'seek', store));
1935
- wrap.appendChild(subPickRow('Buffer', [['normal', 'Normal (the TV’s own)'], ['more', 'More'], ['most', 'Most']], 'buffer', store));
1936
- wrap.appendChild(subPickRow('Reconnect live channels', RECONNECTS, 'reconnect', store));
1937
- wrap.appendChild(subPickRow('HLS through StremioK’s service', HLS_ROUTES, 'hls', store));
2033
+ wrap.appendChild(subPickRow(U.t('Seek step'), [['5', '5 s'], ['10', '10 s'], ['15', '15 s'], ['30', '30 s']], 'seek', store));
2034
+ wrap.appendChild(subPickRow(U.t('Buffer'), [['normal', U.t('Normal (the TV’s own)')], ['more', U.t('More')], ['most', U.t('Most')]], 'buffer', store));
2035
+ wrap.appendChild(subPickRow(U.t('Reconnect live channels'), RECONNECTS, 'reconnect', store));
2036
+ wrap.appendChild(subPickRow(U.t('HLS through StremioK’s service'), HLS_ROUTES, 'hls', store));
1938
2037
  wrap.appendChild(U.el('div', 'hint', 'Seek step: FF / REW jump three. Buffer: More or Most starts slower but stops less on a slow connection. Reconnect: a live channel that drops opens again (BACK stops it). HLS through StremioK’s service: for a host that wants headers the TV’s player can’t send; a step more before it starts.'));
1939
2038
  focusSettings();
1940
2039
  }
1941
2040
  function settingsSkipping(wrap) {
1942
- wrap.appendChild(U.el('h2', null, 'Skipping'));
1943
- wrap.appendChild(subPickRow('Intros, recaps and previews', SKIP_CHOICES, 'autoSkip', {
2041
+ wrap.appendChild(U.el('h2', null, U.t('Skipping')));
2042
+ wrap.appendChild(subPickRow(U.t('Intros, recaps and previews'), SKIP_CHOICES, 'autoSkip', {
1944
2043
  get: function () { return { autoSkip: '' + Stremio.getPrefs().autoSkip }; },
1945
2044
  set: function (cfg) { Stremio.setPref('autoSkip', +cfg.autoSkip || 0); }
1946
2045
  }));
1947
- wrap.appendChild(subPickRow('Next episode', NEXT_CHOICES, 'autoNext', {
2046
+ wrap.appendChild(subPickRow(U.t('Next episode'), NEXT_CHOICES, 'autoNext', {
1948
2047
  get: function () { return { autoNext: '' + Stremio.getPrefs().autoNext }; },
1949
2048
  set: function (cfg) { Stremio.setPref('autoNext', +cfg.autoNext || 0); }
1950
2049
  }));
@@ -1952,15 +2051,15 @@
1952
2051
  focusSettings();
1953
2052
  }
1954
2053
 
1955
- var POSTER_SHAPES = [['portrait', 'Portrait'], ['landscape', 'Landscape']];
2054
+ var POSTER_SHAPES = [['portrait', U.t('Portrait')], ['landscape', U.t('Landscape')]];
1956
2055
  // ----- Diagnostics › Logs: the recent problems U.log kept (in memory, URLs masked), and
1957
2056
  // how long launches took -----
1958
2057
  function settingsLogs(wrap) {
1959
- wrap.appendChild(U.el('h2', null, 'Diagnostics › Logs'));
2058
+ wrap.appendChild(U.el('h2', null, U.t('Diagnostics › Logs')));
1960
2059
  var list = U.logEntries ? U.logEntries() : [];
1961
2060
  wrap.appendChild(U.el('div', 'hint', list.length
1962
- ? 'The last ' + list.length + ' problem' + (list.length === 1 ? '' : 's') + ' since StremioK started, newest first, with keys and passwords masked. After a crash, what came just before is here too. Nothing here leaves the TV.'
1963
- : 'No problems since StremioK started.'));
2061
+ ? U.tn(list.length, 'The last problem since StremioK started, with keys and passwords masked. After a crash, what came just before is here too. Nothing here leaves the TV.', 'The last {n} problems since StremioK started, newest first, with keys and passwords masked. After a crash, what came just before is here too. Nothing here leaves the TV.')
2062
+ : U.t('No problems since StremioK started.')));
1964
2063
  function two(n) { return (n < 10 ? '0' : '') + n; }
1965
2064
  list.forEach(function (e) {
1966
2065
  var d = new Date(e.t);
@@ -1971,7 +2070,7 @@
1971
2070
  });
1972
2071
  if (list.length) {
1973
2072
  var clear = U.el('div', 'addon-item focusable');
1974
- clear.appendChild(U.el('div', 'a-name', 'Clear log'));
2073
+ clear.appendChild(U.el('div', 'a-name', U.t('Clear log')));
1975
2074
  clear.__onselect = function () { U.clearLog(); renderSettings(); };
1976
2075
  wrap.appendChild(clear);
1977
2076
  }
@@ -1981,23 +2080,23 @@
1981
2080
  // ----- Diagnostics › Storage: the database on or off, what's using the storage, tidying the
1982
2081
  // database up, giving up the copies that can be made again -----
1983
2082
  function settingsStorage(wrap) {
1984
- wrap.appendChild(U.el('h2', null, 'Diagnostics › Storage'));
2083
+ wrap.appendChild(U.el('h2', null, U.t('Diagnostics › Storage')));
1985
2084
  var was = Focus.current(), wasName = was && was.querySelector && was.querySelector('.a-name'); // (drawn again: on the same row)
1986
2085
  var wasKey = wasName ? wasName.textContent.split(/:| —/)[0] : '';
1987
2086
  var on = !!(U.bigStore && U.bigStore.enabled && U.bigStore.enabled());
1988
2087
  var db = U.el('div', 'addon-item focusable');
1989
- db.appendChild(U.el('div', 'a-name', 'Use the TV’s database: ' + (on ? 'On' : 'Off')));
1990
- db.appendChild(U.el('div', 'a-url', 'Holds StremioK’s big copies (saved Home rows, playlists, USB indexes, your Trakt history). Off: they go in the smaller settings storage, and the database is deleted'));
2088
+ db.appendChild(U.el('div', 'a-name', U.t('Use the TV’s database:') + ' ' + (on ? U.t('On') : U.t('Off'))));
2089
+ db.appendChild(U.el('div', 'a-url', U.t('Holds StremioK’s big copies (saved Home rows, playlists, USB indexes, your Trakt history). Off: they go in the smaller settings storage, and the database is deleted')));
1991
2090
  db.__onselect = function () {
1992
2091
  function apply(v) {
1993
2092
  U.bigStore.setEnabled(v).then(function (r) {
1994
2093
  _storageInfo = null;
1995
- U.toast(!r ? 'Couldn’t change it (Diagnostics › Logs says why)' : v ? 'Using the TV’s database' : 'The TV’s database is off and deleted' + (r.total ? ': ' + r.moved + ' of ' + r.total + ' copies kept in the settings storage' : ''));
2094
+ U.toast(!r ? U.t('Couldn’t change it (Diagnostics › Logs says why)') : v ? U.t('Using the TV’s database') : r.total ? U.t('The TV’s database is off and deleted: {moved} of {total} copies kept in the settings storage', { moved: r.moved, total: r.total }) : U.t('The TV’s database is off and deleted'));
1996
2095
  if (_settingsSection === 'storage') { renderSettings(); }
1997
2096
  });
1998
2097
  }
1999
2098
  if (!on) { apply(true); return; }
2000
- confirm('Stop using the TV’s database? It’s deleted, and StremioK’s copies are kept in the settings storage (what doesn’t fit is made again when needed).', 'Turn off', function () { apply(false); });
2099
+ confirm(U.t('Stop using the TV’s database? It’s deleted, and StremioK’s copies are kept in the settings storage (what doesn’t fit is made again when needed).'), U.t('Turn off'), function () { apply(false); });
2001
2100
  };
2002
2101
  wrap.appendChild(db);
2003
2102
  storageLines(wrap, on);
@@ -2018,31 +2117,32 @@
2018
2117
 
2019
2118
  // ----- Private viewing (see player-store): on or off; also on the player's quick bar (UP). -----
2020
2119
  function settingsPrivate(wrap) {
2021
- wrap.appendChild(U.el('h2', null, 'Private viewing'));
2120
+ wrap.appendChild(U.el('h2', null, U.t('Private viewing')));
2022
2121
  var on = Player.isPrivate();
2023
2122
  var r = U.el('div', 'addon-item focusable');
2024
- r.appendChild(U.el('div', 'a-name', 'Private viewing: ' + (on ? 'On' : 'Off')));
2025
- r.appendChild(U.el('div', 'a-url', on ? 'What you play isn’t recorded (StremioK, at the top, drawn as an outline meanwhile)' : 'What you play is recorded as usual'));
2123
+ r.appendChild(U.el('div', 'a-name', U.t('Private viewing:') + ' ' + (on ? U.t('On') : U.t('Off'))));
2124
+ r.appendChild(U.el('div', 'a-url', on ? U.t('What you play isn’t recorded (StremioK, at the top, drawn as an outline meanwhile)') : U.t('What you play is recorded as usual')));
2026
2125
  r.__onselect = function () { Player.setPrivate(!on); markHomeDirty(); renderSettings(); };
2027
2126
  wrap.appendChild(r);
2028
- wrap.appendChild(U.el('div', 'hint', 'While it’s on, what you play isn’t recorded: no progress, Continue Watching, watched marks, Trakt or remembered choices. What you do by hand still counts. Addons and other services are contacted as usual. UP › ◐ Private switches it while something plays.'));
2127
+ wrap.appendChild(U.el('div', 'hint', U.t('While it’s on, what you play isn’t recorded: no progress, Continue Watching, watched marks, Trakt or remembered choices. What you do by hand still counts. Addons and other services are contacted as usual. UP › ◐ Private switches it while something plays.')));
2029
2128
  Focus.setScope(scr('settings'), r);
2030
2129
  }
2031
2130
 
2032
2131
  // ----- USB drive: each drive's index (what it has, how much is matched to titles), the
2033
2132
  // hidden-files switch, and forgetting the matches. -----
2034
2133
  var _usbListening = false;
2035
- function usbDriveLine(st) {
2036
- if (st.state === 'scanning') { return st.phase === 'matching' ? 'Indexing: matching ' + st.done + ' of ' + st.total + ' titles · OK: stop' : 'Indexing: listing the drive… · OK: stop'; }
2037
- if (st.state === 'failed') { return 'Indexing failed: ' + st.error; }
2038
- if (st.state === 'none') { return 'Not indexed yet'; }
2039
- return st.videos + ' video' + (st.videos === 1 ? '' : 's') + ', ' + st.matched + ' matched to titles' + (st.truncated ? ' (a very large drive: only part of it)' : '') +
2040
- (st.left ? ', ' + st.left + ' titles left to match' : '') + ' · indexed ' + U.dayLabel(st.at) + ' ' + new Date(st.at).toTimeString().slice(0, 5);
2134
+ // folder: a network folder's (its own words: a folder, not a drive)
2135
+ function usbDriveLine(st, folder) {
2136
+ if (st.state === 'scanning') { return st.phase === 'matching' ? U.t('Indexing: matching {done} of {total} titles · OK: stop', { done: st.done, total: st.total }) : (folder ? U.t('Indexing: listing the folder… · OK: stop') : U.t('Indexing: listing the drive… · OK: stop')); }
2137
+ if (st.state === 'failed') { return U.t('Indexing failed: {why}', { why: st.error }); }
2138
+ if (st.state === 'none') { return U.t('Not indexed yet'); }
2139
+ return U.tn(st.videos, '{n} video', '{n} videos') + ', ' + U.t('{n} matched to titles', { n: st.matched }) + (st.truncated ? ' ' + (folder ? U.t('(a very large folder: only part of it)') : U.t('(a very large drive: only part of it)')) : '') +
2140
+ (st.left ? ', ' + U.t('{n} titles left to match', { n: st.left }) : '') + ' · ' + U.t('indexed {when}', { when: U.dayLabel(st.at) + ' ' + new Date(st.at).toTimeString().slice(0, 5) });
2041
2141
  }
2042
2142
  // ---- Network folders (WebDAV): NetFolders ----
2043
2143
  var _netListening = false;
2044
2144
  function settingsNetFolders(wrap) {
2045
- wrap.appendChild(U.el('h2', null, 'Network folders'));
2145
+ wrap.appendChild(U.el('h2', null, U.t('Network folders')));
2046
2146
  if (typeof NetFolders === 'undefined' || typeof LocalMedia === 'undefined') { focusSettings(); return; }
2047
2147
  if (!_netListening) {
2048
2148
  _netListening = true;
@@ -2055,21 +2155,21 @@
2055
2155
  });
2056
2156
  }
2057
2157
  var add = U.el('div', 'addon-item focusable cfg-row');
2058
- add.appendChild(U.el('div', 'a-name', '+ Add a network folder'));
2059
- add.appendChild(U.el('div', 'a-url', 'Its WebDAV address, then the user name and password it asks for, if any'));
2158
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add a network folder')));
2159
+ add.appendChild(U.el('div', 'a-url', U.t('Its WebDAV address, then the user name and password it asks for, if any')));
2060
2160
  add.__onselect = function () { askNetAddress(''); };
2061
2161
  wrap.appendChild(add);
2062
2162
  var focus = null;
2063
2163
  NetFolders.all().forEach(function (f) {
2064
2164
  var r = U.el('div', 'addon-item focusable cfg-row');
2065
2165
  r.__netFolder = f;
2066
- r.appendChild(U.el('div', 'a-name', '🌐 ' + f.name + (f.off ? ' · Off' : '')));
2166
+ r.appendChild(U.el('div', 'a-name', '🌐 ' + f.name + (f.off ? ' · ' + U.t('Off') : '')));
2067
2167
  r.appendChild(U.el('div', 'a-url', netFolderLine(f)));
2068
2168
  r.__onselect = function () {
2069
2169
  var d = NetFolders.driveOf(f), st = LocalMedia.status(d);
2070
2170
  if (!f.off && st.state === 'scanning') { V.confirmStopIndexing(d, st, renderSettings); return; }
2071
- var opts = f.off ? [['on', 'Turn on']] : [['off', 'Turn off'], ['index', st.left ? 'Continue matching (' + st.left + ' titles left)' : 'Index again']];
2072
- pickList(f.name, opts.concat([['remove', 'Remove']]), null, function (v) {
2171
+ var opts = f.off ? [['on', U.t('Turn on')]] : [['off', U.t('Turn off')], ['index', st.left ? U.t('Continue matching ({n} titles left)', { n: st.left }) : U.t('Index again')]];
2172
+ pickList(f.name, opts.concat([['remove', U.t('Remove')]]), null, function (v) {
2073
2173
  _focusChild = 'nf:' + f.id;
2074
2174
  if (v === 'on' || v === 'off') {
2075
2175
  NetFolders.setOn(f.id, v === 'on');
@@ -2079,11 +2179,11 @@
2079
2179
  } else if (v === 'index') {
2080
2180
  (st.left ? LocalMedia.continueMatching(d) : LocalMedia.scan(d)).then(function () {
2081
2181
  var s2 = LocalMedia.status(d);
2082
- U.toast(s2.state === 'failed' ? 'Indexing failed' + (s2.error ? ': ' + s2.error : '') : 'Indexed: ' + s2.videos + ' videos, ' + s2.matched + ' matched', 5000);
2182
+ U.toast(s2.state === 'failed' ? (s2.error ? U.t('Indexing failed: {why}', { why: s2.error }) : U.t('Indexing failed')) : U.t('Indexed: {videos} videos, {matched} matched', { videos: s2.videos, matched: s2.matched }), 5000);
2083
2183
  });
2084
2184
  renderSettings();
2085
2185
  } else if (v === 'remove') {
2086
- confirm('Remove “' + f.name + '”? Its index goes too; the folder itself isn’t touched.', 'Remove', function () { NetFolders.remove(f.id); markHomeDirty(); renderSettings(); });
2186
+ confirm(U.t('Remove “{name}”? Its index goes too; the folder itself isn’t touched.', { name: f.name }), U.t('Remove'), function () { NetFolders.remove(f.id); markHomeDirty(); renderSettings(); });
2087
2187
  }
2088
2188
  });
2089
2189
  };
@@ -2094,26 +2194,26 @@
2094
2194
  if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
2095
2195
  }
2096
2196
  function netFolderLine(f) {
2097
- if (f.off) { return f.url + ' · its sources set aside, its index kept'; }
2197
+ if (f.off) { return f.url + ' · ' + U.t('its sources set aside, its index kept'); }
2098
2198
  var st = LocalMedia.status(NetFolders.driveOf(f));
2099
- return f.url + (f.user ? ' · as ' + f.user : '') + (f.cert ? ' · its certificate trusted' : '') + ' · ' + usbDriveLine(st).replace('listing the drive', 'listing the folder').replace('a very large drive', 'a very large folder');
2199
+ return f.url + (f.user ? ' · ' + U.t('as {user}', { user: f.user }) : '') + (f.cert ? ' · ' + U.t('its certificate trusted') : '') + ' · ' + usbDriveLine(st, true);
2100
2200
  }
2101
2201
  function askNetAddress(value) {
2102
2202
  App.openEntry({
2103
- title: 'Network folder: address',
2104
- hint: 'Its WebDAV address, like http://192.168.0.50:8080/media (https:// too). RETURN cancels.',
2203
+ title: U.t('Network folder: address'),
2204
+ hint: U.t('Its WebDAV address, like http://192.168.0.50:8080/media (https:// too). RETURN cancels.'),
2105
2205
  value: value || 'http://', placeholder: 'http://192.168.0.50:8080/media', phone: 'webdav',
2106
2206
  validate: function (v) { return NetFolders.addressProblem(v); },
2107
2207
  onConfirm: function (url) {
2108
2208
  App.back();
2109
2209
  App.openEntry({
2110
- title: 'Network folder: user name', hint: 'The user name it asks for; leave it empty if it asks for none. RETURN cancels.', value: '', placeholder: 'user name',
2210
+ title: U.t('Network folder: user name'), hint: U.t('The user name it asks for; leave it empty if it asks for none. RETURN cancels.'), value: '', placeholder: U.t('user name'),
2111
2211
  validate: function () { return null; },
2112
2212
  onConfirm: function (user) {
2113
2213
  App.back();
2114
2214
  if (!('' + user).trim()) { netProbe(url, '', '', ''); return; }
2115
2215
  App.openEntry({
2116
- title: 'Network folder: password', hint: 'Its password (kept on the TV, sent only to that folder). RETURN cancels.', value: '', placeholder: 'password', secret: true,
2216
+ title: U.t('Network folder: password'), hint: U.t('Its password (kept on the TV, sent only to that folder). RETURN cancels.'), value: '', placeholder: U.t('password'), secret: true,
2117
2217
  validate: function () { return null; },
2118
2218
  onConfirm: function (pass) { App.back(); netProbe(url, ('' + user).trim(), '' + pass, ''); }
2119
2219
  });
@@ -2124,7 +2224,7 @@
2124
2224
  }
2125
2225
  // Ask the folder with that sign-in; a certificate it made itself: asked about first.
2126
2226
  function netProbe(url, user, pass, cert) {
2127
- U.spinner(true, 'Asking the folder…');
2227
+ U.spinner(true, U.t('Asking the folder…'));
2128
2228
  NetFolders.probe(url, user, pass, cert).then(function (p) {
2129
2229
  U.spinner(false);
2130
2230
  var f;
@@ -2133,23 +2233,23 @@
2133
2233
  _settingsSection = 'netfolders';
2134
2234
  _focusChild = 'nf:' + f.id;
2135
2235
  renderSettings();
2136
- U.toast('✓ Added “' + f.name + '”: Home › Local shows it', 5000);
2236
+ U.toast(U.t('✓ Added “{name}”: Home › Local shows it', { name: f.name }), 5000);
2137
2237
  }, function (e) {
2138
2238
  U.spinner(false);
2139
2239
  if (e && e.why === 'untrusted' && e.cert && !cert) {
2140
- confirm('“' + url + '”: trust this certificate? It isn’t from a known authority (one the folder made itself?)' + (e.name ? ', for ' + e.name : '') + (e.until ? ', until ' + e.until : '') +
2141
- '. Its fingerprint (SHA-256): ' + e.fp + '. StremioK then accepts this certificate only, for this folder.', 'Trust this certificate', function () { netProbe(url, user, pass, e.cert); }, { noLabel: 'Cancel', plain: true });
2240
+ confirm(U.t('“{url}”: trust this certificate? It isn’t from a known authority (one the folder made itself?)', { url: url }) + (e.name ? ', ' + U.t('for {name}', { name: e.name }) : '') + (e.until ? ', ' + U.t('until {date}', { date: e.until }) : '') +
2241
+ '. ' + U.t('Its fingerprint (SHA-256): {fp}. StremioK then accepts this certificate only, for this folder.', { fp: e.fp }), U.t('Trust this certificate'), function () { netProbe(url, user, pass, e.cert); }, { noLabel: U.t('Cancel'), plain: true });
2142
2242
  return;
2143
2243
  }
2144
- U.toast((e && e.message) || 'It failed', 7000);
2244
+ U.toast((e && e.message) || U.t('It failed'), 7000);
2145
2245
  if (_settingsSection === 'netfolders') { renderSettings(); }
2146
2246
  });
2147
2247
  }
2148
2248
 
2149
2249
  function settingsUsb(wrap) {
2150
- wrap.appendChild(U.el('h2', null, 'USB drive'));
2250
+ wrap.appendChild(U.el('h2', null, U.t('USB drive')));
2151
2251
  if (typeof LocalMedia === 'undefined' || !LocalMedia.available()) {
2152
- wrap.appendChild(U.el('div', 'hint', 'Only on the TV: this install can’t see USB drives.'));
2252
+ wrap.appendChild(U.el('div', 'hint', U.t('Only on the TV: this install can’t see USB drives.')));
2153
2253
  focusSettings();
2154
2254
  return;
2155
2255
  }
@@ -2166,25 +2266,25 @@
2166
2266
  }
2167
2267
  });
2168
2268
  }
2169
- wrap.appendChild(U.el('div', 'hint', 'Home › Local shows your drive. Videos are matched to titles by their names, and a matched one plays as that title. Index a drive to have its videos and subtitle files offered on their title pages.'));
2269
+ wrap.appendChild(U.el('div', 'hint', U.t('Home › Local shows your drive. Videos are matched to titles by their names, and a matched one plays as that title. Index a drive to have its videos and subtitle files offered on their title pages.')));
2170
2270
  if (!LocalMedia.isRead()) { // (read when asked, not at launch)
2171
- wrap.appendChild(U.el('div', 'hint', 'Reading USB drives…'));
2271
+ wrap.appendChild(U.el('div', 'hint', U.t('Reading USB drives…')));
2172
2272
  LocalMedia.ensure().then(function () { if (_settingsSection === 'usb') { renderSettings(); } });
2173
2273
  focusSettings();
2174
2274
  return;
2175
2275
  }
2176
2276
  var ds = LocalMedia.knownDrives().filter(function (d) { return !d.dav; }), first = null; // (network folders: their own page)
2177
- if (!ds.length) { wrap.appendChild(U.el('div', 'hint', 'No USB drive plugged in.')); }
2277
+ if (!ds.length) { wrap.appendChild(U.el('div', 'hint', U.t('No USB drive plugged in.'))); }
2178
2278
  ds.forEach(function (d) {
2179
2279
  var r = U.el('div', 'addon-item focusable');
2180
2280
  r.__usbDrive = d;
2181
- r.appendChild(U.el('div', 'a-name', '💾 ' + d.label.replace(/^removable_/, '') + ' — Index'));
2281
+ r.appendChild(U.el('div', 'a-name', '💾 ' + d.label.replace(/^removable_/, '') + ' — ' + U.t('Index')));
2182
2282
  r.appendChild(U.el('div', 'a-url', usbDriveLine(LocalMedia.status(d))));
2183
2283
  r.__onselect = function () {
2184
2284
  var st = LocalMedia.status(d);
2185
2285
  if (st.state === 'scanning') { V.confirmStopIndexing(d, st, renderSettings); return; }
2186
2286
  if (st.left) {
2187
- pickList('Index this drive', [['more', 'Continue matching (' + st.left + ' titles left)'], ['again', 'Index again (list the drive afresh)']], 'more', function (k) {
2287
+ pickList(U.t('Index this drive'), [['more', U.t('Continue matching ({n} titles left)', { n: st.left })], ['again', U.t('Index again (list the drive afresh)')]], 'more', function (k) {
2188
2288
  if (k === 'more') { LocalMedia.continueMatching(d); } else { LocalMedia.scan(d); }
2189
2289
  renderSettings();
2190
2290
  });
@@ -2196,27 +2296,27 @@
2196
2296
  first = first || r;
2197
2297
  });
2198
2298
  var mt = U.el('div', 'addon-item focusable');
2199
- mt.appendChild(U.el('div', 'a-name', 'Match videos to titles: ' + (LocalMedia.matchingAllowed() ? 'On' : LocalMedia.matchingAsked() ? 'Off' : 'Off (not asked yet)')));
2200
- mt.appendChild(U.el('div', 'a-url', 'On: titles worked out from your videos’ names (not the files) are looked up with your search addons, which see them. Off: Local just browses'));
2299
+ mt.appendChild(U.el('div', 'a-name', U.t('Match videos to titles:') + ' ' + (LocalMedia.matchingAllowed() ? U.t('On') : LocalMedia.matchingAsked() ? U.t('Off') : U.t('Off (not asked yet)'))));
2300
+ mt.appendChild(U.el('div', 'a-url', U.t('On: titles worked out from your videos’ names (not the files) are looked up with your search addons, which see them. Off: Local just browses')));
2201
2301
  mt.__onselect = function () { LocalMedia.setMatching(!LocalMedia.matchingAllowed()); markHomeDirty(); renderSettings(); Focus.setScope(scr('settings'), scr('settings').querySelectorAll('.settings-wrap .addon-item')[ds.length]); };
2202
2302
  wrap.appendChild(mt);
2203
2303
  var hid = U.el('div', 'addon-item focusable');
2204
- hid.appendChild(U.el('div', 'a-name', 'Show hidden files: ' + (LocalMedia.showHidden() ? 'On' : 'Off')));
2205
- hid.appendChild(U.el('div', 'a-url', 'Names starting with “.” (a Mac leaves ._… copies, .DS_Store, .Spotlight-V100…), $RECYCLE.BIN, System Volume Information'));
2304
+ hid.appendChild(U.el('div', 'a-name', U.t('Show hidden files:') + ' ' + (LocalMedia.showHidden() ? U.t('On') : U.t('Off'))));
2305
+ hid.appendChild(U.el('div', 'a-url', U.t('Names starting with “.” (a Mac leaves ._… copies, .DS_Store, .Spotlight-V100…), $RECYCLE.BIN, System Volume Information')));
2206
2306
  hid.__onselect = function () { LocalMedia.setShowHidden(!LocalMedia.showHidden()); markHomeDirty(); renderSettings(); Focus.setScope(scr('settings'), scr('settings').querySelectorAll('.settings-wrap .addon-item')[ds.length + 1]); };
2207
2307
  wrap.appendChild(hid);
2208
2308
  var clr = U.el('div', 'addon-item focusable');
2209
- clr.appendChild(U.el('div', 'a-name', 'Clear the USB index'));
2210
- clr.appendChild(U.el('div', 'a-url', 'What StremioK listed of your drives: title pages stop offering their files until a drive is indexed again (Local still browses them)'));
2309
+ clr.appendChild(U.el('div', 'a-name', U.t('Clear the USB index')));
2310
+ clr.appendChild(U.el('div', 'a-url', U.t('What StremioK listed of your drives: title pages stop offering their files until a drive is indexed again (Local still browses them)')));
2211
2311
  clr.__onselect = function () {
2212
- confirm('Clear the index of your USB drives?', 'Clear', function () { LocalMedia.clearIndex(); U.toast('USB index cleared'); renderSettings(); });
2312
+ confirm(U.t('Clear the index of your USB drives?'), U.t('Clear'), function () { LocalMedia.clearIndex(); U.toast(U.t('USB index cleared')); renderSettings(); });
2213
2313
  };
2214
2314
  wrap.appendChild(clr);
2215
2315
  var forget = U.el('div', 'addon-item focusable');
2216
- forget.appendChild(U.el('div', 'a-name', 'Forget matches'));
2217
- forget.appendChild(U.el('div', 'a-url', 'Every video matched again from its name, as you browse or index (the ones you matched by hand too)'));
2316
+ forget.appendChild(U.el('div', 'a-name', U.t('Forget matches')));
2317
+ forget.appendChild(U.el('div', 'a-url', U.t('Every video matched again from its name, as you browse or index (the ones you matched by hand too)')));
2218
2318
  forget.__onselect = function () {
2219
- confirm('Forget which title each video is (yours too)? They’re matched again as you browse, or when a drive is indexed.', 'Forget', function () {
2319
+ confirm(U.t('Forget which title each video is (yours too)? They’re matched again as you browse, or when a drive is indexed.'), U.t('Forget'), function () {
2220
2320
  LocalMedia.forgetMatches();
2221
2321
  markHomeDirty();
2222
2322
  renderSettings();
@@ -2233,53 +2333,53 @@
2233
2333
  // An item in the TV's database by what it is: { name, unused: why it's no longer used, if so }
2234
2334
  function storageItem(key) {
2235
2335
  var m;
2236
- if (key === 'stremiok.homecache') { return { name: 'Home’s saved rows' }; }
2237
- if (key === 'stremiok.trakt.watched') { return { name: 'Trakt watched history' }; }
2238
- if (key === 'stremiok.media.watched') { return { name: 'Media servers’ watched marks' }; }
2239
- if (key === 'stremiok.stremio.items') { return { name: 'Your Stremio account’s library' }; }
2336
+ if (key === 'stremiok.homecache') { return { name: U.t('Home’s saved rows') }; }
2337
+ if (key === 'stremiok.trakt.watched') { return { name: U.t('Trakt watched history') }; }
2338
+ if (key === 'stremiok.media.watched') { return { name: U.t('Media servers’ watched marks') }; }
2339
+ if (key === 'stremiok.stremio.items') { return { name: U.t('Your Stremio account’s library') }; }
2240
2340
  if ((m = key.match(/^stremiok\.iptv\.cache\.(.+)$/))) {
2241
2341
  var p = (typeof IPTV !== 'undefined' ? IPTV.getPlaylists() : []).filter(function (x) { return x.id === m[1]; })[0];
2242
- return p ? { name: 'IPTV playlist copy: ' + (p.name || (('' + p.url).match(/^[a-z]+:\/\/(?:[^\/@]*@)?([^\/?#:]+)/i) || [])[1] || 'a playlist') }
2243
- : { name: 'IPTV playlist copy (' + key + ')', unused: 'its playlist was removed' };
2342
+ return p ? { name: U.t('IPTV playlist copy: {name}', { name: p.name || (('' + p.url).match(/^[a-z]+:\/\/(?:[^\/@]*@)?([^\/?#:]+)/i) || [])[1] || U.t('a playlist') }) }
2343
+ : { name: U.t('IPTV playlist copy ({key})', { key: key }), unused: U.t('its playlist was removed') };
2244
2344
  }
2245
2345
  if ((m = key.match(/^stremiok\.local\.index\.(.+)$/))) {
2246
2346
  var kept = U.store.get('stremiok.local.indexes', {}) || {};
2247
- return kept[m[1]] ? { name: 'USB drive index: ' + m[1] } : { name: 'USB drive index: ' + m[1], unused: 'not one of the drives kept' };
2347
+ return kept[m[1]] ? { name: U.t('USB drive index: {drive}', { drive: m[1] }) } : { name: U.t('USB drive index: {drive}', { drive: m[1] }), unused: U.t('not one of the drives kept') };
2248
2348
  }
2249
- if (key === 'stremiok.local.index') { return { name: 'USB index (' + key + ')', unused: 'kept by an earlier version' }; }
2349
+ if (key === 'stremiok.local.index') { return { name: U.t('USB index ({key})', { key: key }), unused: U.t('kept by an earlier version') }; }
2250
2350
  return { name: key };
2251
2351
  }
2252
2352
  function fmtBytes(n) { return n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB'; }
2253
2353
  function storageLines(wrap, dbOn) {
2254
2354
  var r = U.el('div', 'addon-item focusable startup-row');
2255
- r.appendChild(U.el('div', 'a-name', 'TV storage' + (_storageInfo ? '' : ' — check what’s using it')));
2256
- if (_storageInfo === 'busy') { r.appendChild(U.el('div', 'a-url', 'Checking…')); }
2355
+ r.appendChild(U.el('div', 'a-name', U.t('TV storage') + (_storageInfo ? '' : ' — ' + U.t('check what’s using it'))));
2356
+ if (_storageInfo === 'busy') { r.appendChild(U.el('div', 'a-url', U.t('Checking…'))); }
2257
2357
  else if (_storageInfo) {
2258
2358
  var inf = _storageInfo;
2259
2359
  var line = function (t) { r.appendChild(U.el('div', 'a-url', t)); };
2260
2360
  var mine = inf.entries.reduce(function (n, e) { return n + e.bytes; }, 0);
2261
- if (inf.quota) { line('The TV’s database: ' + fmtBytes(inf.usage || 0) + ' used of ' + fmtBytes(inf.quota) + ' it allows StremioK'); }
2361
+ if (inf.quota) { line(U.t('The TV’s database: {used} used of {quota} it allows StremioK', { used: fmtBytes(inf.usage || 0), quota: fmtBytes(inf.quota) })); }
2262
2362
  if (inf.entries.length) {
2263
- var own = 'StremioK’s own data: about ' + fmtBytes(mine) + ' in ' + inf.entries.length + (inf.entries.length === 1 ? ' item' : ' items');
2264
- line((inf.usage || 0) > mine + 65536 ? 'Of that, ' + own + '; the other ' + fmtBytes(inf.usage - mine) + ' is the database’s own: old versions of items saved again, which it clears out over time on its own (not copies StremioK keeps)' : own);
2363
+ var own = U.tn(inf.entries.length, 'StremioK’s own data: about {size} in {n} item', 'StremioK’s own data: about {size} in {n} items', { size: fmtBytes(mine) });
2364
+ line((inf.usage || 0) > mine + 65536 ? U.t('Of that, {own}; the other {rest} is the database’s own: old versions of items saved again, which it clears out over time on its own (not copies StremioK keeps)', { own: own, rest: fmtBytes(inf.usage - mine) }) : own);
2265
2365
  }
2266
2366
  var sorted = inf.entries.slice().sort(function (a, b) { return b.bytes - a.bytes; });
2267
2367
  sorted.slice(0, STORAGE_ITEMS).forEach(function (e) {
2268
2368
  var d = storageItem(e.key), notes = [];
2269
- if (e.saves) { notes.push(e.saves === 1 ? 'saved once since StremioK started' : 'saved ' + e.saves + ' times since StremioK started'); }
2270
- if (d.unused) { notes.push('no longer used: ' + d.unused); }
2271
- if (inf.lsKeys[e.key]) { notes.push('also in the settings storage'); }
2369
+ if (e.saves) { notes.push(U.tn(e.saves, 'saved once since StremioK started', 'saved {n} times since StremioK started')); }
2370
+ if (d.unused) { notes.push(U.t('no longer used: {why}', { why: d.unused })); }
2371
+ if (inf.lsKeys[e.key]) { notes.push(U.t('also in the settings storage')); }
2272
2372
  line(fmtBytes(e.bytes) + ' ' + d.name + notes.map(function (n) { return ' · ' + n; }).join(''));
2273
2373
  });
2274
2374
  if (sorted.length > STORAGE_ITEMS) {
2275
- line('and ' + (sorted.length - STORAGE_ITEMS) + ' more: ' + fmtBytes(sorted.slice(STORAGE_ITEMS).reduce(function (n, e) { return n + e.bytes; }, 0)));
2375
+ line(U.t('and {n} more:', { n: sorted.length - STORAGE_ITEMS }) + ' ' + fmtBytes(sorted.slice(STORAGE_ITEMS).reduce(function (n, e) { return n + e.bytes; }, 0)));
2276
2376
  }
2277
- if (!inf.entries.length) { line(dbOn ? 'Nothing in the TV’s database.' : 'The TV’s database isn’t used (turned off above).'); }
2278
- line('Settings storage: ' + fmtBytes(inf.ls) + ' (progress, watched marks, settings…)' + (inf.lsTop.length ? '; the largest:' : ''));
2377
+ if (!inf.entries.length) { line(dbOn ? U.t('Nothing in the TV’s database.') : U.t('The TV’s database isn’t used (turned off above).')); }
2378
+ line(U.t('Settings storage: {size} (progress, watched marks, settings…)', { size: fmtBytes(inf.ls) }) + (inf.lsTop.length ? '; ' + U.t('the largest:') : ''));
2279
2379
  inf.lsTop.forEach(function (e) { line(' ' + fmtBytes(e.bytes) + ' ' + e.key); });
2280
- if (inf.guides && inf.guides.count) { line('Saved TV guides (in StremioK’s folder): ' + fmtBytes(inf.guides.bytes) + ' in ' + inf.guides.count + (inf.guides.count === 1 ? ' file' : ' files')); }
2281
- if (inf.guides && inf.guides.xtv && inf.guides.xtv.count) { line('Saved Xtream film and series lists (in StremioK’s folder): ' + fmtBytes(inf.guides.xtv.bytes) + ' in ' + inf.guides.xtv.count + (inf.guides.xtv.count === 1 ? ' file' : ' files')); }
2282
- if (inf.disk) { line('The TV’s own disk: ' + fmtBytes(inf.disk.free) + ' free of ' + fmtBytes(inf.disk.total) + ' (what the TV allows StremioK follows it: freeing space, unused apps for one, raises it)'); }
2380
+ if (inf.guides && inf.guides.count) { line(U.tn(inf.guides.count, 'Saved TV guides (in StremioK’s folder): {size} in {n} file', 'Saved TV guides (in StremioK’s folder): {size} in {n} files', { size: fmtBytes(inf.guides.bytes) })); }
2381
+ if (inf.guides && inf.guides.xtv && inf.guides.xtv.count) { line(U.tn(inf.guides.xtv.count, 'Saved Xtream film and series lists (in StremioK’s folder): {size} in {n} file', 'Saved Xtream film and series lists (in StremioK’s folder): {size} in {n} files', { size: fmtBytes(inf.guides.xtv.bytes) })); }
2382
+ if (inf.disk) { line(U.t('The TV’s own disk: {free} free of {total} (what the TV allows StremioK follows it: freeing space, unused apps for one, raises it)', { free: fmtBytes(inf.disk.free), total: fmtBytes(inf.disk.total) })); }
2283
2383
  }
2284
2384
  r.__onselect = function () {
2285
2385
  if (!U.bigStore || !U.bigStore.info || _storageInfo === 'busy') { return; }
@@ -2300,18 +2400,18 @@
2300
2400
  inf.lsTop = lsAll.sort(function (a, b) { return b.bytes - a.bytes; }).slice(0, 5);
2301
2401
  _storageInfo = inf;
2302
2402
  if (_settingsSection === 'storage') { renderSettings(); }
2303
- }, function () { _storageInfo = null; U.toast('Couldn’t check'); renderSettings(); });
2403
+ }, function () { _storageInfo = null; U.toast(U.t('Couldn’t check')); renderSettings(); });
2304
2404
  };
2305
2405
  wrap.appendChild(r);
2306
2406
  if (dbOn) { // (tidying up: only while it's used)
2307
2407
  var tidy = U.el('div', 'addon-item focusable');
2308
- tidy.appendChild(U.el('div', 'a-name', 'Tidy up the TV’s database'));
2309
- tidy.appendChild(U.el('div', 'a-url', 'Gives back the space of old versions of what StremioK saved, which the TV’s database keeps (StremioK’s data stays). Done on its own when they take over half of what the TV allows'));
2408
+ tidy.appendChild(U.el('div', 'a-name', U.t('Tidy up the TV’s database')));
2409
+ tidy.appendChild(U.el('div', 'a-url', U.t('Gives back the space of old versions of what StremioK saved, which the TV’s database keeps (StremioK’s data stays). Done on its own when they take over half of what the TV allows')));
2310
2410
  tidy.__onselect = function () {
2311
2411
  if (!U.bigStore || !U.bigStore.tidy) { return; }
2312
- U.toast('Tidying up the TV’s database…');
2412
+ U.toast(U.t('Tidying up the TV’s database…'));
2313
2413
  U.bigStore.tidy().then(function (res) {
2314
- U.toast(!res ? 'Couldn’t tidy it up (Diagnostics › Logs says why)' : res.before != null && res.after != null ? 'The TV’s database: ' + fmtBytes(res.before) + ' → ' + fmtBytes(res.after) : 'Tidied up');
2414
+ U.toast(!res ? U.t('Couldn’t tidy it up (Diagnostics › Logs says why)') : res.before != null && res.after != null ? U.t('The TV’s database: {before} → {after}', { before: fmtBytes(res.before), after: fmtBytes(res.after) }) : U.t('Tidied up'));
2315
2415
  _storageInfo = null;
2316
2416
  if (_settingsSection === 'storage') { renderSettings(); }
2317
2417
  });
@@ -2319,10 +2419,10 @@
2319
2419
  wrap.appendChild(tidy);
2320
2420
  }
2321
2421
  var clr = U.el('div', 'addon-item focusable');
2322
- clr.appendChild(U.el('div', 'a-name', 'Clear saved copies'));
2323
- clr.appendChild(U.el('div', 'a-url', 'Home’s saved rows, IPTV playlist copies, saved TV guides and Xtream lists, the USB index: made again when needed (playlists, guides and lists download again)'));
2422
+ clr.appendChild(U.el('div', 'a-name', U.t('Clear saved copies')));
2423
+ clr.appendChild(U.el('div', 'a-url', U.t('Home’s saved rows, IPTV playlist copies, saved TV guides and Xtream lists, the USB index: made again when needed (playlists, guides and lists download again)')));
2324
2424
  clr.__onselect = function () {
2325
- confirm('Clear the copies StremioK can make again (Home rows, playlist copies, TV guides, Xtream lists, USB index)?', 'Clear', function () {
2425
+ confirm(U.t('Clear the copies StremioK can make again (Home rows, playlist copies, TV guides, Xtream lists, USB index)?'), U.t('Clear'), function () {
2326
2426
  U.bigStore.keys().then(function (ks) {
2327
2427
  return Promise.all(ks.filter(function (k) { return /^stremiok\.(homecache|local\.index|iptv\.cache\.)/.test(k); }).map(function (k) { return U.bigStore.remove(k); }));
2328
2428
  }).then(function () {
@@ -2331,7 +2431,7 @@
2331
2431
  if (typeof EPG !== 'undefined' && EPG.reset) { EPG.reset(); }
2332
2432
  if (typeof LocalMedia !== 'undefined') { LocalMedia.clearIndex(); }
2333
2433
  _storageInfo = null;
2334
- U.toast('Saved copies cleared');
2434
+ U.toast(U.t('Saved copies cleared'));
2335
2435
  renderSettings();
2336
2436
  });
2337
2437
  });
@@ -2341,7 +2441,7 @@
2341
2441
 
2342
2442
  // How long this launch (and the one before) took to get going, from when the TV
2343
2443
  // started loading the app.
2344
- var STARTUP_STEPS = [['css', 'stylesheet'], ['firstScreen', 'first screen'], ['addons', 'addons'], ['firstCard', 'first title']];
2444
+ var STARTUP_STEPS = [['css', U.t('stylesheet')], ['firstScreen', U.t('first screen')], ['addons', U.t('addons')], ['firstCard', U.t('first title')]];
2345
2445
  function startupText(m) {
2346
2446
  var parts = [];
2347
2447
  STARTUP_STEPS.forEach(function (st) { if (m && typeof m[st[0]] === 'number') { parts.push(st[1] + ' ' + (m[st[0]] / 1000).toFixed(1) + ' s'); } });
@@ -2352,9 +2452,9 @@
2352
2452
  var now = startupText(U.startupMarks()), before = startupText(U.startupMarks(true));
2353
2453
  if (!now && !before) { return; }
2354
2454
  var r = U.el('div', 'addon-item focusable startup-row');
2355
- r.appendChild(U.el('div', 'a-name', 'Startup'));
2356
- if (now) { r.appendChild(U.el('div', 'a-url', 'This launch: ' + now)); }
2357
- if (before) { r.appendChild(U.el('div', 'a-url', 'Launch before: ' + before)); }
2455
+ r.appendChild(U.el('div', 'a-name', U.t('Startup')));
2456
+ if (now) { r.appendChild(U.el('div', 'a-url', U.t('This launch: {steps}', { steps: now }))); }
2457
+ if (before) { r.appendChild(U.el('div', 'a-url', U.t('Launch before: {steps}', { steps: before }))); }
2358
2458
  wrap.appendChild(r);
2359
2459
  }
2360
2460
 
@@ -2363,16 +2463,16 @@
2363
2463
  var _appsFocus = null; // { id, ctl } to focus after a change
2364
2464
  var _appsAll = false; // the add list includes hidden (system) apps
2365
2465
  function settingsAppShortcuts(wrap) {
2366
- wrap.appendChild(U.el('h2', null, 'Streaming apps'));
2466
+ wrap.appendChild(U.el('h2', null, U.t('Streaming apps')));
2367
2467
  if (!canListApps()) {
2368
- wrap.appendChild(U.el('div', 'hint', 'Only on the TV: this install can\'t see or open the TV\'s apps.'));
2468
+ wrap.appendChild(U.el('div', 'hint', U.t('Only on the TV: this install can\'t see or open the TV\'s apps.')));
2369
2469
  focusSettings();
2370
2470
  return;
2371
2471
  }
2372
2472
  wrap.appendChild(U.el('div', 'hint feeds-hint', 'A title\'s "where to watch" sources open these apps. Most are found by name; list one only where the TV has several for a service (like Netflix). OK on one of yours removes it.'));
2373
2473
  function redo(id, ctl) { _appsFocus = { id: id, ctl: ctl }; renderSettings(); }
2374
2474
  var mine = TVApps.shortcuts(), nameOf = {};
2375
- if (!mine.length) { wrap.appendChild(U.el('div', 'hint', 'None listed yet: pick apps below.')); }
2475
+ if (!mine.length) { wrap.appendChild(U.el('div', 'hint', U.t('None listed yet: pick apps below.'))); }
2376
2476
  mine.forEach(function (a, i) {
2377
2477
  var r = U.el('div', 'addon-item focusable app-mine');
2378
2478
  r.setAttribute('data-fk', a.id); r.setAttribute('data-ctl', 'name');
@@ -2381,14 +2481,14 @@
2381
2481
  r.appendChild(nameOf[a.id]);
2382
2482
  r.__onselect = function () {
2383
2483
  TVApps.remove(a.id);
2384
- U.toast(a.name + ' removed', 1500);
2484
+ U.toast(U.t('{name} removed', { name: a.name }), 1500);
2385
2485
  var next = mine[i + 1] || mine[i - 1]; // focus stays in the list
2386
2486
  redo(next ? next.id : null, next ? 'name' : 'add');
2387
2487
  };
2388
2488
  wrap.appendChild(r);
2389
2489
  });
2390
- wrap.appendChild(U.el('div', 'formats-group', 'Add an app'));
2391
- var status = U.el('div', 'hint', 'Reading this TV\'s apps…');
2490
+ wrap.appendChild(U.el('div', 'formats-group', U.t('Add an app')));
2491
+ var status = U.el('div', 'hint', U.t('Reading this TV\'s apps…'));
2392
2492
  wrap.appendChild(status);
2393
2493
  function focusNow() {
2394
2494
  var want = _appsFocus, pref = null;
@@ -2404,23 +2504,23 @@
2404
2504
  if (_settingsSection !== 'appshortcuts' || !wrap.parentNode) { return; } // left meanwhile
2405
2505
  var onTv = {};
2406
2506
  apps.forEach(function (a) { onTv[a.id] = true; });
2407
- mine.forEach(function (a) { if (!onTv[a.id]) { nameOf[a.id].textContent += ' · not on this TV any more'; } });
2507
+ mine.forEach(function (a) { if (!onTv[a.id]) { nameOf[a.id].textContent += ' · ' + U.t('not on this TV any more'); } });
2408
2508
  var hidden = 0;
2409
2509
  var list = apps.filter(function (a) {
2410
2510
  if (TVApps.has(a.id)) { return false; }
2411
2511
  if (!_appsAll && !a.show) { hidden++; return false; }
2412
2512
  return true;
2413
2513
  });
2414
- status.textContent = list.length ? 'OK adds one. Where an app is listed more than once, pick the one that opens (Settings › Diagnostics › Installed apps tries them).'
2415
- : 'Every app on this TV is already listed.';
2514
+ status.textContent = list.length ? U.t('OK adds one. Where an app is listed more than once, pick the one that opens (Settings › Diagnostics › Installed apps tries them).')
2515
+ : U.t('Every app on this TV is already listed.');
2416
2516
  list.forEach(function (a, i) {
2417
2517
  var r = U.el('div', 'addon-item focusable app-add');
2418
2518
  r.setAttribute('data-fk', a.id); r.setAttribute('data-ctl', 'add');
2419
2519
  r.appendChild(U.el('div', 'a-name', a.name));
2420
- r.appendChild(U.el('div', 'a-url', a.id + (a.show ? '' : ' · hidden (system) app')));
2520
+ r.appendChild(U.el('div', 'a-url', a.id + (a.show ? '' : ' · ' + U.t('hidden (system) app'))));
2421
2521
  r.__onselect = function () {
2422
- if (!TVApps.add(a)) { U.toast('That\'s the most apps StremioK keeps (' + TVApps.MAX + ')'); return; }
2423
- U.toast(a.name + ' added', 1500);
2522
+ if (!TVApps.add(a)) { U.toast(U.t('That\'s the most apps StremioK keeps ({n})', { n: TVApps.MAX })); return; }
2523
+ U.toast(U.t('{name} added', { name: a.name }), 1500);
2424
2524
  var next = list[i + 1] || list[i - 1]; // keep adding from here
2425
2525
  redo(next ? next.id : a.id, next ? 'add' : 'name');
2426
2526
  };
@@ -2429,14 +2529,14 @@
2429
2529
  if (_appsAll || hidden) {
2430
2530
  var more = U.el('div', 'addon-item focusable app-add');
2431
2531
  more.setAttribute('data-fk', '*hidden'); more.setAttribute('data-ctl', 'hidden');
2432
- more.appendChild(U.el('div', 'a-name', _appsAll ? 'Hide the hidden (system) apps' : 'Also show ' + hidden + ' hidden (system) app' + (hidden === 1 ? '' : 's')));
2532
+ more.appendChild(U.el('div', 'a-name', _appsAll ? U.t('Hide the hidden (system) apps') : U.tn(hidden, 'Also show {n} hidden (system) app', 'Also show {n} hidden (system) apps')));
2433
2533
  more.__onselect = function () { _appsAll = !_appsAll; redo('*hidden', 'hidden'); };
2434
2534
  wrap.appendChild(more);
2435
2535
  }
2436
2536
  focusNow();
2437
2537
  }, function (e) {
2438
2538
  if (_settingsSection !== 'appshortcuts' || !wrap.parentNode) { return; }
2439
- status.textContent = 'The TV didn\'t list its apps: ' + e.message;
2539
+ status.textContent = U.t('The TV didn\'t list its apps: {why}', { why: e.message });
2440
2540
  focusNow();
2441
2541
  });
2442
2542
  }
@@ -2456,41 +2556,41 @@
2456
2556
  }, function (e) { done({ error: e.message }); });
2457
2557
  }
2458
2558
  function launchTvApp(a) {
2459
- TVApps.launch(a).then(null, function (e) { U.toast('Couldn\'t open ' + a.name + ': ' + e.message, 4000); });
2559
+ TVApps.launch(a).then(null, function (e) { U.toast(U.t('Couldn\'t open {name}: {why}', { name: a.name, why: e.message }), 4000); });
2460
2560
  }
2461
2561
  // Returns the first app row (to focus), if the list is showing.
2462
2562
  function tvAppsSection(wrap) {
2463
- wrap.appendChild(U.el('h2', null, 'Diagnostics › Installed apps'));
2563
+ wrap.appendChild(U.el('h2', null, U.t('Diagnostics › Installed apps')));
2464
2564
  if (!canListApps()) {
2465
- wrap.appendChild(U.el('div', 'hint', 'Only on the TV: this install can\'t see the TV\'s apps.'));
2565
+ wrap.appendChild(U.el('div', 'hint', U.t('Only on the TV: this install can\'t see the TV\'s apps.')));
2466
2566
  return null;
2467
2567
  }
2468
2568
  if (!_tvApps) {
2469
2569
  var show = U.el('div', 'addon-item focusable');
2470
- show.appendChild(U.el('div', 'a-name', 'Show installed apps'));
2471
- show.appendChild(U.el('div', 'a-url', 'Their names and IDs, as the TV reports them'));
2570
+ show.appendChild(U.el('div', 'a-name', U.t('Show installed apps')));
2571
+ show.appendChild(U.el('div', 'a-url', U.t('Their names and IDs, as the TV reports them')));
2472
2572
  show.__onselect = function () { readTvApps(false); };
2473
2573
  wrap.appendChild(show);
2474
2574
  return null;
2475
2575
  }
2476
2576
  if (_tvApps.error) {
2477
- wrap.appendChild(U.el('div', 'hint', 'The TV didn\'t list its apps: ' + _tvApps.error));
2577
+ wrap.appendChild(U.el('div', 'hint', U.t('The TV didn\'t list its apps: {why}', { why: _tvApps.error })));
2478
2578
  return null;
2479
2579
  }
2480
- wrap.appendChild(U.el('div', 'hint', _tvApps.list.length + ' app' + (_tvApps.list.length === 1 ? '' : 's') +
2481
- (_tvApps.all ? ', including hidden ones' : '') + '. OK on one opens it (to check StremioK can launch it).'));
2580
+ wrap.appendChild(U.el('div', 'hint', (_tvApps.all ? U.tn(_tvApps.list.length, '{n} app, including hidden ones.', '{n} apps, including hidden ones.') : U.tn(_tvApps.list.length, '{n} app.', '{n} apps.')) +
2581
+ ' ' + U.t('OK on one opens it (to check StremioK can launch it).')));
2482
2582
  var first = null;
2483
2583
  _tvApps.list.forEach(function (a) {
2484
2584
  var r = U.el('div', 'addon-item focusable diag-row');
2485
2585
  r.appendChild(U.el('div', 'a-name', a.name));
2486
- r.appendChild(U.el('div', 'a-url', a.id + (a.version ? ' · version ' + a.version : '')));
2586
+ r.appendChild(U.el('div', 'a-url', a.id + (a.version ? ' · ' + U.t('version {v}', { v: a.version }) : '')));
2487
2587
  r.__onselect = function () { launchTvApp(a); };
2488
2588
  wrap.appendChild(r);
2489
2589
  if (!first) { first = r; }
2490
2590
  });
2491
2591
  if (!_tvApps.all && _tvApps.hidden > 0) {
2492
2592
  var more = U.el('div', 'addon-item focusable');
2493
- more.appendChild(U.el('div', 'a-name', 'Also show ' + _tvApps.hidden + ' hidden (system) app' + (_tvApps.hidden === 1 ? '' : 's')));
2593
+ more.appendChild(U.el('div', 'a-name', U.tn(_tvApps.hidden, 'Also show {n} hidden (system) app', 'Also show {n} hidden (system) apps')));
2494
2594
  more.__onselect = function () { readTvApps(true); };
2495
2595
  wrap.appendChild(more);
2496
2596
  }
@@ -2502,36 +2602,36 @@
2502
2602
  // that can search, IPTV as one per type). ▲/▼ moves one; OK on its name shows / hides it.
2503
2603
  // 'menu': the top menu between Watching and Settings (the tabs, Discover, Search: ViewParts'
2504
2604
  // menuOrder); OK on a tab shows / hides it, Discover and Search always show.
2505
- var MENU_FIXED = { discover: 'Discover', search: 'Search' };
2605
+ var MENU_FIXED = { discover: U.t('Discover'), search: U.t('Search') };
2506
2606
  function menuHidden(k) { return !MENU_FIXED[k] && (Stremio.getPrefs().hiddenTabs || []).indexOf(k) !== -1; }
2507
2607
  var FEED_KINDS = {
2508
- menu: { section: 'menuorder', title: 'Home › Menu', hint: 'Watching comes first and Settings last: ⇈ ▲ ▼ ⇊ put the rest in your order · OK on a tab shows/hides it.',
2608
+ menu: { section: 'menuorder', title: U.t('Home › Menu'), hint: U.t('Watching comes first and Settings last: ⇈ ▲ ▼ ⇊ put the rest in your order · OK on a tab shows/hides it.'),
2509
2609
  list: function () {
2510
2610
  return Promise.resolve(V.menuOrder().map(function (k) {
2511
2611
  var t = (V.HOME_TABS || []).filter(function (x) { return x.key === k; })[0];
2512
- return { key: k, name: MENU_FIXED[k] || (t ? t.label : k) + (k === 'local' ? ' (with a USB drive in)' : k === 'guide' ? ' (once a TV guide is read)' : '') };
2612
+ return { key: k, name: MENU_FIXED[k] || (t ? t.label : k) + (k === 'local' ? ' ' + U.t('(with a USB drive in)') : k === 'guide' ? ' ' + U.t('(once a TV guide is read)') : '') };
2513
2613
  }));
2514
2614
  },
2515
2615
  keyOf: function (x) { return x.key; },
2516
2616
  move: function (k, d) { V.moveMenuItem(k, d); markHomeDirty(); return Promise.resolve(); },
2517
2617
  toggle: function (k) {
2518
- if (MENU_FIXED[k]) { U.toast(MENU_FIXED[k] + ' is always in the menu'); return; }
2618
+ if (MENU_FIXED[k]) { U.toast(U.t('{tab} is always in the menu', { tab: MENU_FIXED[k] })); return; }
2519
2619
  var now = (Stremio.getPrefs().hiddenTabs || []).filter(function (x) { return x !== k; });
2520
2620
  if (!menuHidden(k)) { now.push(k); }
2521
2621
  Stremio.setPref('hiddenTabs', now);
2522
2622
  markHomeDirty();
2523
2623
  },
2524
2624
  hidden: menuHidden },
2525
- home: { section: 'feeds', title: 'Home › Home feeds', hint: '▲/▼ reorder a feed · OK on the name shows/hides it on Home.',
2625
+ home: { section: 'feeds', title: U.t('Home › Home feeds'), hint: U.t('▲/▼ reorder a feed · OK on the name shows/hides it on Home.'),
2526
2626
  list: function () { return Stremio.listCatalogsOrdered(); }, keyOf: function (c) { return Stremio.catalogKey(c); },
2527
2627
  move: function (k, d) { return Stremio.moveFeed(k, d); }, toggle: function (k) { Stremio.toggleFeed(k); },
2528
2628
  hidden: function (k) { return Stremio.isFeedHidden(k); } },
2529
- search: { section: 'searchfeeds', title: 'Home › Search results', hint: '▲/▼ reorder the Search rows · OK on the name shows/hides one in Search.',
2629
+ search: { section: 'searchfeeds', title: U.t('Home › Search results'), hint: U.t('▲/▼ reorder the Search rows · OK on the name shows/hides one in Search.'),
2530
2630
  list: function () { return Stremio.searchSourcesOrdered(); }, keyOf: function (src) { return src.key; },
2531
2631
  move: function (k, d) { return Stremio.moveSearchFeed(k, d); }, toggle: function (k) { Stremio.toggleSearchFeed(k); },
2532
2632
  hidden: function (k) { return Stremio.isSearchFeedHidden(k); } },
2533
- ranking: { section: 'ranking', title: 'Playback › Source ranking', off: 'off',
2534
- hint: 'Sources are ordered by these, top first: ▲/▼ moves one, OK turns it off or on. Resolution at the top groups the list by resolution. Your addons are below.',
2633
+ ranking: { section: 'ranking', title: U.t('Playback › Source ranking'), off: 'off',
2634
+ hint: U.t('Sources are ordered by these, top first: ▲/▼ moves one, OK turns it off or on. Resolution at the top groups the list by resolution. Your addons are below.'),
2535
2635
  list: function () { return Promise.resolve(Stremio.getRanking().criteria); }, keyOf: function (c) { return c.key; },
2536
2636
  move: function (k, d) { Stremio.moveRanking(k, d); return Promise.resolve(); }, toggle: function (k) { Stremio.toggleRanking(k); },
2537
2637
  hidden: function (k) { return !Stremio.getRanking().criteria.some(function (c) { return c.key === k && c.on; }); },
@@ -2539,30 +2639,30 @@
2539
2639
  var played = Stremio.getRanking().played;
2540
2640
  var r = U.el('div', 'addon-item focusable cfg-row feed-extra');
2541
2641
  r.setAttribute('data-fk', 'played'); r.setAttribute('data-ctl', 'extra');
2542
- r.appendChild(U.el('div', 'a-name', 'Played before first: ' + (played ? 'On' : 'Off')));
2543
- r.appendChild(U.el('div', 'a-url', (played ? 'Sources you played for a title (for a series, its release) come before the resolution groups'
2544
- : 'Sources you played rank like any other') + ' · OK to turn ' + (played ? 'off' : 'on')));
2642
+ r.appendChild(U.el('div', 'a-name', U.t('Played before first:') + ' ' + (played ? U.t('On') : U.t('Off'))));
2643
+ r.appendChild(U.el('div', 'a-url', (played ? U.t('Sources you played for a title (for a series, its release) come before the resolution groups')
2644
+ : U.t('Sources you played rank like any other')) + ' · ' + (played ? U.t('OK to turn off') : U.t('OK to turn on'))));
2545
2645
  r.__onselect = function () { Stremio.setPlayedFirst(!played); refeed('ranking', 'played', 'extra'); };
2546
2646
  wrap.appendChild(r);
2547
- wrap.appendChild(rankPageRow('Filters ›', filtersSummary(), 'rankfilters'));
2548
- wrap.appendChild(rankPageRow('When you press Play ›', onPlaySummary(), 'rankplay'));
2647
+ wrap.appendChild(rankPageRow(U.t('Filters ›'), filtersSummary(), 'rankfilters'));
2648
+ wrap.appendChild(rankPageRow(U.t('When you press Play ›'), onPlaySummary(), 'rankplay'));
2549
2649
  if (_focusChild === 'rankfilters' || _focusChild === 'rankplay') { _feedFocus = { key: _focusChild, ctl: 'extra' }; _focusChild = null; } // (BACK from one: on its row)
2550
- wrap.appendChild(U.el('div', 'formats-group', 'Then, in this order'));
2650
+ wrap.appendChild(U.el('div', 'formats-group', U.t('Then, in this order')));
2551
2651
  },
2552
2652
  after: function (wrap) {
2553
2653
  var r = U.el('div', 'addon-item focusable feed-extra');
2554
2654
  r.setAttribute('data-fk', 'reset'); r.setAttribute('data-ctl', 'extra');
2555
- r.appendChild(U.el('div', 'a-name', 'Restore defaults'));
2655
+ r.appendChild(U.el('div', 'a-name', U.t('Restore defaults')));
2556
2656
  r.appendChild(U.el('div', 'a-url', 'Played before first; then resolution, not yet cached last, release type, HDR before SDR, Feed sources order, each addon\'s own order (your addons stay as they are)'));
2557
- r.__onselect = function () { Stremio.resetRanking(); refeed('ranking', 'reset', 'extra'); U.toast('Source ranking restored'); };
2657
+ r.__onselect = function () { Stremio.resetRanking(); refeed('ranking', 'reset', 'extra'); U.toast(U.t('Source ranking restored')); };
2558
2658
  wrap.appendChild(r);
2559
2659
  // The addons that provide sources (Feed sources): their order, and on / off
2560
- wrap.appendChild(U.el('div', 'formats-group', 'Addons'));
2561
- wrap.appendChild(U.el('div', 'hint', 'The addons that give sources: ▲/▼ sets their order, OK turns one off (it isn\'t asked).'));
2660
+ wrap.appendChild(U.el('div', 'formats-group', U.t('Addons')));
2661
+ wrap.appendChild(U.el('div', 'hint', U.t('The addons that give sources: ▲/▼ sets their order, OK turns one off (it isn\'t asked).')));
2562
2662
  return Stremio.feedSourcesOrdered().then(function (items) {
2563
- if (!items.length) { wrap.appendChild(U.el('div', 'hint', 'None of your addons provide sources: add a stream addon in Settings › Content › Addons.')); }
2663
+ if (!items.length) { wrap.appendChild(U.el('div', 'hint', U.t('None of your addons provide sources: add a stream addon in Settings › Content › Addons.'))); }
2564
2664
  feedRows(wrap, 'ranking', items, SOURCE_ROWS);
2565
- }, function () { wrap.appendChild(U.el('div', 'hint', 'Your addons couldn\'t be read just now.')); });
2665
+ }, function () { wrap.appendChild(U.el('div', 'hint', U.t('Your addons couldn\'t be read just now.'))); });
2566
2666
  } }
2567
2667
  };
2568
2668
  // Source ranking's two pages (rankfilters, rankplay): a row on it that opens one, saying
@@ -2576,19 +2676,19 @@
2576
2676
  return r;
2577
2677
  }
2578
2678
  function filtersSummary() {
2579
- var P = Stremio.getPrefs(), bits = ['Sources the TV can’t play: ' + (P.hideUnplayable ? 'Hidden' : 'Shown')], sizes = [];
2580
- [['movie', 'Movies'], ['series', 'Series']].forEach(function (k) { var L = P.sizeLimits[k[0]]; if (L.min || L.max || L.perHour) { sizes.push(k[1] + ' ' + sizeSummary(L)); } });
2581
- bits.push(sizes.length ? sizes.join(', ') : 'No size limits');
2582
- bits.push(P.hideWords.length ? 'Words: ' + P.hideWords.join(', ') : 'No words');
2679
+ var P = Stremio.getPrefs(), bits = [U.t('Sources the TV can’t play:') + ' ' + (P.hideUnplayable ? U.t('Hidden') : U.t('Shown'))], sizes = [];
2680
+ [['movie', U.t('Movies')], ['series', U.t('Series')]].forEach(function (k) { var L = P.sizeLimits[k[0]]; if (L.min || L.max || L.perHour) { sizes.push(k[1] + ' ' + sizeSummary(L)); } });
2681
+ bits.push(sizes.length ? sizes.join(', ') : U.t('No size limits'));
2682
+ bits.push(P.hideWords.length ? U.t('Words: {words}', { words: P.hideWords.join(', ') }) : U.t('No words'));
2583
2683
  return bits.join(' · ');
2584
2684
  }
2585
2685
  function onPlaySummary() {
2586
2686
  var P = Stremio.getPrefs();
2587
- return 'Source list: ' + (P.skipSourceList ? 'skipped' : 'shown') + ' · The next source if one doesn’t start: ' + (P.nextOnFail ? 'On' : 'Off');
2687
+ return (P.skipSourceList ? U.t('Source list: skipped') : U.t('Source list: shown')) + ' · ' + U.t('The next source if one doesn’t start:') + ' ' + (P.nextOnFail ? U.t('On') : U.t('Off'));
2588
2688
  }
2589
2689
  // A page of its own: its title, a hint, its rows; focus back on the one just changed.
2590
2690
  function rankPage(wrap, title, hint, rows) {
2591
- wrap.appendChild(U.el('h2', null, 'Playback › Source ranking › ' + title));
2691
+ wrap.appendChild(U.el('h2', null, U.t('Playback') + ' › ' + U.t('Source ranking') + ' › ' + title));
2592
2692
  wrap.appendChild(U.el('div', 'hint feeds-hint', hint));
2593
2693
  rows.forEach(function (r) { wrap.appendChild(r); });
2594
2694
  var pref = null;
@@ -2597,21 +2697,21 @@
2597
2697
  }
2598
2698
  // Filters: what's left out, or sent to the bottom.
2599
2699
  function settingsRankFilters(wrap) {
2600
- rankPage(wrap, 'Filters', 'Sources these leave out, or send to the bottom of the list: never picked on their own.',
2601
- [unplayableRow(), sizeRow('movie', 'Movies’ sizes'), sizeRow('series', 'Series’ sizes (an episode)'), wordsRow()]);
2700
+ rankPage(wrap, U.t('Filters'), U.t('Sources these leave out, or send to the bottom of the list: never picked on their own.'),
2701
+ [unplayableRow(), sizeRow('movie', U.t('Movies’ sizes')), sizeRow('series', U.t('Series’ sizes (an episode)')), wordsRow()]);
2602
2702
  }
2603
2703
  // When you press Play: whether the list shows, and a source that doesn't start.
2604
2704
  function settingsRankPlay(wrap) {
2605
- rankPage(wrap, 'When you press Play', 'What ▶ Play does with the ranked list.', [skipListRow(), nextOnFailRow()]);
2705
+ rankPage(wrap, U.t('When you press Play'), U.t('What ▶ Play does with the ranked list.'), [skipListRow(), nextOnFailRow()]);
2606
2706
  }
2607
2707
  // direct links only: the sources the TV can't play left out of the list
2608
2708
  function unplayableRow() {
2609
2709
  var hideUn = Stremio.getPrefs().hideUnplayable;
2610
2710
  var un = U.el('div', 'addon-item focusable cfg-row feed-extra');
2611
2711
  un.setAttribute('data-fk', 'unplayable'); un.setAttribute('data-ctl', 'extra');
2612
- un.appendChild(U.el('div', 'a-name', 'Sources the TV can’t play: ' + (hideUn ? 'Hidden' : 'Shown')));
2613
- un.appendChild(U.el('div', 'a-url', (hideUn ? 'Left out (torrents, links it can’t open): direct links only; where-to-watch apps stay'
2614
- : 'Listed, dimmed, at the bottom (torrents, links it can’t open)') + ' · OK to ' + (hideUn ? 'show them' : 'hide them')));
2712
+ un.appendChild(U.el('div', 'a-name', U.t('Sources the TV can’t play:') + ' ' + (hideUn ? U.t('Hidden') : U.t('Shown'))));
2713
+ un.appendChild(U.el('div', 'a-url', (hideUn ? U.t('Left out (torrents, links it can’t open): direct links only; where-to-watch apps stay')
2714
+ : U.t('Listed, dimmed, at the bottom (torrents, links it can’t open)')) + ' · ' + (hideUn ? U.t('OK to show them') : U.t('OK to hide them'))));
2615
2715
  un.__onselect = function () { Stremio.setPref('hideUnplayable', !hideUn); refeed('ranking', 'unplayable', 'extra'); };
2616
2716
  return un;
2617
2717
  }
@@ -2620,9 +2720,9 @@
2620
2720
  var skipList = Stremio.getPrefs().skipSourceList;
2621
2721
  var sl = U.el('div', 'addon-item focusable cfg-row feed-extra');
2622
2722
  sl.setAttribute('data-fk', 'skiplist'); sl.setAttribute('data-ctl', 'extra');
2623
- sl.appendChild(U.el('div', 'a-name', 'Skip the source list: ' + (skipList ? 'On' : 'Off')));
2624
- sl.appendChild(U.el('div', 'a-url', (skipList ? '▶ Play, OK on an episode and ▶ Play SxEx play the top source at once (hold OK on an episode › Details for the list)'
2625
- : '▶ Play and OK on an episode show the sources to pick from (the remote’s Play key plays the top one)') + ' · OK to turn ' + (skipList ? 'off' : 'on')));
2723
+ sl.appendChild(U.el('div', 'a-name', U.t('Skip the source list:') + ' ' + (skipList ? U.t('On') : U.t('Off'))));
2724
+ sl.appendChild(U.el('div', 'a-url', (skipList ? U.t('▶ Play, OK on an episode and ▶ Play SxEx play the top source at once (hold OK on an episode › Details for the list)')
2725
+ : U.t('▶ Play and OK on an episode show the sources to pick from (the remote’s Play key plays the top one)')) + ' · ' + (skipList ? U.t('OK to turn off') : U.t('OK to turn on'))));
2626
2726
  sl.__onselect = function () { Stremio.setPref('skipSourceList', !skipList); refeed('ranking', 'skiplist', 'extra'); };
2627
2727
  return sl;
2628
2728
  }
@@ -2631,9 +2731,9 @@
2631
2731
  var nextOn = Stremio.getPrefs().nextOnFail;
2632
2732
  var nx = U.el('div', 'addon-item focusable cfg-row feed-extra');
2633
2733
  nx.setAttribute('data-fk', 'nextonfail'); nx.setAttribute('data-ctl', 'extra');
2634
- nx.appendChild(U.el('div', 'a-name', 'The next source if one doesn’t start: ' + (nextOn ? 'On' : 'Off')));
2635
- nx.appendChild(U.el('div', 'a-url', (nextOn ? 'A source the TV refuses, or that hasn’t started after 45 s, gives way to the next best one (up to 3 more)'
2636
- : 'A source that doesn’t start takes you back to the list') + ' · OK to turn ' + (nextOn ? 'off' : 'on')));
2734
+ nx.appendChild(U.el('div', 'a-name', U.t('The next source if one doesn’t start:') + ' ' + (nextOn ? U.t('On') : U.t('Off'))));
2735
+ nx.appendChild(U.el('div', 'a-url', (nextOn ? U.t('A source the TV refuses, or that hasn’t started after 45 s, gives way to the next best one (up to 3 more)')
2736
+ : U.t('A source that doesn’t start takes you back to the list')) + ' · ' + (nextOn ? U.t('OK to turn off') : U.t('OK to turn on'))));
2637
2737
  nx.__onselect = function () { Stremio.setPref('nextOnFail', !nextOn); refeed('ranking', 'nextonfail', 'extra'); };
2638
2738
  return nx;
2639
2739
  }
@@ -2642,11 +2742,11 @@
2642
2742
  var words = Stremio.getPrefs().hideWords;
2643
2743
  var w = U.el('div', 'addon-item focusable cfg-row feed-extra');
2644
2744
  w.setAttribute('data-fk', 'words'); w.setAttribute('data-ctl', 'extra');
2645
- w.appendChild(U.el('div', 'a-name', 'Hide sources with these words: ' + (words.length ? words.join(', ') : 'None')));
2646
- w.appendChild(U.el('div', 'a-url', 'A source with one of them in its name, description or file name (a whole word: “CAM” isn’t in “CAMERA”) goes to the bottom, for every title · OK to change'));
2745
+ w.appendChild(U.el('div', 'a-name', U.t('Hide sources with these words:') + ' ' + (words.length ? words.join(', ') : U.t('None'))));
2746
+ w.appendChild(U.el('div', 'a-url', U.t('A source with one of them in its name, description or file name (a whole word: “CAM” isn’t in “CAMERA”) goes to the bottom, for every title · OK to change')));
2647
2747
  w.__onselect = function () {
2648
- App.openEntry({ title: 'Hide sources with these words', value: words.join(', '), placeholder: 'CAM, HDTS, TELESYNC',
2649
- hint: 'Words separated by commas, capitals or not. Sources with one go to the bottom and are never picked on their own. Leave it empty for none.',
2748
+ App.openEntry({ title: U.t('Hide sources with these words'), value: words.join(', '), placeholder: U.t('CAM, HDTS, TELESYNC'),
2749
+ hint: U.t('Words separated by commas, capitals or not. Sources with one go to the bottom and are never picked on their own. Leave it empty for none.'),
2650
2750
  validate: function () { return null; },
2651
2751
  onConfirm: function (v) { App.back(); Stremio.setHideWords(v); refeed('ranking', 'words', 'extra'); } });
2652
2752
  };
@@ -2655,23 +2755,23 @@
2655
2755
  // Size limits (Settings › Source ranking › Filters): smallest, largest and most per hour, for movies or
2656
2756
  // series; OK on the row: which one, then its value.
2657
2757
  var SIZE_CHOICES = {
2658
- min: { label: 'Smallest', none: 'None', values: [0.1, 0.3, 0.5, 1, 2] },
2659
- max: { label: 'Largest', none: 'None', values: [2, 4, 8, 15, 20, 30, 50, 80] },
2660
- perHour: { label: 'Most per hour', none: 'None', values: [1, 1.5, 2, 3, 4, 6, 10], unit: ' an hour' }
2758
+ min: { label: U.t('Smallest'), none: U.t('None'), values: [0.1, 0.3, 0.5, 1, 2] },
2759
+ max: { label: U.t('Largest'), none: U.t('None'), values: [2, 4, 8, 15, 20, 30, 50, 80] },
2760
+ perHour: { label: U.t('Most per hour'), none: U.t('None'), values: [1, 1.5, 2, 3, 4, 6, 10], unit: ' ' + U.t('an hour') }
2661
2761
  };
2662
2762
  function sizeSummary(L) {
2663
2763
  var bits = [];
2664
- if (L.min) { bits.push('at least ' + Stremio.gbText(L.min)); }
2665
- if (L.max) { bits.push('up to ' + Stremio.gbText(L.max)); }
2666
- if (L.perHour) { bits.push('up to ' + Stremio.gbText(L.perHour) + ' an hour'); }
2667
- return bits.length ? bits.join(', ') : 'No limits';
2764
+ if (L.min) { bits.push(U.t('at least {size}', { size: Stremio.gbText(L.min) })); }
2765
+ if (L.max) { bits.push(U.t('up to {size}', { size: Stremio.gbText(L.max) })); }
2766
+ if (L.perHour) { bits.push(U.t('up to {size} an hour', { size: Stremio.gbText(L.perHour) })); }
2767
+ return bits.length ? bits.join(', ') : U.t('No limits');
2668
2768
  }
2669
2769
  function sizeRow(kind, title) {
2670
2770
  var L = Stremio.getPrefs().sizeLimits[kind];
2671
2771
  var r = U.el('div', 'addon-item focusable cfg-row feed-extra');
2672
2772
  r.setAttribute('data-fk', 'size-' + kind); r.setAttribute('data-ctl', 'extra');
2673
2773
  r.appendChild(U.el('div', 'a-name', title + ': ' + sizeSummary(L)));
2674
- r.appendChild(U.el('div', 'a-url', 'Sources outside them go to the bottom (Outside your size limits) and are never picked on their own; a source without a size isn’t held to them · OK to change'));
2774
+ r.appendChild(U.el('div', 'a-url', U.t('Sources outside them go to the bottom (Outside your size limits) and are never picked on their own; a source without a size isn’t held to them · OK to change')));
2675
2775
  r.__onselect = function () {
2676
2776
  var which = ['min', 'max', 'perHour'].map(function (w) {
2677
2777
  var C = SIZE_CHOICES[w];
@@ -2740,7 +2840,7 @@
2740
2840
  wrap.appendChild(U.el('div', 'hint feeds-hint', K.hint));
2741
2841
  if (K.before) { K.before(wrap); }
2742
2842
  K.list().then(function (items) {
2743
- if (!items.length) { wrap.appendChild(U.el('div', 'hint', kind === 'search' ? 'None of your addons can search.' : 'No feeds yet: add catalog addons in Settings › Content › Addons.')); }
2843
+ if (!items.length) { wrap.appendChild(U.el('div', 'hint', kind === 'search' ? U.t('None of your addons can search.') : U.t('No feeds yet: add catalog addons in Settings › Content › Addons.'))); }
2744
2844
  feedRows(wrap, kind, items, K);
2745
2845
  return K.after ? K.after(wrap) : null;
2746
2846
  }).then(function () {