stremiok 2.3.3 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +6 -5
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +42 -39
  6. package/js/app.js +7 -3
  7. package/js/downloads.js +16 -16
  8. package/js/epg.js +2 -3
  9. package/js/hubpreview.js +1 -1
  10. package/js/i18n.js +108 -0
  11. package/js/iptv.js +13 -13
  12. package/js/jellyfin.js +62 -29
  13. package/js/lang/ar.js +1941 -0
  14. package/js/lang/de.js +1941 -0
  15. package/js/lang/es.js +1941 -0
  16. package/js/lang/fi.js +1941 -0
  17. package/js/lang/fr.js +1941 -0
  18. package/js/lang/he.js +1941 -0
  19. package/js/lang/hi.js +1941 -0
  20. package/js/lang/it.js +1941 -0
  21. package/js/lang/ja.js +1941 -0
  22. package/js/lang/ko.js +1941 -0
  23. package/js/lang/languages.js +21 -0
  24. package/js/lang/pl.js +1941 -0
  25. package/js/lang/pt-BR.js +1941 -0
  26. package/js/lang/ru.js +1941 -0
  27. package/js/lang/tr.js +1941 -0
  28. package/js/lang/zh-CN.js +1941 -0
  29. package/js/local.js +9 -9
  30. package/js/netfolders.js +13 -13
  31. package/js/player-audio.js +17 -17
  32. package/js/player-controls.js +100 -100
  33. package/js/player-core.js +60 -57
  34. package/js/player-lang.js +22 -22
  35. package/js/player-quality.js +15 -15
  36. package/js/player-store.js +25 -18
  37. package/js/player-subs.js +69 -69
  38. package/js/plex.js +69 -21
  39. package/js/stremio-account.js +17 -12
  40. package/js/stremio-sync.js +641 -0
  41. package/js/stremio.js +79 -76
  42. package/js/stvod.js +4 -4
  43. package/js/trakt.js +23 -23
  44. package/js/tvapps.js +4 -4
  45. package/js/util.js +39 -27
  46. package/js/view-core.js +109 -92
  47. package/js/view-detail.js +135 -126
  48. package/js/view-discover.js +27 -27
  49. package/js/view-guide.js +13 -13
  50. package/js/view-home.js +148 -120
  51. package/js/view-search.js +25 -25
  52. package/js/view-settings.js +735 -643
  53. package/js/xtvod.js +2 -2
  54. package/js/youtube.js +17 -17
  55. package/js/ytplay.js +11 -6
  56. package/package.json +1 -1
  57. package/tizenbrew.html +1 -1
@@ -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,30 @@
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('Import configuration file'), U.t('Import addons, API keys & IPTV playlists'), 'import'],
408
+ [U.t('Export configuration'), U.t('Your addons, playlists, API keys and settings, to your phone'), 'export']] },
409
+ playback: { title: U.t('Playback'), rows: [
410
+ [U.t('Audio'), U.t('Preferred and second-choice audio language'), 'audio'],
411
+ [U.t('Subtitles'), U.t('Default language, size, color, background, position, font'), 'subtitles'],
412
+ [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'],
413
+ [U.t('Seeking & buffering'), U.t('How far ◀ ▶ jump; a bigger buffer for slow connections; reconnecting live channels'), 'seeking'],
414
+ [U.t('Source ranking'), U.t('How sources are ordered (played before, resolution, release type…), and your addons: their order, on or off'), 'ranking'],
415
+ [U.t('Formats'), U.t('Allowed resolutions, and what plays on this TV, learned as you watch'), 'formats'],
416
+ [U.t('Private viewing'), U.t('Play without anything recorded: no progress, Continue Watching, watched marks or Trakt'), 'private']] },
417
+ diagnostics: { title: U.t('Diagnostics'), rows: [
418
+ [U.t('Logs'), U.t('Recent problems (failed downloads, playback and script errors), secrets masked; how long launches took'), 'logs'],
419
+ [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'],
420
+ [U.t('Installed apps'), U.t('The TV’s apps with their IDs; OK on one opens it'), 'tvapps']] }
404
421
  };
405
422
 
406
423
  // Return true if BACK stepped a settings section back to the menu.
@@ -487,21 +504,21 @@
487
504
  IPTV.onProgress(function (n) {
488
505
  var el = _iptvStatusEl;
489
506
  if (el && document.documentElement.contains(el) && /^(Checking|Reading)/.test(el.textContent)) {
490
- el.textContent = 'Reading playlists… ' + ('' + n).replace(/\B(?=(\d{3})+(?!\d))/g, ',') + ' channels';
507
+ el.textContent = U.t('Reading playlists… {n} channels', { n: ('' + n).replace(/\B(?=(\d{3})+(?!\d))/g, ',') });
491
508
  }
492
509
  });
493
510
  }
494
511
 
495
512
  // TizenBrew serves every module from the same address, so they all share one storage:
496
513
  // 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.';
514
+ 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
515
  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'));
516
+ wrap.appendChild(U.el('h2', null, U.t('Settings')));
517
+ wrap.appendChild(sectionRow(U.t('Content'), U.t('Addons, API keys, IPTV playlists, media servers, streaming apps, importing a configuration file'), 'content'));
518
+ wrap.appendChild(sectionRow(U.t('Playback'), U.t('Audio and subtitles, source ranking, feed sources, formats'), 'playback'));
519
+ wrap.appendChild(sectionRow(U.t('Appearance'), U.t('Look, background, accent color, zoom, posters, spoilers'), 'appearance'));
520
+ wrap.appendChild(sectionRow(U.t('Home'), U.t('The tab it opens on, the top menu, Home feeds, Search results'), 'home'));
521
+ wrap.appendChild(sectionRow(U.t('Diagnostics'), U.t('Logs, storage, installed apps; how StremioK was installed'), 'diagnostics'));
505
522
  if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
506
523
  focusBack(wrap);
507
524
  }
@@ -522,12 +539,12 @@
522
539
  // How StremioK was installed, and whether its YouTube service (channels, trailers) answers
523
540
  if (typeof YTPlay !== 'undefined' && YTPlay.installLabel) {
524
541
  // (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…');
542
+ 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') });
543
+ var about = U.el('div', 'hint settings-about', U.t('Installed as: {how}', { how: YTPlay.installLabel() }) + player + ' · ' + U.t('YouTube service: checking…'));
527
544
  wrap.appendChild(about);
528
545
  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');
546
+ about.textContent = U.t('Installed as: {how}', { how: YTPlay.installLabel() }) + player + ' · ' +
547
+ (up ? U.t('YouTube service: running') : YTPlay.installMode() === 'wgt' ? U.t('YouTube service: starts when needed') : U.t('YouTube service: not running'));
531
548
  });
532
549
  }
533
550
  }
@@ -537,20 +554,20 @@
537
554
  var _addonFocus = null; // { url, ctl }: the ▲ / ▼ just pressed, focused again once redrawn
538
555
  // What an addon gives StremioK, from its manifest: catalogs (how many), search, details,
539
556
  // 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' };
557
+ 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
558
  function addonGives(m) {
542
559
  var res = (m.resources || []).map(function (r) { return typeof r === 'string' ? r : r && r.name; });
543
560
  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'); }
561
+ if (cats.length) { bits.push(U.t('Catalogs ({n})', { n: cats.length })); }
562
+ 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')); }
563
+ if (res.indexOf('meta') !== -1) { bits.push(U.t('Details')); }
564
+ if (res.indexOf('stream') !== -1) { bits.push(U.t('Sources')); }
565
+ if (res.indexOf('subtitles') !== -1) { bits.push(U.t('Subtitles')); }
549
566
  (m.types || []).forEach(function (t) {
550
567
  var n = TYPE_NAMES[t] || (('' + t).charAt(0).toUpperCase() + ('' + t).slice(1));
551
568
  if (types.indexOf(n) === -1) { types.push(n); }
552
569
  });
553
- return 'Gives: ' + (bits.length ? bits.join(' · ') : 'nothing StremioK uses') + (types.length ? ' · ' + types.slice(0, 8).join(', ') : '');
570
+ return U.t('Gives: {what}', { what: bits.length ? bits.join(' · ') : U.t('nothing StremioK uses') }) + (types.length ? ' · ' + types.slice(0, 8).join(', ') : '');
554
571
  }
555
572
  // An addon's logo tile: its initial (the first character, an emoji whole; "?" for one that
556
573
  // didn't load; drawn by the CSS from data-initial, so the row's text is still its name),
@@ -571,23 +588,23 @@
571
588
  return tile;
572
589
  }
573
590
  function settingsAddons(wrap) {
574
- wrap.appendChild(U.el('h2', null, 'Addons'));
591
+ wrap.appendChild(U.el('h2', null, U.t('Addons')));
575
592
  // Home-network links from addons on the internet (see Stremio.blocksLocal)
576
593
  var allow = !!Stremio.getPrefs().allowLocal;
577
594
  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')));
595
+ lan.appendChild(U.el('div', 'a-name', U.t('Local-network links from internet addons:') + ' ' + (allow ? U.t('Allowed') : U.t('Blocked'))));
596
+ 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…)')
597
+ : U.t('Links an internet addon points into your home network are left out (your own network’s addons and playlists aren’t affected)')) +
598
+ ' · ' + (allow ? U.t('OK to block') : U.t('OK to allow'))));
582
599
  lan.__onselect = function () { Stremio.setAllowLocal(!allow); clearCatalogCache(); renderSettings(); };
583
600
  wrap.appendChild(lan);
584
- wrap.appendChild(subPickRow('Wait for addons', ADDON_WAITS, 'addonWait', {
601
+ wrap.appendChild(subPickRow(U.t('Wait for addons'), ADDON_WAITS, 'addonWait', {
585
602
  get: function () { return { addonWait: '' + Stremio.getPrefs().addonWait }; },
586
603
  set: function (cfg) { Stremio.setPref('addonWait', +cfg.addonWait || 0); }
587
604
  }));
588
605
  Stremio.loadAddons().then(function (addons) {
589
606
  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.')); }
607
+ 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
608
  urls.forEach(function (url) {
592
609
  var off = !!(Stremio.isAddonOff && Stremio.isAddonOff(url)), kept = off && Stremio.savedManifest ? Stremio.savedManifest(url) : null;
593
610
  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 +613,17 @@
596
613
  var item = U.el('div', 'addon-item focusable playlist-item has-logo');
597
614
  item.appendChild(addonTile(loaded && loaded.manifest, url));
598
615
  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)' : ''));
616
+ 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
617
  var origin = Stremio.addonOrigin ? Stremio.addonOrigin(url) : '', ob = originBadge(origin);
601
618
  if (ob) { nm.appendChild(ob); }
602
619
  item.appendChild(nm);
603
620
  item.appendChild(U.el('div', 'a-url', U.redactUrl(url) + (origin ? ' · ' + ORIGIN_BADGE[origin][2] : ''))); // (personal tokens masked)
604
621
  if (loaded) { item.appendChild(U.el('div', 'a-url addon-gives', addonGives(loaded.manifest))); }
605
622
  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)); }
623
+ if (said) { item.appendChild(U.el('div', 'a-url addon-said', U.t('The addon says: {said}', { said: said }))); }
607
624
  var note = Stremio.thirdPartyNote ? Stremio.thirdPartyNote(loaded ? loaded.manifest.id : url) : ''; // (WatchHub)
608
625
  if (note) { item.appendChild(U.el('div', 'a-url addon-said', '⚠ ' + note)); }
609
- var name = loaded ? (loaded.manifest.name || 'Addon') : 'this addon';
626
+ var name = loaded ? (loaded.manifest.name || U.t('Addon')) : U.t('this addon');
610
627
  item.__onselect = function () {
611
628
  addonActions(name, url);
612
629
  };
@@ -617,18 +634,18 @@
617
634
  });
618
635
 
619
636
  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'));
637
+ addRow.appendChild(U.el('div', 'a-name', U.t('+ Add addon')));
638
+ addRow.appendChild(U.el('div', 'a-url', U.t('Enter a Stremio addon manifest URL on its own page')));
622
639
  addRow.__onselect = function () {
623
640
  App.openEntry({
624
- title: 'Add addon', phone: 'addon',
625
- hint: 'Type a Stremio addon manifest URL. Nothing is saved until you Confirm.',
641
+ title: U.t('Add addon'), phone: 'addon',
642
+ hint: U.t('Type a Stremio addon manifest URL. Nothing is saved until you Confirm.'),
626
643
  value: 'https://', placeholder: 'https://addon.example/manifest.json',
627
644
  validate: function (v) { return U.urlProblem(v) || null; }, // (U.parseUrl: http(s), a real host, no user:password@)
628
645
  onConfirm: function (v) {
629
646
  var added = Stremio.addAddon(v), note = Stremio.thirdPartyNote(added || v);
630
647
  refreshAddonRows(added || null);
631
- U.toast(note ? 'Addon added. ' + note : 'Addon added', note ? 8000 : undefined);
648
+ U.toast(note ? U.t('Addon added. {note}', { note: note }) : U.t('Addon added'), note ? 8000 : undefined);
632
649
  App.back(); renderSettings();
633
650
  }
634
651
  });
@@ -636,10 +653,11 @@
636
653
  wrap.appendChild(addRow);
637
654
  if (typeof StremioAccount !== 'undefined') {
638
655
  var acct = U.el('div', 'addon-item focusable add-row');
639
- var an = U.el('div', 'a-name', 'Import addons from your Stremio account');
656
+ var an = U.el('div', 'a-name', U.t('Import addons from your Stremio account'));
640
657
  an.appendChild(originBadge('stremio'));
641
658
  acct.appendChild(an);
642
- acct.appendChild(U.el('div', 'a-url', 'Sign in on your phone with a QR code, then tick the addons to add (StremioK signs out straight after)'));
659
+ 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')
660
+ : U.t('Sign in on your phone with a QR code, then tick the addons to add (StremioK signs out straight after)')));
643
661
  acct.__onselect = stremioImport;
644
662
  wrap.appendChild(acct);
645
663
  }
@@ -650,15 +668,15 @@
650
668
  var aname = U.el('div', 'a-name', 'AIOManager' + (am.base ? ' · ' + shortHost(am.base) : ''));
651
669
  aname.appendChild(originBadge('aiomanager'));
652
670
  aio.appendChild(aname);
653
- 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'
654
- : 'Your AIOManager’s address and API key, then ↻ Sync your addons with it'));
671
+ 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')
672
+ : U.t('Your AIOManager’s address and API key, then ↻ Sync your addons with it')));
655
673
  aio.__onselect = function () { _settingsSection = 'aiomanager'; renderSettings(); };
656
674
  wrap.appendChild(aio);
657
675
  if (_focusChild === 'aiomanager') { want = aio; _focusChild = null; }
658
676
  }
659
677
 
660
678
  wrap.appendChild(U.el('div', 'hint',
661
- 'StremioK hosts no content — add Stremio addon manifest URLs for catalogs, streams and subtitles.'));
679
+ U.t('StremioK hosts no content — add Stremio addon manifest URLs for catalogs, streams and subtitles.')));
662
680
  _addonFocus = null;
663
681
  if (want) { Focus.setScope(scr('settings'), want); } else { focusSettings(); }
664
682
  });
@@ -667,15 +685,57 @@
667
685
  // Import addons from your Stremio account (js/stremio-account.js): a QR code of Stremio's
668
686
  // sign-in link, asked until you approve on your phone; then the account's addons to tick
669
687
  // (none ticked; yours already shown as such); the account signed out as soon as it's read.
688
+ // Connected (Settings › Integrations): its kept sign-in used, and kept.
670
689
  function stremioImport() {
690
+ if (typeof StremioSync !== 'undefined' && StremioSync.isConnected() && !StremioSync.connectStatus().reconnect) {
691
+ U.spinner(true);
692
+ StremioAccount.addons(StremioSync.authKey()).then(function (list) { U.spinner(false); importPick(list); }, function (e) {
693
+ U.spinner(false);
694
+ U.toast(U.t('Couldn’t import: {why}', { why: (e && e.message) || U.t('unknown') }), 5000);
695
+ });
696
+ return;
697
+ }
698
+ stremioSignIn(U.t('Import addons from your Stremio account'), function (key, body, gone, fail) {
699
+ U.clear(body);
700
+ body.appendChild(U.el('div', 'tc-line', U.t('Reading your addons…')));
701
+ var read = StremioAccount.addons(key);
702
+ read.then(function () { StremioAccount.signOut(key); }, function () { StremioAccount.signOut(key); }); // (signed out as soon as it's read)
703
+ return read.then(function (list) {
704
+ if (gone()) { return; }
705
+ if (!list.length) { fail(new Error(U.t('your account has no addons StremioK can use'))); return; }
706
+ closeModal();
707
+ importPick(list);
708
+ });
709
+ });
710
+ }
711
+ function importPick(list) {
712
+ if (!list.length) { U.toast(U.t('Your Stremio account has no addons StremioK can use'), 5000); return; }
713
+ var mine = Stremio.getAddonUrls();
714
+ var items = list.map(function (x, i) {
715
+ var have = mine.indexOf(x.url) !== -1 || mine.indexOf(Stremio.normalizeUrl ? Stremio.normalizeUrl(x.url) : x.url) !== -1;
716
+ return { key: '' + i, label: x.name + ' · ' + shortHost(x.url), have: have };
717
+ });
718
+ 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) {
719
+ var n = 0, last = null;
720
+ keys.forEach(function (k) { var added = Stremio.addAddon(list[+k].url); if (added) { n++; last = added; if (Stremio.setAddonOrigin) { Stremio.setAddonOrigin(added, 'stremio'); } } });
721
+ clearCatalogCache();
722
+ refreshAddonRows(last);
723
+ U.toast(U.tn(n, 'Imported {n} addon', 'Imported {n} addons'), 3000);
724
+ renderSettings();
725
+ });
726
+ }
727
+ // Stremio's sign-in box: a code and a QR code of its link, asked until it's approved on your
728
+ // phone; then signedIn(key, body, gone, fail) (gone(): the box closed meanwhile: the key is
729
+ // given up).
730
+ function stremioSignIn(title, signedIn) {
671
731
  var existing = document.querySelector('.modal-overlay');
672
732
  if (existing) { existing.parentNode.removeChild(existing); }
673
733
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
674
- box.appendChild(U.el('div', 'modal-msg', 'Import addons from your Stremio account'));
734
+ box.appendChild(U.el('div', 'modal-msg', title));
675
735
  var body = U.el('div', 'trakt-connect');
676
- body.appendChild(U.el('div', 'tc-line', 'Asking Stremio for a code…'));
736
+ body.appendChild(U.el('div', 'tc-line', U.t('Asking Stremio for a code…')));
677
737
  box.appendChild(body);
678
- var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
738
+ var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
679
739
  cancel.__onselect = function () { closeModal(); };
680
740
  row.appendChild(cancel);
681
741
  box.appendChild(row);
@@ -688,50 +748,29 @@
688
748
  function fail(e) {
689
749
  if (gone) { return; }
690
750
  U.clear(body);
691
- body.appendChild(U.el('div', 'tc-line', 'Couldn’t import: ' + ((e && e.message) || 'unknown')));
751
+ body.appendChild(U.el('div', 'tc-line', 'Couldn’t ' + (/^Import/.test(title) ? 'import' : 'connect') + ': ' + ((e && e.message) || 'unknown')));
692
752
  }
693
753
  StremioAccount.start().then(function (c) {
694
754
  if (gone) { return; }
695
755
  U.clear(body);
696
756
  var qrSpot = U.el('div', 'tc-qr-spot');
697
757
  body.appendChild(qrSpot);
698
- var goTo = body.appendChild(U.el('div', 'tc-line', 'On your phone or computer, go to:'));
758
+ var goTo = body.appendChild(U.el('div', 'tc-line', U.t('On your phone or computer, go to:')));
699
759
  (typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
700
760
  var qr = U.qrCanvas(c.link, 8);
701
761
  if (!qr || !qrSpot.parentNode) { return; }
702
762
  qr.className = 'tc-qr';
703
- qrSpot.appendChild(U.el('div', 'tc-line', 'Scan with your phone:'));
763
+ qrSpot.appendChild(U.el('div', 'tc-line', U.t('Scan with your phone:')));
704
764
  qrSpot.appendChild(qr);
705
- goTo.textContent = 'or go to';
765
+ goTo.textContent = U.t('or go to');
706
766
  }, function () {});
707
767
  body.appendChild(U.el('div', 'tc-url', c.link));
708
- body.appendChild(U.el('div', 'tc-line', 'Code:'));
768
+ body.appendChild(U.el('div', 'tc-line', U.t('Code:')));
709
769
  body.appendChild(U.el('div', 'tc-code', c.code));
710
- body.appendChild(U.el('div', 'tc-line small', 'Sign in to Stremio there and approve. Waiting…'));
770
+ body.appendChild(U.el('div', 'tc-line small', U.t('Sign in to Stremio there and approve. Waiting…')));
711
771
  return StremioAccount.wait(c.code, stopped).then(function (key) {
712
772
  if (gone) { StremioAccount.signOut(key); return; }
713
- U.clear(body);
714
- body.appendChild(U.el('div', 'tc-line', 'Reading your addons…'));
715
- var read = StremioAccount.addons(key);
716
- read.then(function () { StremioAccount.signOut(key); }, function () { StremioAccount.signOut(key); }); // (signed out as soon as it's read)
717
- return read.then(function (list) {
718
- if (gone) { return; }
719
- if (!list.length) { fail(new Error('your account has no addons StremioK can use')); return; }
720
- var mine = Stremio.getAddonUrls();
721
- var items = list.map(function (x, i) {
722
- var have = mine.indexOf(x.url) !== -1 || mine.indexOf(Stremio.normalizeUrl ? Stremio.normalizeUrl(x.url) : x.url) !== -1;
723
- return { key: '' + i, label: x.name + ' · ' + shortHost(x.url), have: have };
724
- });
725
- closeModal();
726
- pickMany('Your Stremio addons: tick the ones to add', items, { button: function (n) { return 'Import ' + n + ' addon' + (n === 1 ? '' : 's'); } }, function (keys) {
727
- var n = 0, last = null;
728
- keys.forEach(function (k) { var added = Stremio.addAddon(list[+k].url); if (added) { n++; last = added; if (Stremio.setAddonOrigin) { Stremio.setAddonOrigin(added, 'stremio'); } } });
729
- clearCatalogCache();
730
- refreshAddonRows(last);
731
- U.toast('Imported ' + n + ' addon' + (n === 1 ? '' : 's'), 3000);
732
- renderSettings();
733
- });
734
- });
773
+ return signedIn(key, body, stopped, fail);
735
774
  });
736
775
  }).then(null, function (e) { if (!e || e.message !== 'stopped') { fail(e); } });
737
776
  }
@@ -744,7 +783,7 @@
744
783
  // refuses is forgotten (the address stays) and asked for again.
745
784
  var AIOM_KEY = 'stremiok.aiomanager';
746
785
  // Where an addon came from (Stremio.addonOrigin): a letter badge, and the words for it.
747
- var ORIGIN_BADGE = { stremio: ['S', 'src-s', 'From Stremio'], aiomanager: ['A', 'src-a', 'From AIOManager'], config: ['C', 'src-c', 'From a configuration file'] };
786
+ 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')] };
748
787
  function originBadge(kind) { var b = ORIGIN_BADGE[kind]; return b ? U.el('span', 'src-badge ' + b[1], b[0]) : null; }
749
788
  function aiomSaved() {
750
789
  var x = U.store.get(AIOM_KEY, {}) || {};
@@ -764,8 +803,8 @@
764
803
  ['https://aiomanager.fortheweak.cloud', 'Yeb’s'], ['https://aiomanager.stremio.ru', 'Kuu’s']];
765
804
  function aiomAskAddress(then) {
766
805
  var am = aiomSaved();
767
- pickList('Your AIOManager', AIOM_PUBLIC.map(function (x) { return [x[0], x[1] + ' · ' + shortHost(x[0])]; })
768
- .concat([['other', 'Another address… (your own: type it, or ▣ from your phone)']]), am.base || null, function (k) {
806
+ pickList(U.t('Your AIOManager'), AIOM_PUBLIC.map(function (x) { return [x[0], x[1] + ' · ' + shortHost(x[0])]; })
807
+ .concat([['other', U.t('Another address… (your own: type it, or ▣ from your phone)')]]), am.base || null, function (k) {
769
808
  if (k === 'other') { aiomTypeAddress(then); return; }
770
809
  aiomSetBase(k);
771
810
  if (then) { then(); } else { renderSettings(); }
@@ -779,8 +818,8 @@
779
818
  function aiomTypeAddress(then) {
780
819
  var am = aiomSaved();
781
820
  App.openEntry({
782
- title: 'Your AIOManager’s address', phone: 'aiom',
783
- hint: 'The address you open AIOManager at (your instance), e.g. https://aiomanager.example.com. Kept on the TV.',
821
+ title: U.t('Your AIOManager’s address'), phone: 'aiom',
822
+ hint: U.t('The address you open AIOManager at (your instance), e.g. https://aiomanager.example.com. Kept on the TV.'),
784
823
  value: am.base || 'https://', placeholder: 'https://aiomanager.example.com',
785
824
  validate: function (v) { return U.urlProblem(v) || null; },
786
825
  onConfirm: function (v) { aiomSetBase(('' + v).trim().replace(/\/+$/, '')); App.back(); if (then) { then(); } else { renderSettings(); } }
@@ -788,15 +827,15 @@
788
827
  }
789
828
  function aiomAskKey(then) {
790
829
  App.openEntry({
791
- title: 'Your AIOManager API key', phone: 'aiomkey', secret: true,
792
- 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.',
793
- value: '', placeholder: 'API key',
794
- validate: function (v) { return /^[\x21-\x7e]{6,300}$/.test(('' + v).trim()) ? null : 'That doesn’t look like an API key'; },
830
+ title: U.t('Your AIOManager API key'), phone: 'aiomkey', secret: true,
831
+ 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.'),
832
+ value: '', placeholder: U.t('API key'),
833
+ validate: function (v) { return /^[\x21-\x7e]{6,300}$/.test(('' + v).trim()) ? null : U.t('That doesn’t look like an API key'); },
795
834
  onConfirm: function (v) { aiomSave({ key: ('' + v).trim() }); App.back(); if (then) { then(); } else { renderSettings(); } }
796
835
  });
797
836
  }
798
837
  function settingsAiom(wrap) {
799
- wrap.appendChild(U.el('h2', null, 'Addons › AIOManager'));
838
+ wrap.appendChild(U.el('h2', null, U.t('Addons › AIOManager')));
800
839
  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.'));
801
840
  var am = aiomSaved();
802
841
  function row(name, sub, fn) {
@@ -807,14 +846,14 @@
807
846
  wrap.appendChild(r);
808
847
  return r;
809
848
  }
810
- row('Address: ' + (am.base || 'Not set'), 'Your AIOManager instance · OK to ' + (am.base ? 'change' : 'set'), function () { aiomAskAddress(); });
811
- row('API key: ' + (am.key ? '••••' + am.key.slice(-4) : 'Not set'), 'Your account’s, from AIOManager · OK to ' + (am.key ? 'change' : 'set'), function () { aiomAskKey(); });
849
+ 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(); });
850
+ 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(); });
812
851
  if (am.base && am.key) {
813
- 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') +
814
- ' · refresh, add new, remove the ones gone from it', aiomSync);
852
+ 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')) +
853
+ ' · ' + U.t('refresh, add new, remove the ones gone from it'), aiomSync);
815
854
  }
816
855
  if (am.base || am.key) {
817
- 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(); });
856
+ 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(); });
818
857
  }
819
858
  focusSettings();
820
859
  }
@@ -823,7 +862,7 @@
823
862
  if (!am.base) { aiomAskAddress(aiomSync); return; }
824
863
  if (!am.key) { aiomAskKey(aiomSync); return; }
825
864
  function norm(u) { return (Stremio.normalizeAddonUrl && Stremio.normalizeAddonUrl(u)) || u; }
826
- U.toast('Reading your AIOManager addons…', 4000);
865
+ U.toast(U.t('Reading your AIOManager addons…'), 4000);
827
866
  YTPlay.aiomAddons(am.base, am.key).then(function (r) {
828
867
  var there = (r && Array.isArray(r.addons) ? r.addons : []).filter(function (x) { return x && U.parseUrl(x.url); });
829
868
  var byNorm = {};
@@ -836,11 +875,11 @@
836
875
  var add = there.filter(function (x) { return x.enabled !== false && mineNorm.indexOf(norm(x.url)) === -1; });
837
876
  var gone = mine.filter(function (u) { var x = byNorm[norm(u)]; return fromIt(u) && (!x || x.enabled === false); });
838
877
  var items = [];
839
- if (shared.length) { items.push({ key: 'refresh', label: '↻ Refresh the ' + shared.length + ' addon' + (shared.length === 1 ? '' : 's') + ' you have from AIOManager' }); }
840
- 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) }); });
878
+ 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') }); }
879
+ 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) }); });
841
880
  gone.forEach(function (u, i) {
842
881
  var x = byNorm[norm(u)];
843
- 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' });
882
+ 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') });
844
883
  });
845
884
  function done(n, addedUrls) { // what came from it: as before, and what this sync added (still in your list)
846
885
  var now = (addedUrls || []).map(norm);
@@ -849,8 +888,8 @@
849
888
  if (n) { clearCatalogCache(); refreshAddonRows(null); }
850
889
  renderSettings();
851
890
  }
852
- if (!items.length) { U.toast('Nothing to sync: AIOManager has no addons StremioK can use', 4000); done(0); return; }
853
- pickMany('Sync with AIOManager: tick what to do', items, { button: function (n) { return 'Apply ' + n; } }, function (keys) {
891
+ if (!items.length) { U.toast(U.t('Nothing to sync: AIOManager has no addons StremioK can use'), 4000); done(0); return; }
892
+ pickMany(U.t('Sync with AIOManager: tick what to do'), items, { button: function (n) { return U.t('Apply {n}', { n: n }); } }, function (keys) {
854
893
  var added = 0, removed = 0, addedUrls = [];
855
894
  keys.forEach(function (k) {
856
895
  if (k.indexOf('add:') === 0) { var got = Stremio.addAddon(add[+k.slice(4)].url); if (got) { added++; addedUrls.push(got); Stremio.setAddonOrigin(got, 'aiomanager'); } }
@@ -859,10 +898,10 @@
859
898
  var refreshing = keys.indexOf('refresh') !== -1 ? shared.filter(function (u) { return Stremio.getAddonUrls().indexOf(u) !== -1; }) : [];
860
899
  U.settleAll(refreshing.map(function (u) { return function () { return Stremio.refreshAddon(u); }; }), 2).then(function (rs) {
861
900
  var refreshed = (rs || []).filter(function (x) { return x && x.ok; }).length, parts = [];
862
- if (added) { parts.push(added + ' added'); }
863
- if (removed) { parts.push(removed + ' removed'); }
864
- if (refreshing.length) { parts.push(refreshed + ' refreshed' + (refreshed < refreshing.length ? ' (' + (refreshing.length - refreshed) + ' didn’t answer)' : '')); }
865
- U.toast('Synced: ' + (parts.join(', ') || 'nothing changed'), 4000);
901
+ if (added) { parts.push(U.t('{n} added', { n: added })); }
902
+ if (removed) { parts.push(U.t('{n} removed', { n: removed })); }
903
+ if (refreshing.length) { parts.push(U.t('{n} refreshed', { n: refreshed }) + (refreshed < refreshing.length ? ' ' + U.t('({n} didn’t answer)', { n: refreshing.length - refreshed }) : '')); }
904
+ U.toast(U.t('Synced: {what}', { what: parts.join(', ') || U.t('nothing changed') }), 4000);
866
905
  done(added + removed + refreshed, addedUrls);
867
906
  });
868
907
  });
@@ -870,11 +909,11 @@
870
909
  var why = (e && e.message) || '';
871
910
  if (/HTTP 401\b/.test(why) || (e && e.status === 401)) {
872
911
  aiomSave({ key: '' });
873
- U.toast('AIOManager refused the API key: enter it again', 4500);
912
+ U.toast(U.t('AIOManager refused the API key: enter it again'), 4500);
874
913
  aiomAskKey(aiomSync);
875
914
  return;
876
915
  }
877
- U.toast('Couldn’t read your AIOManager addons (' + (U.problem ? U.problem(e) : why) + ')', 5000);
916
+ U.toast(U.t('Couldn’t read your AIOManager addons ({why})', { why: U.problem ? U.problem(e) : why }), 5000);
878
917
  });
879
918
  }
880
919
 
@@ -887,20 +926,20 @@
887
926
  // starts again with them.
888
927
  function importText(text, here) {
889
928
  var parsed = Stremio.parseSetupList(text);
890
- if (!parsed.items.length) { U.toast('No supported entries found in that file' + (parsed.ignored ? ' (' + parsed.ignored + ' ignored)' : ''), 4500); return; }
929
+ 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; }
891
930
  if (here()) { App.back(); renderSettings(); }
892
- 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 }; }),
893
- { button: function (n) { return 'Import ' + n; } }, function (keys) {
931
+ 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 }; }),
932
+ { button: function (n) { return U.t('Import {n}', { n: n }); } }, function (keys) {
894
933
  var imported = Stremio.applySetupEntries(keys.map(function (k) { return parsed.items[+k]; })), parts = [];
895
- if (imported.addons) { parts.push(imported.addons + ' addon' + (imported.addons === 1 ? '' : 's')); }
896
- if (imported.playlists) { parts.push(imported.playlists + ' playlist' + (imported.playlists === 1 ? '' : 's')); }
897
- if (imported.omdb) { parts.push('OMDb key'); }
898
- if (imported.tmdb) { parts.push('TMDB key'); }
899
- if (imported.mdblist) { parts.push('MDBList key'); }
900
- if (imported.settings) { parts.push('your settings'); }
934
+ if (imported.addons) { parts.push(U.tn(imported.addons, '{n} addon', '{n} addons')); }
935
+ if (imported.playlists) { parts.push(U.tn(imported.playlists, '{n} playlist', '{n} playlists')); }
936
+ if (imported.omdb) { parts.push(U.t('OMDb key')); }
937
+ if (imported.tmdb) { parts.push(U.t('TMDB key')); }
938
+ if (imported.mdblist) { parts.push(U.t('MDBList key')); }
939
+ if (imported.settings) { parts.push(U.t('your settings')); }
901
940
  if (imported.addons || imported.playlists) { clearCatalogCache(); }
902
- var message = parts.length ? ('Imported: ' + parts.join(', ')) : 'Nothing imported';
903
- if (parsed.ignored) { message += ' (' + parsed.ignored + ' ignored)'; }
941
+ var message = parts.length ? U.t('Imported: {what}', { what: parts.join(', ') }) : U.t('Nothing imported');
942
+ if (parsed.ignored) { message += ' ' + U.t('({n} ignored)', { n: parsed.ignored }); }
904
943
  if (imported.settings) { // (every part of StremioK reads them afresh)
905
944
  U.toast(message + '. StremioK starts again with them…', 4000);
906
945
  setTimeout(function () { try { window.location.reload(); } catch (e) {} }, 2500);
@@ -913,42 +952,42 @@
913
952
  // Settings › Content › Export configuration: what goes in, all ticked at first, given to your
914
953
  // phone (V.phoneGive) as the file Import configuration file reads (Stremio.exportSetup).
915
954
  function settingsExport(wrap) {
916
- wrap.appendChild(U.el('h2', null, 'Export configuration'));
955
+ wrap.appendChild(U.el('h2', null, U.t('Export configuration')));
917
956
  var row = U.el('div', 'addon-item focusable add-row');
918
- row.appendChild(U.el('div', 'a-name', '⇧ Export to your phone'));
919
- row.appendChild(U.el('div', 'a-url', 'Your addons, IPTV playlists, API keys and settings, as a file to import later'));
957
+ row.appendChild(U.el('div', 'a-name', U.t('⇧ Export to your phone')));
958
+ row.appendChild(U.el('div', 'a-url', U.t('Your addons, IPTV playlists, API keys and settings, as a file to import later')));
920
959
  row.__onselect = function () {
921
960
  var groups = Stremio.exportGroups();
922
- pickMany('Tick what to export', groups.map(function (g) { return { key: g.key, label: g.label }; }),
923
- { on: groups.map(function (g) { return g.key; }), button: function (n) { return 'Export ' + n; } }, function (keys) {
924
- V.phoneGive('Export configuration', Stremio.exportSetup(keys, appVersion()),
925
- '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.');
961
+ pickMany(U.t('Tick what to export'), groups.map(function (g) { return { key: g.key, label: g.label }; }),
962
+ { on: groups.map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
963
+ V.phoneGive(U.t('Export configuration'), Stremio.exportSetup(keys, appVersion()),
964
+ 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.'));
926
965
  });
927
966
  };
928
967
  wrap.appendChild(row);
929
- 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).'));
968
+ 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).')));
930
969
  focusSettings();
931
970
  }
932
971
  function settingsImport(wrap) {
933
- wrap.appendChild(U.el('h2', null, 'Import configuration file'));
972
+ wrap.appendChild(U.el('h2', null, U.t('Import configuration file')));
934
973
  var lastUrl = U.store.get(IMPORT_URL_KEY, '') || '';
935
974
  var listRow = U.el('div', 'addon-item focusable add-row');
936
- var ln = U.el('div', 'a-name', '+ Import configuration file');
975
+ var ln = U.el('div', 'a-name', U.t('+ Import configuration file'));
937
976
  ln.appendChild(originBadge('config'));
938
977
  listRow.appendChild(ln);
939
- listRow.appendChild(U.el('div', 'a-url', lastUrl ? ('Last used: ' + lastUrl + ' · OK to import again')
940
- : 'Addon URLs, API keys and IPTV playlist URLs'));
978
+ listRow.appendChild(U.el('div', 'a-url', lastUrl ? U.t('Last used: {link} · OK to import again', { link: lastUrl })
979
+ : U.t('Addon URLs, API keys and IPTV playlist URLs')));
941
980
  listRow.__onselect = function () {
942
981
  App.openEntry({
943
- title: 'Import configuration file', phone: 'config',
944
- 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.',
982
+ title: U.t('Import configuration file'), phone: 'config',
983
+ 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.'),
945
984
  value: lastUrl || 'https://', placeholder: 'https://example.com/stremiok.txt',
946
985
  validate: function (v) { return U.urlProblem(v) || null; }, // (U.parseUrl: http(s), a real host, no user:password@)
947
986
  onConfirm: function (v) {
948
987
  // Saved even if the fetch fails, so a typo can be fixed instead of retyped.
949
988
  U.store.set(IMPORT_URL_KEY, v);
950
989
  lastUrl = v;
951
- U.toast('Fetching configuration file…', 5000);
990
+ U.toast(U.t('Fetching configuration file…'), 5000);
952
991
  // (what you confirmed is imported even if you've moved on; only the screen
953
992
  // you're on stays: back to Settings only from this entry, still showing)
954
993
  var entry = scr('addaddon'), mine = ++_importGen;
@@ -958,8 +997,8 @@
958
997
  }, function (err) {
959
998
  if (!here()) { return; }
960
999
  var why = U.problem(err);
961
- U.toast(/^too large/.test(why) ? 'That file is ' + why + ': a configuration file is a short list of URLs and keys.'
962
- : 'Could not fetch that configuration file (' + why + '; check the URL / CORS).', 5000);
1000
+ 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 })
1001
+ : U.t('Could not fetch that configuration file ({why}; check the URL / CORS).', { why: why }), 5000);
963
1002
  });
964
1003
  },
965
1004
  // From your phone, the file itself pasted (not a link): imported as it is
@@ -969,7 +1008,7 @@
969
1008
  };
970
1009
  wrap.appendChild(listRow);
971
1010
  wrap.appendChild(U.el('div', 'hint',
972
- 'Accepted lines: addon URLs, M3U/M3U8 URLs, and OMDb, TMDB or MDBList API keys.'));
1011
+ U.t('Accepted lines: addon URLs, M3U/M3U8 URLs, and OMDb, TMDB or MDBList API keys.')));
973
1012
  focusSettings();
974
1013
  }
975
1014
 
@@ -989,15 +1028,15 @@
989
1028
  });
990
1029
  }
991
1030
  function playlistInfo(p) {
992
- if (p.off) { return 'Off — its channels aren’t shown'; }
1031
+ if (p.off) { return U.t('Off — its channels aren’t shown'); }
993
1032
  var st = Stremio.iptvStatus(p.id), parts = [];
994
- if (!st.url) { return 'Not read yet'; }
995
- parts.push(thousands(st.count || 0) + ' channel' + (st.count === 1 ? '' : 's') + (st.groups ? ' in ' + st.groups + ' group' + (st.groups === 1 ? '' : 's') : ''));
996
- if (st.fetchedAt) { var d = new Date(st.fetchedAt); parts.push('downloaded ' + U.dayLabel(st.fetchedAt) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes())); }
997
- if (st.dropped) { parts.push(thousands(st.dropped) + ' more left out (a playlist keeps its first 30,000)'); }
998
- if (p.genres) { parts.push(p.genres.length + ' group' + (p.genres.length === 1 ? '' : 's') + ' chosen'); }
999
- 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'); }
1000
- if (st.uncached) { parts.push('too large to save on the TV: downloaded each launch'); }
1033
+ if (!st.url) { return U.t('Not read yet'); }
1034
+ 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') : ''));
1035
+ 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()) })); }
1036
+ if (st.dropped) { parts.push(U.t('{n} more left out (a playlist keeps its first 30,000)', { n: thousands(st.dropped) })); }
1037
+ if (p.genres) { parts.push(U.tn(p.genres.length, '{n} group chosen', '{n} groups chosen')); }
1038
+ 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')); }
1039
+ if (st.uncached) { parts.push(U.t('too large to save on the TV: downloaded each launch')); }
1001
1040
  var g = guideInfo(p);
1002
1041
  if (g) { parts.push(g); }
1003
1042
  return parts.join(' · ');
@@ -1005,51 +1044,51 @@
1005
1044
  // Its TV guide (js/epg.js): being read, read (for how many of its channels), or why not.
1006
1045
  function guideInfo(p) {
1007
1046
  var g = typeof EPG !== 'undefined' && EPG.status ? EPG.status(p.id) : null;
1008
- if (!g) { return typeof EPG !== 'undefined' && EPG.available && EPG.available() ? 'no TV guide' : ''; }
1047
+ if (!g) { return typeof EPG !== 'undefined' && EPG.available && EPG.available() ? U.t('no TV guide') : ''; }
1009
1048
  if (g.state === 'ready') {
1010
1049
  var d = new Date(g.at);
1011
- return 'TV guide: ' + thousands(g.channels) + ' channel' + (g.channels === 1 ? '' : 's') + ', ' + thousands(g.programmes) + ' programs' + (g.partial ? ' (part of it: too large)' : '') +
1012
- (g.at ? ', read ' + U.dayLabel(g.at) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes()) : '') + (g.error ? ' (the last read failed: ' + g.error + ')' : '');
1050
+ 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)') : '') +
1051
+ (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 }) : '');
1013
1052
  }
1014
- if (g.state === 'failed') { return '⚠ TV guide: ' + (g.error || 'couldn’t be read'); }
1015
- return 'TV guide: reading…';
1053
+ if (g.state === 'failed') { return '⚠ ' + U.t('TV guide: {why}', { why: g.error || U.t('couldn’t be read') }); }
1054
+ return U.t('TV guide: reading…');
1016
1055
  }
1017
1056
  function playlistProblem(p) {
1018
1057
  var st = Stremio.iptvStatus(p.id);
1019
1058
  if (p.off || !st.error) { return ''; }
1020
- return '⚠ ' + (st.stale ? 'Couldn’t refresh it (showing the saved copy): ' : '') + st.error;
1059
+ return '⚠ ' + (st.stale ? U.t('Couldn’t refresh it (showing the saved copy):') + ' ' : '') + st.error;
1021
1060
  }
1022
1061
  // + Add Xtream account: its server, username and password, a page each (a whole Xtream link
1023
1062
  // in the server's fills the rest); checked with the server, then added (Stremio.iptvAddXtream).
1024
1063
  function addXtream() {
1025
1064
  function done(base, user, pass) {
1026
- U.toast('Checking the account…', 15000);
1065
+ U.toast(U.t('Checking the account…'), 15000);
1027
1066
  IPTV.xtreamCheck(base, user, pass).then(function (r) {
1028
- if (r.unreachable) { U.toast('Couldn’t reach the server: check its address (nothing was saved)', 5000); return; }
1029
- if (r.refused) { U.toast('The server refused that username and password' + (r.status ? ' (' + r.status + ')' : '') + ': nothing was saved', 5000); return; }
1067
+ if (r.unreachable) { U.toast(U.t('Couldn’t reach the server: check its address (nothing was saved)'), 5000); return; }
1068
+ 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; }
1030
1069
  Stremio.iptvAddXtream(base, user, pass);
1031
1070
  refreshAddonRows('local:iptv');
1032
- U.toast('Xtream account added: reading its channels and TV guide…', 4000);
1071
+ U.toast(U.t('Xtream account added: reading its channels and TV guide…'), 4000);
1033
1072
  renderSettings();
1034
1073
  });
1035
1074
  }
1036
1075
  App.openEntry({
1037
- title: 'Xtream account: server', phone: 'playlist',
1038
- hint: 'The server address your provider gave you (http://line.example.com:8080), or a whole Xtream link. RETURN cancels.',
1076
+ title: U.t('Xtream account: server'), phone: 'playlist',
1077
+ hint: U.t('The server address your provider gave you (http://line.example.com:8080), or a whole Xtream link. RETURN cancels.'),
1039
1078
  value: 'http://', placeholder: 'http://line.example.com:8080',
1040
- validate: function (v) { return IPTV.xtreamParts(v) ? null : 'That isn’t a server address'; },
1079
+ validate: function (v) { return IPTV.xtreamParts(v) ? null : U.t('That isn’t a server address'); },
1041
1080
  onConfirm: function (v) {
1042
1081
  var x = IPTV.xtreamParts(v);
1043
1082
  App.back();
1044
1083
  if (x.user && x.pass) { done(x.base, x.user, x.pass); return; }
1045
1084
  App.openEntry({
1046
- title: 'Xtream account: username', hint: 'Your account’s username. RETURN cancels.', value: x.user, placeholder: 'username',
1047
- validate: function (u) { return ('' + u).trim() ? null : 'Type the username'; },
1085
+ title: U.t('Xtream account: username'), hint: U.t('Your account’s username. RETURN cancels.'), value: x.user, placeholder: 'username',
1086
+ validate: function (u) { return ('' + u).trim() ? null : U.t('Type the username'); },
1048
1087
  onConfirm: function (u) {
1049
1088
  App.back();
1050
1089
  App.openEntry({
1051
- 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,
1052
- validate: function (p) { return ('' + p) ? null : 'Type the password'; },
1090
+ 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,
1091
+ validate: function (p) { return ('' + p) ? null : U.t('Type the password'); },
1053
1092
  onConfirm: function (p) { App.back(); done(x.base, ('' + u).trim(), '' + p); }
1054
1093
  });
1055
1094
  }
@@ -1061,29 +1100,29 @@
1061
1100
  // the service), then added (Stremio.iptvAddStalker).
1062
1101
  function addStalker() {
1063
1102
  function done(portal, mac) {
1064
- U.toast('Checking the portal…', 60000);
1103
+ U.toast(U.t('Checking the portal…'), 60000);
1065
1104
  IPTV.stalkerCheck(portal, mac).then(function (r) {
1066
- 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; }
1067
- if (r.unreachable) { U.toast('Couldn’t read the portal' + (r.why ? ' (' + r.why + ')' : '') + ': nothing was saved', 6000); return; }
1068
- if (r.refused) { U.toast('The portal refused that MAC address' + (r.why ? ' (' + r.why + ')' : '') + ': nothing was saved', 6000); return; }
1105
+ 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; }
1106
+ if (r.unreachable) { U.toast(U.t('Couldn’t read the portal{why}: nothing was saved', { why: r.why ? ' (' + r.why + ')' : '' }), 6000); return; }
1107
+ if (r.refused) { U.toast(U.t('The portal refused that MAC address{why}: nothing was saved', { why: r.why ? ' (' + r.why + ')' : '' }), 6000); return; }
1069
1108
  Stremio.iptvAddStalker(portal, mac);
1070
1109
  refreshAddonRows('local:iptv');
1071
- 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);
1110
+ 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);
1072
1111
  renderSettings();
1073
1112
  });
1074
1113
  }
1075
1114
  App.openEntry({
1076
- title: 'Stalker portal: address', phone: 'playlist',
1077
- hint: 'The portal address your provider gave you (http://portal.example.com/c/). RETURN cancels.',
1115
+ title: U.t('Stalker portal: address'), phone: 'playlist',
1116
+ hint: U.t('The portal address your provider gave you (http://portal.example.com/c/). RETURN cancels.'),
1078
1117
  value: 'http://', placeholder: 'http://portal.example.com/c/',
1079
- validate: function (v) { return IPTV.stalkerPortal(v) ? null : 'That isn’t a portal address'; },
1118
+ validate: function (v) { return IPTV.stalkerPortal(v) ? null : U.t('That isn’t a portal address'); },
1080
1119
  onConfirm: function (v) {
1081
1120
  var portal = IPTV.stalkerPortal(v);
1082
1121
  App.back();
1083
1122
  App.openEntry({
1084
- title: 'Stalker portal: MAC address', phone: 'mac',
1085
- 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',
1086
- validate: function (m) { return IPTV.macOf(m) ? null : 'A MAC address is six pairs, like 00:1A:79:12:34:56'; },
1123
+ title: U.t('Stalker portal: MAC address'), phone: 'mac',
1124
+ 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'),
1125
+ validate: function (m) { return IPTV.macOf(m) ? null : U.t('A MAC address is six pairs, like 00:1A:79:12:34:56'); },
1087
1126
  onConfirm: function (m) { App.back(); done(portal, IPTV.macOf(m)); }
1088
1127
  });
1089
1128
  }
@@ -1091,24 +1130,24 @@
1091
1130
  }
1092
1131
  // Streaming server: Stremio's or TorrServer, on your network (see Stremio.server). Picking one
1093
1132
  // asks for its address; Test says whether it answers.
1094
- var SERVERS = [['', 'Off'], ['stremio', 'Stremio server'], ['torrserver', 'TorrServer']];
1133
+ var SERVERS = [['', U.t('Off')], ['stremio', U.t('Stremio server')], ['torrserver', U.t('TorrServer')]];
1095
1134
  var SERVER_PORT = { stremio: 11470, torrserver: 8090 };
1096
- var TORRENT_WAITS = [['45', '45 seconds'], ['60', '1 minute'], ['120', '2 minutes'], ['180', '3 minutes'], ['300', '5 minutes']];
1135
+ 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')]];
1097
1136
  function askServerAddress(kind, url) {
1098
1137
  var eg = 'http://192.168.0.10:' + SERVER_PORT[kind];
1099
1138
  App.openEntry({
1100
- title: (kind === 'stremio' ? 'Stremio server' : 'TorrServer') + ': address',
1101
- hint: 'Its address on your network, like ' + eg + '. RETURN cancels.',
1139
+ title: U.t('{server}: address', { server: kind === 'stremio' ? U.t('Stremio server') : 'TorrServer' }),
1140
+ hint: U.t('Its address on your network, like {example}. RETURN cancels.', { example: eg }),
1102
1141
  value: url || 'http://', placeholder: eg, phone: 'server',
1103
1142
  validate: function (v) { return Stremio.serverAddressProblem(v); },
1104
1143
  onConfirm: function (v) { Stremio.setServer({ kind: kind, url: v }); App.back(); renderSettings(); }
1105
1144
  });
1106
1145
  }
1107
1146
  function settingsServer(wrap) {
1108
- wrap.appendChild(U.el('h2', null, 'Streaming server'));
1147
+ wrap.appendChild(U.el('h2', null, U.t('Streaming server')));
1109
1148
  wrap.appendChild(U.el('div', 'hint', 'Torrent-only sources play through it; Stremio’s can also convert a video the TV can’t play.'));
1110
1149
  var sv = Stremio.server();
1111
- wrap.appendChild(subPickRow('Server', SERVERS, 'kind', {
1150
+ wrap.appendChild(subPickRow(U.t('Server'), SERVERS, 'kind', {
1112
1151
  get: function () { return { kind: Stremio.server().kind }; },
1113
1152
  set: function (cfg) {
1114
1153
  var cur = Stremio.server();
@@ -1118,31 +1157,31 @@
1118
1157
  }));
1119
1158
  if (!sv.kind) { return; }
1120
1159
  var addr = U.el('div', 'addon-item focusable cfg-row');
1121
- addr.appendChild(U.el('div', 'a-name', 'Address: ' + sv.url));
1122
- addr.appendChild(U.el('div', 'a-url', 'Press OK to change'));
1160
+ addr.appendChild(U.el('div', 'a-name', U.t('Address:') + ' ' + sv.url));
1161
+ addr.appendChild(U.el('div', 'a-url', U.t('Press OK to change')));
1123
1162
  addr.__onselect = function () { askServerAddress(sv.kind, sv.url); };
1124
1163
  wrap.appendChild(addr);
1125
- var test = U.el('div', 'addon-item focusable cfg-row'), said = U.el('div', 'a-url', 'Press OK to see whether it answers');
1126
- test.appendChild(U.el('div', 'a-name', 'Test'));
1164
+ 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'));
1165
+ test.appendChild(U.el('div', 'a-name', U.t('Test')));
1127
1166
  test.appendChild(said);
1128
1167
  test.__onselect = function () {
1129
- said.textContent = 'Asking…';
1168
+ said.textContent = U.t('Asking…');
1130
1169
  Stremio.testServer().then(function (r) { said.textContent = (r.ok ? '✓ ' : '✗ ') + r.text; });
1131
1170
  };
1132
1171
  wrap.appendChild(test);
1133
- wrap.appendChild(subPickRow('Wait for a torrent to start', TORRENT_WAITS, 'wait', {
1172
+ wrap.appendChild(subPickRow(U.t('Wait for a torrent to start'), TORRENT_WAITS, 'wait', {
1134
1173
  get: function () { return { wait: '' + Stremio.server().wait }; },
1135
1174
  set: function (cfg) { Stremio.setServer({ kind: Stremio.server().kind, wait: +cfg.wait }); }
1136
1175
  }));
1137
1176
  if (sv.kind === 'stremio') {
1138
- wrap.appendChild(subPickRow('Convert videos the TV can’t play', [['on', 'On'], ['off', 'Off']], 'convert', {
1177
+ wrap.appendChild(subPickRow(U.t('Convert videos the TV can’t play'), [['on', U.t('On')], ['off', U.t('Off')]], 'convert', {
1139
1178
  get: function () { return { convert: Stremio.server().convert ? 'on' : 'off' }; },
1140
1179
  set: function (cfg) { Stremio.setServer({ kind: 'stremio', convert: cfg.convert === 'on' }); }
1141
1180
  }));
1142
1181
  }
1143
1182
  }
1144
1183
 
1145
- var IPTV_EVERY = [['0', 'Off'], ['1', 'Every hour'], ['3', 'Every 3 hours'], ['6', 'Every 6 hours'], ['12', 'Every 12 hours']];
1184
+ 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')]];
1146
1185
  function settingsIptv(wrap) {
1147
1186
  wrap.appendChild(U.el('h2', null, 'IPTV'));
1148
1187
  var playlists = Stremio.iptvGetPlaylists ? Stremio.iptvGetPlaylists() : [];
@@ -1151,7 +1190,7 @@
1151
1190
  // Combined load status — turns silent per-playlist fetch failures into a visible message.
1152
1191
  var statusEl = null;
1153
1192
  if (playlists.some(function (p) { return !p.off; }) && Stremio.iptvLoad) {
1154
- statusEl = U.el('div', 'hint', 'Checking playlists…');
1193
+ statusEl = U.el('div', 'hint', U.t('Checking playlists…'));
1155
1194
  wrap.appendChild(statusEl);
1156
1195
  _iptvStatusEl = statusEl; // (updated as big playlists are read, see below)
1157
1196
  }
@@ -1170,7 +1209,7 @@
1170
1209
  }
1171
1210
  var btns = orderButtons(function (dir, name) { move(dir, name)(); }, ctl);
1172
1211
  var item = ctl(U.el('div', 'addon-item focusable playlist-item'), 'item');
1173
- item.appendChild(U.el('div', 'a-name', label + (playlist.off ? ' (off)' : '')));
1212
+ item.appendChild(U.el('div', 'a-name', label + (playlist.off ? ' ' + U.t('(off)') : '')));
1174
1213
  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)
1175
1214
  var info = U.el('div', 'a-url playlist-info', playlistInfo(playlist));
1176
1215
  var problem = U.el('div', 'a-url addon-said', playlistProblem(playlist));
@@ -1200,46 +1239,45 @@
1200
1239
  groups += st.groups || 0;
1201
1240
  if (st.error) { failed++; }
1202
1241
  });
1203
- statusEl.textContent = (failed ? '⚠ ' : '✓ ') + 'Loaded ' + thousands(channels) + ' channels from ' +
1204
- on + ' playlist(s) in ' + groups + ' group(s).' + (failed ? (' ' + failed + ' playlist(s) reported an error.') : '') +
1205
- (on < playlists.length ? ' ' + (playlists.length - on) + ' switched off.' : '');
1242
+ 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 })) : '') +
1243
+ (on < playlists.length ? ' ' + U.t('{n} switched off.', { n: playlists.length - on }) : '');
1206
1244
  });
1207
1245
  }
1208
1246
 
1209
1247
  var add = U.el('div', 'addon-item focusable add-row');
1210
- add.appendChild(U.el('div', 'a-name', '+ Add playlist'));
1211
- add.appendChild(U.el('div', 'a-url', 'Enter another M3U/M3U8 playlist URL'));
1248
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add playlist')));
1249
+ add.appendChild(U.el('div', 'a-url', U.t('Enter another M3U/M3U8 playlist URL')));
1212
1250
  add.__onselect = function () {
1213
1251
  App.openEntry({
1214
- title: 'Add IPTV playlist', phone: 'playlist',
1215
- hint: 'Type an M3U/M3U8 playlist URL. Nothing is saved until you Confirm.',
1252
+ title: U.t('Add IPTV playlist'), phone: 'playlist',
1253
+ hint: U.t('Type an M3U/M3U8 playlist URL. Nothing is saved until you Confirm.'),
1216
1254
  value: 'https://', placeholder: 'https://example.com/playlist.m3u',
1217
1255
  validate: function (v) { return U.urlProblem(v) || null; }, // (U.parseUrl: http(s), a real host, no user:password@)
1218
1256
  onConfirm: function (v) {
1219
1257
  Stremio.iptvAddPlaylist(v);
1220
1258
  refreshAddonRows('local:iptv');
1221
- U.toast('Playlist added');
1259
+ U.toast(U.t('Playlist added'));
1222
1260
  App.back(); renderSettings();
1223
1261
  }
1224
1262
  });
1225
1263
  };
1226
1264
  wrap.appendChild(add);
1227
1265
  var xt = U.el('div', 'addon-item focusable add-row');
1228
- xt.appendChild(U.el('div', 'a-name', '+ Add Xtream account'));
1229
- xt.appendChild(U.el('div', 'a-url', 'Its server, username and password: its channels and TV guide added'));
1266
+ xt.appendChild(U.el('div', 'a-name', U.t('+ Add Xtream account')));
1267
+ xt.appendChild(U.el('div', 'a-url', U.t('Its server, username and password: its channels and TV guide added')));
1230
1268
  xt.__onselect = addXtream;
1231
1269
  wrap.appendChild(xt);
1232
1270
  var sk = U.el('div', 'addon-item focusable add-row');
1233
- sk.appendChild(U.el('div', 'a-name', '+ Add Stalker portal'));
1234
- sk.appendChild(U.el('div', 'a-url', 'Its address and MAC address: its channels added'));
1271
+ sk.appendChild(U.el('div', 'a-name', U.t('+ Add Stalker portal')));
1272
+ sk.appendChild(U.el('div', 'a-url', U.t('Its address and MAC address: its channels added')));
1235
1273
  sk.__onselect = addStalker;
1236
1274
  wrap.appendChild(sk);
1237
1275
  if (playlists.length && Stremio.iptvRefreshEvery) { // (all of them, with their guides, as Reload does)
1238
- wrap.appendChild(subPickRow('Auto-refresh', IPTV_EVERY, 'every',
1276
+ wrap.appendChild(subPickRow(U.t('Auto-refresh'), IPTV_EVERY, 'every',
1239
1277
  { get: function () { return { every: String(Stremio.iptvRefreshEvery()) }; }, set: function (c) { Stremio.iptvSetRefreshEvery(+c.every); } }));
1240
1278
  }
1241
- wrap.appendChild(subPickRow('Stalker channels', [['pages', 'First 100 pages (about 1,400 channels)'], ['all', 'Whole portal (up to 30,000 channels)']], 'stalker', {
1242
- 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',
1279
+ 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', {
1280
+ 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'),
1243
1281
  get: function () { return { stalker: IPTV.stalkerAll() ? 'all' : 'pages' }; },
1244
1282
  set: function (c) {
1245
1283
  var on = c.stalker === 'all', was = IPTV.stalkerAll();
@@ -1247,20 +1285,20 @@
1247
1285
  if (!on || was) { return; }
1248
1286
  var mine = playlists.filter(IPTV.isStalker); // (read again now: leave StremioK open meanwhile)
1249
1287
  if (!mine.length) { return; }
1250
- U.toast('Reading the whole portal: this can take many minutes, leave StremioK open', 6000);
1288
+ U.toast(U.t('Reading the whole portal: this can take many minutes, leave StremioK open'), 6000);
1251
1289
  mine.forEach(function (p) { Stremio.iptvReload(p.id).then(function () { refreshAddonRows('local:iptv'); }); });
1252
1290
  }
1253
1291
  }));
1254
1292
 
1255
1293
  if (typeof StVod !== 'undefined' && StVod.keepMinutes) { // (what the service keeps of a portal's films and series)
1256
- wrap.appendChild(subPickRow('Stalker films and series', [['10', 'Kept 10 minutes'], ['5', 'Kept 5 minutes'], ['0', 'Off (asked each time)']], 'keep', {
1294
+ 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', {
1257
1295
  get: function () { return { keep: String(StVod.keepMinutes()) }; },
1258
1296
  set: function (c) { StVod.setKeepMinutes(+c.keep); }
1259
1297
  }));
1260
1298
  }
1261
1299
 
1262
1300
  wrap.appendChild(U.el('div', 'hint',
1263
- 'Channels are grouped into IPTV and Radio rows on Home. ▲ / ▼ set the playlists\' order: a channel in two playlists comes from the first.'));
1301
+ 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.')));
1264
1302
  var s = scr('settings'), want = null;
1265
1303
  if (_iptvFocus) {
1266
1304
  var nodes = wrap.querySelectorAll('.playlist-row .focusable');
@@ -1278,11 +1316,11 @@
1278
1316
  // also be added by holding OK on one, wherever it's shown.)
1279
1317
  var _ytFocus = null; // { id, ctl } to focus once the page is drawn again
1280
1318
  function ytDescribe(x) {
1281
- var what = { channel: 'Channel', playlist: 'Playlist', search: 'Search' }[YouTube.sourceKind(x.src)];
1319
+ var kind = YouTube.sourceKind(x.src), what = { channel: U.t('Channel'), playlist: U.t('Playlist'), search: U.t('Search') }[kind];
1282
1320
  var bits = [what + ': ' + x.src.replace(/^search:/i, '')];
1283
1321
  if (x.kind !== 'auto') { bits.push(YouTube.KIND_NAMES[x.kind]); }
1284
- if (what === 'Search' && x.sort !== 'relevance') { bits.push('by ' + YouTube.SORT_NAMES[x.sort].toLowerCase()); }
1285
- if (x.type !== 'YouTube') { bits.push('type “' + x.type + '”'); }
1322
+ if (kind === 'search' && x.sort !== 'relevance') { bits.push(U.t('by {order}', { order: YouTube.SORT_NAMES[x.sort].toLowerCase() })); }
1323
+ if (x.type !== 'YouTube') { bits.push(U.t('type “{type}”', { type: x.type })); }
1286
1324
  return bits.join(' · ');
1287
1325
  }
1288
1326
  function ytChanged(focus) {
@@ -1295,35 +1333,35 @@
1295
1333
  validate: validate || function () { return null; },
1296
1334
  onConfirm: function (v) { App.back(); onConfirm(('' + v).trim()); } }); // (back on Settings, then redrawn on the change)
1297
1335
  }
1298
- var YT_SOURCE_HINT = 'A channel (like @ScreenJunkies, or its link), a playlist link, or words to search YouTube for (like “honest trailers”).';
1336
+ 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”).');
1299
1337
  // YouTubio's catalogs as yours (its own feeds need its sign-in: left out), then its
1300
1338
  // addon can go.
1301
1339
  function copyFrom(y) {
1302
1340
  var info = YouTube.fromYouTubio(y.url);
1303
- confirm('Copy ' + info.list.length + ' catalog' + (info.list.length === 1 ? '' : 's') + ' from YouTubio (' + y.host + ') to your YouTube?' +
1304
- (info.left ? ' ' + info.left + ' of its own (subscriptions, its search…) need its sign-in or are YouTube in Search already: left out.' : ''), 'Copy', function () {
1341
+ 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 }) +
1342
+ (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 () {
1305
1343
  var r = YouTube.copyYouTubio(y.url);
1306
1344
  ytChanged(OPT('copy'));
1307
- U.toast(r.added + ' catalog' + (r.added === 1 ? '' : 's') + ' copied' + (r.already ? ', ' + r.already + ' you had already' : ''), 3500);
1345
+ U.toast(U.tn(r.added, '{n} catalog copied', '{n} catalogs copied') + (r.already ? ', ' + U.t('{n} you had already', { n: r.already }) : ''), 3500);
1308
1346
  setTimeout(function () {
1309
- confirm('Remove the YouTubio addon? Its catalogs are in your YouTube now.', 'Remove', function () {
1347
+ confirm(U.t('Remove the YouTubio addon? Its catalogs are in your YouTube now.'), U.t('Remove'), function () {
1310
1348
  Stremio.removeAddon(y.url);
1311
1349
  refreshAddonRows();
1312
1350
  ytChanged(null);
1313
- U.toast('YouTubio removed');
1351
+ U.toast(U.t('YouTubio removed'));
1314
1352
  });
1315
1353
  }, 400);
1316
1354
  });
1317
1355
  }
1318
1356
  function OPT(name) { return { id: 'opt', ctl: name }; } // (a settings row, to come back to)
1319
1357
  function optRow(node, name) { node.setAttribute('data-pl', 'opt'); node.setAttribute('data-ctl', name); return node; }
1320
- function sbModeShort(cat, mode) { return mode === 'show' && (cat === 'poi_highlight' || cat === 'exclusive_access') ? 'On' : YouTube.SB_MODE_NAMES[mode].split(' (')[0]; }
1358
+ function sbModeShort(cat, mode) { return mode === 'show' && (cat === 'poi_highlight' || cat === 'exclusive_access') ? U.t('On') : YouTube.SB_MODE_NAMES[mode].split(' (')[0]; }
1321
1359
  // SponsorBlock sections: each, and what's done with it.
1322
1360
  function sbSections(focusCat) {
1323
1361
  var modes = YouTube.sbModes();
1324
- pickList('SponsorBlock sections', YouTube.SB_CATS.map(function (k) { return [k, YouTube.SB_NAMES[k] + ' · ' + sbModeShort(k, modes[k])]; }), focusCat || null, function (cat) {
1325
- var names = cat === 'poi_highlight' ? { show: 'On: “◆ Highlight” on the UP bar goes to it', off: 'Off' }
1326
- : cat === 'exclusive_access' ? { show: 'On: a note when the video starts', off: 'Off' } : YouTube.SB_MODE_NAMES;
1362
+ 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) {
1363
+ var names = cat === 'poi_highlight' ? { show: U.t('On: “◆ Highlight” on the UP bar goes to it'), off: U.t('Off') }
1364
+ : cat === 'exclusive_access' ? { show: U.t('On: a note when the video starts'), off: U.t('Off') } : YouTube.SB_MODE_NAMES;
1327
1365
  pickList(YouTube.SB_NAMES[cat], YouTube.sbModesFor(cat).map(function (m) { return [m, names[m]]; }), modes[cat], function (m) {
1328
1366
  YouTube.setSbMode(cat, m);
1329
1367
  ytChanged(OPT('sbcats'));
@@ -1332,66 +1370,66 @@
1332
1370
  });
1333
1371
  }
1334
1372
  function ytActions(x) {
1335
- var opts = [['rename', 'Rename · ' + x.name], ['src', 'Source · ' + x.src.replace(/^search:/i, '')],
1336
- ['kind', 'Search type · ' + YouTube.KIND_NAMES[x.kind]], ['sort', 'Sort order · ' + YouTube.SORT_NAMES[x.sort]],
1337
- ['type', 'Type · ' + x.type], ['off', x.off ? 'Turn on' : 'Turn off'], ['remove', 'Remove']];
1373
+ var opts = [['rename', U.t('Rename') + ' · ' + x.name], ['src', U.t('Source') + ' · ' + x.src.replace(/^search:/i, '')],
1374
+ ['kind', U.t('Search type') + ' · ' + YouTube.KIND_NAMES[x.kind]], ['sort', U.t('Sort order') + ' · ' + YouTube.SORT_NAMES[x.sort]],
1375
+ ['type', U.t('Type') + ' · ' + x.type], ['off', x.off ? U.t('Turn on') : U.t('Turn off')], ['remove', U.t('Remove')]];
1338
1376
  pickList(x.name, opts, null, function (a) {
1339
1377
  var focus = { id: x.id, ctl: 'item' };
1340
1378
  if (a === 'rename') {
1341
- ytEntry('Rename YouTube catalog', 'Its name on Home and in Discover.', x.name, x.name,
1342
- function (v) { return ('' + v).trim() ? null : 'Type a name'; }, function (v) { YouTube.update(x.id, { name: v }); ytChanged(focus); });
1379
+ ytEntry(U.t('Rename YouTube catalog'), U.t('Its name on Home and in Discover.'), x.name, x.name,
1380
+ function (v) { return ('' + v).trim() ? null : U.t('Type a name'); }, function (v) { YouTube.update(x.id, { name: v }); ytChanged(focus); });
1343
1381
  } else if (a === 'src') {
1344
- ytEntry('YouTube catalog source', YT_SOURCE_HINT, x.src.replace(/^search:/i, ''), '@channel, a playlist link, or words',
1345
- function (v) { return ('' + v).trim() ? null : 'Type a channel, a playlist or words'; }, function (v) { YouTube.update(x.id, { src: v }); ytChanged(focus); });
1382
+ ytEntry(U.t('YouTube catalog source'), YT_SOURCE_HINT, x.src.replace(/^search:/i, ''), U.t('@channel, a playlist link, or words'),
1383
+ 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); });
1346
1384
  } else if (a === 'kind') {
1347
- 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); });
1385
+ 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); });
1348
1386
  } else if (a === 'sort') {
1349
- 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); });
1387
+ 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); });
1350
1388
  } else if (a === 'type') {
1351
- ytEntry('YouTube catalog type', 'Where it\'s listed: its Home tab and Discover type, like “Podcasts”. Leave it empty for “YouTube”.', x.type, 'YouTube',
1389
+ 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',
1352
1390
  null, function (v) { YouTube.update(x.id, { type: v || 'YouTube' }); ytChanged(focus); });
1353
1391
  } else if (a === 'off') {
1354
1392
  YouTube.update(x.id, { off: !x.off }); ytChanged(focus);
1355
1393
  } else if (a === 'remove') {
1356
- confirm('Remove the YouTube catalog “' + x.name + '”?', 'Remove', function () { YouTube.remove(x.id); ytChanged(null); });
1394
+ confirm(U.t('Remove the YouTube catalog “{name}”?', { name: x.name }), U.t('Remove'), function () { YouTube.remove(x.id); ytChanged(null); });
1357
1395
  }
1358
1396
  });
1359
1397
  }
1360
1398
  function settingsYouTube(wrap) {
1361
1399
  wrap.appendChild(U.el('h2', null, 'YouTube'));
1362
- if (typeof YouTube === 'undefined') { wrap.appendChild(U.el('div', 'hint', 'Not available here.')); focusSettings(); return; }
1400
+ if (typeof YouTube === 'undefined') { wrap.appendChild(U.el('div', 'hint', U.t('Not available here.'))); focusSettings(); return; }
1363
1401
  var on = YouTube.searchOn();
1364
1402
  var srch = U.el('div', 'addon-item focusable cfg-row');
1365
- srch.appendChild(U.el('div', 'a-name', 'YouTube in Search: ' + (on ? 'On' : 'Off')));
1366
- 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')));
1403
+ srch.appendChild(U.el('div', 'a-name', U.t('YouTube in Search:') + ' ' + (on ? U.t('On') : U.t('Off'))));
1404
+ 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'))));
1367
1405
  srch.__onselect = function () { YouTube.setSearch(!on); ytChanged(OPT('search')); };
1368
1406
  wrap.appendChild(optRow(srch, 'search'));
1369
1407
  var orig = YouTube.originalTitles(), tRow = U.el('div', 'addon-item focusable cfg-row');
1370
- tRow.appendChild(U.el('div', 'a-name', 'Video titles: ' + (orig ? 'Original' : 'English')));
1371
- 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')));
1408
+ tRow.appendChild(U.el('div', 'a-name', U.t('Video titles:') + ' ' + (orig ? U.t('Original') : U.t('English'))));
1409
+ 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'))));
1372
1410
  tRow.__onselect = function () { YouTube.setOriginalTitles(!orig); ytChanged(OPT('titles')); };
1373
1411
  wrap.appendChild(optRow(tRow, 'titles'));
1374
1412
 
1375
1413
  // SponsorBlock (sections viewers marked) and DeArrow (titles / thumbnails they wrote)
1376
1414
  var sb = YouTube.sbOn(), modes = YouTube.sbModes();
1377
1415
  var sbRow = U.el('div', 'addon-item focusable cfg-row');
1378
- sbRow.appendChild(U.el('div', 'a-name', 'SponsorBlock: ' + (sb ? 'On' : 'Off')));
1379
- 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')));
1416
+ sbRow.appendChild(U.el('div', 'a-name', 'SponsorBlock: ' + (sb ? U.t('On') : U.t('Off'))));
1417
+ 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'))));
1380
1418
  sbRow.__onselect = function () { YouTube.setSbOn(!sb); ytChanged(OPT('sb')); };
1381
1419
  wrap.appendChild(optRow(sbRow, 'sb'));
1382
1420
  if (sb) {
1383
1421
  var cats = U.el('div', 'addon-item focusable cfg-row');
1384
- cats.appendChild(U.el('div', 'a-name', 'SponsorBlock sections'));
1385
- 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'));
1422
+ cats.appendChild(U.el('div', 'a-name', U.t('SponsorBlock sections')));
1423
+ 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')));
1386
1424
  cats.__onselect = function () { sbSections(); };
1387
1425
  wrap.appendChild(optRow(cats, 'sbcats'));
1388
1426
  }
1389
1427
  var da = YouTube.dearrow();
1390
- [['titles', 'DeArrow titles', 'Titles other viewers rewrote to say what a video is (the original on its page)', 'YouTube\'s titles'],
1391
- ['thumbs', 'DeArrow thumbnails', 'A still from the video in place of a clickbait thumbnail, where viewers chose one', 'YouTube\'s thumbnails']].forEach(function (d) {
1428
+ [['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')],
1429
+ ['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) {
1392
1430
  var onD = da[d[0]], r = U.el('div', 'addon-item focusable cfg-row');
1393
- r.appendChild(U.el('div', 'a-name', d[1] + ': ' + (onD ? 'On' : 'Off')));
1394
- r.appendChild(U.el('div', 'a-url', (onD ? d[2] : d[3]) + ' · OK to turn ' + (onD ? 'off' : 'on')));
1431
+ r.appendChild(U.el('div', 'a-name', d[1] + ': ' + (onD ? U.t('On') : U.t('Off'))));
1432
+ 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'))));
1395
1433
  r.__onselect = function () { var p = {}; p[d[0]] = !onD; YouTube.setDearrow(p); ytChanged(OPT('da' + d[0])); };
1396
1434
  wrap.appendChild(optRow(r, 'da' + d[0]));
1397
1435
  });
@@ -1403,7 +1441,7 @@
1403
1441
  function ctl(node, name) { node.setAttribute('data-pl', x.id); node.setAttribute('data-ctl', name); return node; }
1404
1442
  var btns = orderButtons(function (dir, name) { if (YouTube.move(x.id, dir)) { ytChanged({ id: x.id, ctl: name }); } }, ctl);
1405
1443
  var item = ctl(U.el('div', 'addon-item focusable playlist-item yt-catalog'), 'item');
1406
- item.appendChild(U.el('div', 'a-name', x.name + (x.off ? ' (off)' : '')));
1444
+ item.appendChild(U.el('div', 'a-name', x.name + (x.off ? ' ' + U.t('(off)') : '')));
1407
1445
  item.appendChild(U.el('div', 'a-url', ytDescribe(x)));
1408
1446
  item.__onselect = function () { ytActions(x); };
1409
1447
  btns.forEach(function (b) { frow.appendChild(b); }); frow.appendChild(item);
@@ -1411,13 +1449,13 @@
1411
1449
  });
1412
1450
 
1413
1451
  var add = U.el('div', 'addon-item focusable add-row');
1414
- add.appendChild(U.el('div', 'a-name', '+ Add catalog'));
1415
- 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)'));
1452
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add catalog')));
1453
+ 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)')));
1416
1454
  add.__onselect = function () {
1417
- 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) {
1455
+ 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) {
1418
1456
  var id = YouTube.add({ src: src });
1419
- if (!id) { U.toast('Couldn\'t add it (40 catalogs at most)'); return; }
1420
- U.toast('Added: OK on it to rename it or change what it lists', 3500);
1457
+ if (!id) { U.toast(U.t('Couldn\'t add it (40 catalogs at most)')); return; }
1458
+ U.toast(U.t('Added: OK on it to rename it or change what it lists'), 3500);
1421
1459
  ytChanged({ id: id, ctl: 'item' });
1422
1460
  });
1423
1461
  };
@@ -1425,11 +1463,11 @@
1425
1463
  var ytb = YouTube.youTubioAddons();
1426
1464
  if (ytb.length) { // (a YouTubio addon installed: its catalogs can come over)
1427
1465
  var copy = optRow(U.el('div', 'addon-item focusable add-row'), 'copy');
1428
- copy.appendChild(U.el('div', 'a-name', '+ Copy from YouTubio'));
1429
- copy.appendChild(U.el('div', 'a-url', ytb.map(function (y) { return y.host + ': ' + y.count + ' catalog' + (y.count === 1 ? '' : 's'); }).join(' · ')));
1466
+ copy.appendChild(U.el('div', 'a-name', U.t('+ Copy from YouTubio')));
1467
+ copy.appendChild(U.el('div', 'a-url', ytb.map(function (y) { return y.host + ': ' + U.tn(y.count, '{n} catalog', '{n} catalogs'); }).join(' · ')));
1430
1468
  copy.__onselect = function () {
1431
1469
  if (ytb.length === 1) { copyFrom(ytb[0]); return; }
1432
- 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]); });
1470
+ 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]); });
1433
1471
  };
1434
1472
  wrap.appendChild(copy);
1435
1473
  }
@@ -1451,24 +1489,24 @@
1451
1489
  var val = Stremio.getIntegrations()[key] || '';
1452
1490
  var r = U.el('div', 'addon-item focusable');
1453
1491
  r.appendChild(U.el('div', 'a-name', title));
1454
- r.appendChild(U.el('div', 'a-url', val ? ('Set — ' + maskKey(val)) : 'Not set — press OK to enter'));
1492
+ r.appendChild(U.el('div', 'a-url', val ? U.t('Set — {key}', { key: maskKey(val) }) : U.t('Not set — press OK to enter')));
1455
1493
  r.__onselect = function () {
1456
1494
  App.openEntry({
1457
1495
  title: title,
1458
- hint: 'Paste your key, then Confirm. Use Validate to test it. Leave blank and Confirm to clear.',
1496
+ hint: U.t('Paste your key, then Confirm. Use Validate to test it. Leave blank and Confirm to clear.'),
1459
1497
  value: val, placeholder: placeholder, validator: validator,
1460
- onConfirm: function (v) { Stremio.setIntegration(key, v); U.toast(v ? 'Saved' : 'Cleared'); App.back(); renderSettings(); }
1498
+ onConfirm: function (v) { Stremio.setIntegration(key, v); U.toast(v ? U.t('Saved') : U.t('Cleared')); App.back(); renderSettings(); }
1461
1499
  });
1462
1500
  };
1463
1501
  return r;
1464
1502
  }
1465
1503
 
1466
1504
  function settingsIntegrations(wrap) {
1467
- wrap.appendChild(U.el('h2', null, 'Integrations'));
1505
+ wrap.appendChild(U.el('h2', null, U.t('Integrations')));
1468
1506
  if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
1469
- wrap.appendChild(keyRow('OMDb API key', 'omdb', 'OMDb API key', Stremio.omdbValidate));
1470
- wrap.appendChild(keyRow('TMDB API key (v3)', 'tmdb', 'TMDB v3 API key', Stremio.tmdbValidate));
1471
- wrap.appendChild(keyRow('MDBList API key', 'mdblist', 'MDBList API key', Stremio.mdblistValidate));
1507
+ wrap.appendChild(keyRow(U.t('OMDb API key'), 'omdb', U.t('OMDb API key'), Stremio.omdbValidate));
1508
+ wrap.appendChild(keyRow(U.t('TMDB API key (v3)'), 'tmdb', U.t('TMDB v3 API key'), Stremio.tmdbValidate));
1509
+ wrap.appendChild(keyRow(U.t('MDBList API key'), 'mdblist', U.t('MDBList API key'), Stremio.mdblistValidate));
1472
1510
  if (Stremio.autoWatchRegion) { wrap.appendChild(regionRow()); }
1473
1511
 
1474
1512
  // Trakt: your account (StremioK is the Trakt app: nothing to set up)
@@ -1476,38 +1514,44 @@
1476
1514
  wrap.appendChild(U.el('h2', null, 'Trakt'));
1477
1515
  wrap.appendChild(traktAccountRow());
1478
1516
  if (Trakt.connectStatus().connected) { wrap.appendChild(traktSyncRow()); }
1479
- 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. ' +
1480
- 'Your watched marks and Continue Watching then sync with Trakt.'));
1517
+ 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.')));
1518
+ }
1519
+
1520
+ // Your Stremio account, kept in step (js/stremio-sync.js)
1521
+ if (typeof StremioSync !== 'undefined' && typeof StremioAccount !== 'undefined') {
1522
+ wrap.appendChild(U.el('h2', null, U.t('Stremio account')));
1523
+ wrap.appendChild(stremioAccountRow());
1524
+ 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.')));
1481
1525
  }
1482
1526
 
1483
1527
  wrap.appendChild(U.el('div', 'hint',
1484
- 'Keys are stored on this TV only. OMDb gives real IMDb per-episode ratings (used first when set); TMDB adds episode images & ratings.'));
1528
+ 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.')));
1485
1529
  focusSettings();
1486
1530
  }
1487
1531
 
1488
1532
  // The country TMDB's "where to watch" services are for (a title's sources). Automatic:
1489
1533
  // the TV's language region, which a language-only setting ("en") doesn't have.
1490
- var WATCH_REGIONS = [['AR', 'Argentina'], ['AU', 'Australia'], ['AT', 'Austria'], ['BE', 'Belgium'], ['BR', 'Brazil'],
1491
- ['BG', 'Bulgaria'], ['CA', 'Canada'], ['CL', 'Chile'], ['CO', 'Colombia'], ['CZ', 'Czech Republic'], ['DK', 'Denmark'],
1492
- ['EC', 'Ecuador'], ['EG', 'Egypt'], ['EE', 'Estonia'], ['FI', 'Finland'], ['FR', 'France'], ['DE', 'Germany'],
1493
- ['GR', 'Greece'], ['HK', 'Hong Kong'], ['HU', 'Hungary'], ['IS', 'Iceland'], ['IN', 'India'], ['ID', 'Indonesia'],
1494
- ['IE', 'Ireland'], ['IL', 'Israel'], ['IT', 'Italy'], ['JP', 'Japan'], ['LV', 'Latvia'], ['LT', 'Lithuania'],
1495
- ['MY', 'Malaysia'], ['MX', 'Mexico'], ['NL', 'Netherlands'], ['NZ', 'New Zealand'], ['NO', 'Norway'], ['PE', 'Peru'],
1496
- ['PH', 'Philippines'], ['PL', 'Poland'], ['PT', 'Portugal'], ['RO', 'Romania'], ['SA', 'Saudi Arabia'],
1497
- ['SG', 'Singapore'], ['SK', 'Slovakia'], ['ZA', 'South Africa'], ['KR', 'South Korea'], ['ES', 'Spain'],
1498
- ['SE', 'Sweden'], ['CH', 'Switzerland'], ['TW', 'Taiwan'], ['TH', 'Thailand'], ['TR', 'Turkey'], ['UA', 'Ukraine'],
1499
- ['AE', 'United Arab Emirates'], ['GB', 'United Kingdom'], ['US', 'United States'], ['VE', 'Venezuela']];
1534
+ var WATCH_REGIONS = [['AR', U.t('Argentina')], ['AU', U.t('Australia')], ['AT', U.t('Austria')], ['BE', U.t('Belgium')], ['BR', U.t('Brazil')],
1535
+ ['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')],
1536
+ ['EC', U.t('Ecuador')], ['EG', U.t('Egypt')], ['EE', U.t('Estonia')], ['FI', U.t('Finland')], ['FR', U.t('France')], ['DE', U.t('Germany')],
1537
+ ['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')],
1538
+ ['IE', U.t('Ireland')], ['IL', U.t('Israel')], ['IT', U.t('Italy')], ['JP', U.t('Japan')], ['LV', U.t('Latvia')], ['LT', U.t('Lithuania')],
1539
+ ['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')],
1540
+ ['PH', U.t('Philippines')], ['PL', U.t('Poland')], ['PT', U.t('Portugal')], ['RO', U.t('Romania')], ['SA', U.t('Saudi Arabia')],
1541
+ ['SG', U.t('Singapore')], ['SK', U.t('Slovakia')], ['ZA', U.t('South Africa')], ['KR', U.t('South Korea')], ['ES', U.t('Spain')],
1542
+ ['SE', U.t('Sweden')], ['CH', U.t('Switzerland')], ['TW', U.t('Taiwan')], ['TH', U.t('Thailand')], ['TR', U.t('Turkey')], ['UA', U.t('Ukraine')],
1543
+ ['AE', U.t('United Arab Emirates')], ['GB', U.t('United Kingdom')], ['US', U.t('United States')], ['VE', U.t('Venezuela')]];
1500
1544
  function regionRow() {
1501
1545
  var auto = Stremio.autoWatchRegion();
1502
- 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] + ')']; }));
1546
+ 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] + ')']; }));
1503
1547
  var row = U.el('div', 'addon-item focusable cfg-row');
1504
1548
  var name = U.el('div', 'a-name');
1505
- function render() { name.textContent = 'Where to watch: country: ' + labelFor(list, Stremio.getPrefs().watchRegion); }
1549
+ function render() { name.textContent = U.t('Where to watch: country:') + ' ' + labelFor(list, Stremio.getPrefs().watchRegion); }
1506
1550
  render();
1507
1551
  row.appendChild(name);
1508
- row.appendChild(U.el('div', 'a-url', 'The services TMDB lists on a title\'s page are for this country · OK to choose'));
1552
+ 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')));
1509
1553
  row.__onselect = function () {
1510
- pickList('Where to watch: country', list, Stremio.getPrefs().watchRegion, function (v) { Stremio.setPref('watchRegion', v); render(); });
1554
+ pickList(U.t('Where to watch: country'), list, Stremio.getPrefs().watchRegion, function (v) { Stremio.setPref('watchRegion', v); render(); });
1511
1555
  };
1512
1556
  return row;
1513
1557
  }
@@ -1515,17 +1559,17 @@
1515
1559
  function traktAccountRow() {
1516
1560
  var st = Trakt.connectStatus();
1517
1561
  var r = U.el('div', 'addon-item focusable');
1518
- r.appendChild(U.el('div', 'a-name', 'Trakt account'));
1562
+ r.appendChild(U.el('div', 'a-name', U.t('Trakt account')));
1519
1563
  r.appendChild(U.el('div', 'a-url',
1520
- st.connected && st.reconnect ? ('Trakt needs reconnecting (' + (st.user || 'Trakt') + '): its sign-in no longer works — press OK to connect again')
1521
- : st.connected ? ('Connected as ' + (st.user || 'Trakt') + ' — press OK to disconnect')
1522
- : 'Not connected — press OK to connect'));
1564
+ 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' })
1565
+ : st.connected ? U.t('Connected as {user} — press OK to disconnect', { user: st.user || 'Trakt' })
1566
+ : U.t('Not connected — press OK to connect')));
1523
1567
  r.__onselect = function () {
1524
1568
  if (st.connected && st.reconnect) { traktConnect(); return; }
1525
1569
  if (st.connected) {
1526
- confirm('Disconnect Trakt account?', 'Disconnect', function () {
1570
+ confirm(U.t('Disconnect Trakt account?'), U.t('Disconnect'), function () {
1527
1571
  Trakt.disconnect();
1528
- U.toast('Trakt disconnected');
1572
+ U.toast(U.t('Trakt disconnected'));
1529
1573
  markHomeDirty();
1530
1574
  renderSettings();
1531
1575
  });
@@ -1542,40 +1586,86 @@
1542
1586
  var st = Trakt.connectStatus(), r = U.el('div', 'addon-item focusable cfg-row trakt-sync');
1543
1587
  function two(n) { return (n < 10 ? '0' : '') + n; }
1544
1588
  var d = st.lastSync ? new Date(st.lastSync) : null;
1545
- var last = d ? 'Last synced ' + (U.dayLabel ? U.dayLabel(st.lastSync) + ' ' : '') + two(d.getHours()) + ':' + two(d.getMinutes()) : 'Not synced yet';
1589
+ 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');
1546
1590
  var bits = [last];
1547
- if (st.pending) { bits.push(st.pending + ' change' + (st.pending === 1 ? '' : 's') + ' waiting to reach Trakt'); }
1548
- if (st.failed) { bits.push('⚠ ' + st.failed + ' change' + (st.failed === 1 ? '' : 's') + ' not sent'); }
1549
- r.appendChild(U.el('div', 'a-name', 'Trakt sync: ' + (st.failed ? 'some changes not sent' : st.pending ? 'changes waiting' : 'up to date')));
1550
- r.appendChild(U.el('div', 'a-url', bits.join(' · ') + ' · OK for options'));
1591
+ if (st.pending) { bits.push(U.tn(st.pending, '{n} change waiting to reach Trakt', '{n} changes waiting to reach Trakt')); }
1592
+ if (st.failed) { bits.push('⚠ ' + U.tn(st.failed, '{n} change not sent', '{n} changes not sent')); }
1593
+ 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'))));
1594
+ r.appendChild(U.el('div', 'a-url', bits.join(' · ') + ' · ' + U.t('OK for options')));
1551
1595
  (st.failedItems || []).slice(0, 6).forEach(function (f) {
1552
1596
  r.appendChild(U.el('div', 'a-url', '⚠ ' + f.what.charAt(0).toUpperCase() + f.what.slice(1) + (f.title ? ' · ' + f.title : '') + (f.err ? ' · ' + f.err : '')));
1553
1597
  });
1554
- if ((st.failedItems || []).length > 6) { r.appendChild(U.el('div', 'a-url', 'and ' + (st.failedItems.length - 6) + ' more')); }
1598
+ if ((st.failedItems || []).length > 6) { r.appendChild(U.el('div', 'a-url', U.t('and {n} more', { n: st.failedItems.length - 6 }))); }
1555
1599
  r.__onselect = function () {
1556
- var opts = [['now', st.failed ? 'Sync now (the ' + st.failed + ' not sent too)' : 'Sync now']];
1557
- if (st.failed) { opts.push(['discard', 'Let them go (not sent to Trakt)']); }
1558
- pickList('Trakt sync', opts, null, function (v) {
1559
- if (v === 'now') { Trakt.sendNow(); Trakt.refreshCaches(); U.toast('Syncing with Trakt…'); }
1560
- else if (v === 'discard') { Trakt.discardFailed(); U.toast('Not sent: left out'); }
1600
+ var opts = [['now', st.failed ? U.t('Sync now (the {n} not sent too)', { n: st.failed }) : U.t('Sync now')]];
1601
+ if (st.failed) { opts.push(['discard', U.t('Let them go (not sent to Trakt)')]); }
1602
+ pickList(U.t('Trakt sync'), opts, null, function (v) {
1603
+ if (v === 'now') { Trakt.sendNow(); Trakt.refreshCaches(); U.toast(U.t('Syncing with Trakt…')); }
1604
+ else if (v === 'discard') { Trakt.discardFailed(); U.toast(U.t('Not sent: left out')); }
1561
1605
  setTimeout(renderSettings, 1500);
1562
1606
  });
1563
1607
  };
1564
1608
  return r;
1565
1609
  }
1566
1610
 
1611
+ // Your Stremio account: connected (who, when it last synced, OK for Sync now / Disconnect), or
1612
+ // not (OK to connect: Stremio's sign-in code, as the addon import).
1613
+ function stremioAccountRow() {
1614
+ var st = StremioSync.connectStatus(), r = U.el('div', 'addon-item focusable cfg-row');
1615
+ function two(x) { return (x < 10 ? '0' : '') + x; }
1616
+ var d = st.lastSync ? new Date(st.lastSync) : null;
1617
+ var bits = [];
1618
+ if (st.connected) {
1619
+ 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'));
1620
+ if (st.pending) { bits.push(U.tn(st.pending, '{n} change waiting', '{n} changes waiting')); }
1621
+ if (st.err) { bits.push('⚠ ' + st.err); }
1622
+ }
1623
+ r.appendChild(U.el('div', 'a-name', U.t('Stremio account') + (st.connected && st.user ? ': ' + st.user : '')));
1624
+ r.appendChild(U.el('div', 'a-url', st.connected && st.reconnect ? U.t('Its sign-in no longer works — press OK to connect again')
1625
+ : st.connected ? bits.join(' · ') + ' · ' + U.t('OK for options') : U.t('Not connected — press OK to connect')));
1626
+ r.__onselect = function () {
1627
+ if (!st.connected || st.reconnect) { stremioConnect(); return; }
1628
+ pickList(U.t('Stremio account'), [['now', U.t('Sync now')], ['off', U.t('Disconnect')]], null, function (v) {
1629
+ if (v === 'now') { U.toast(U.t('Syncing with your Stremio account…')); StremioSync.sync().then(function () { markHomeDirty(); renderSettings(); }); }
1630
+ else if (v === 'off') {
1631
+ confirm(U.t('Disconnect your Stremio account?'), U.t('Disconnect'), function () {
1632
+ StremioSync.disconnect();
1633
+ U.toast(U.t('Stremio account disconnected'));
1634
+ markHomeDirty();
1635
+ renderSettings();
1636
+ });
1637
+ }
1638
+ });
1639
+ };
1640
+ return r;
1641
+ }
1642
+ // Stremio's sign-in code (a QR code): approved on your phone, the key kept (StremioSync.connect).
1643
+ function stremioConnect() {
1644
+ stremioSignIn(U.t('Connect your Stremio account'), function (key, body, gone) {
1645
+ U.clear(body);
1646
+ body.appendChild(U.el('div', 'tc-line', U.t('Connecting…')));
1647
+ return StremioSync.connect(key).then(function (user) {
1648
+ if (gone()) { return; }
1649
+ U.clear(body);
1650
+ body.appendChild(U.el('div', 'tc-line', user ? U.t('✓ Connected as {user}: syncing', { user: user }) : U.t('✓ Connected: syncing')));
1651
+ markHomeDirty();
1652
+ setTimeout(function () { if (isModalOpen()) { onModalClose(null); closeModal(); renderSettings(); } }, 1500);
1653
+ });
1654
+ });
1655
+ }
1656
+
1567
1657
  // Device-code connect overlay: shows the code + URL, polls, updates on success.
1568
1658
  function traktConnect() {
1569
1659
  var existing = document.querySelector('.modal-overlay');
1570
1660
  if (existing) { existing.parentNode.removeChild(existing); }
1571
1661
  var overlay = U.el('div', 'modal-overlay');
1572
1662
  var box = U.el('div', 'modal-box');
1573
- box.appendChild(U.el('div', 'modal-msg', 'Connect Trakt'));
1663
+ box.appendChild(U.el('div', 'modal-msg', U.t('Connect Trakt')));
1574
1664
  var body = U.el('div', 'trakt-connect');
1575
- body.appendChild(U.el('div', 'tc-line', 'Starting…'));
1665
+ body.appendChild(U.el('div', 'tc-line', U.t('Starting…')));
1576
1666
  box.appendChild(body);
1577
1667
  var row = U.el('div', 'modal-row');
1578
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
1668
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
1579
1669
  cancel.__onselect = function () { closeModal(); };
1580
1670
  row.appendChild(cancel);
1581
1671
  box.appendChild(row);
@@ -1592,30 +1682,30 @@
1592
1682
  var qrText = /\/activate\/?$/.test(url) ? url.replace(/\/+$/, '') + '/' + encodeURIComponent(code) : url;
1593
1683
  var qrSpot = U.el('div', 'tc-qr-spot');
1594
1684
  body.appendChild(qrSpot);
1595
- var goTo = body.appendChild(U.el('div', 'tc-line', 'On your phone or computer, go to:'));
1685
+ var goTo = body.appendChild(U.el('div', 'tc-line', U.t('On your phone or computer, go to:')));
1596
1686
  // (the QR library is loaded the first time this box opens: nothing else uses it)
1597
1687
  (typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
1598
1688
  var qr = U.qrCanvas(qrText, 8);
1599
1689
  if (!qr || !qrSpot.parentNode) { return; }
1600
1690
  qr.className = 'tc-qr';
1601
- qrSpot.appendChild(U.el('div', 'tc-line', 'Scan with your phone:'));
1691
+ qrSpot.appendChild(U.el('div', 'tc-line', U.t('Scan with your phone:')));
1602
1692
  qrSpot.appendChild(qr);
1603
- goTo.textContent = 'or go to';
1693
+ goTo.textContent = U.t('or go to');
1604
1694
  }, function () {});
1605
1695
  body.appendChild(U.el('div', 'tc-url', url));
1606
- body.appendChild(U.el('div', 'tc-line', 'and enter this code:'));
1696
+ body.appendChild(U.el('div', 'tc-line', U.t('and enter this code:')));
1607
1697
  body.appendChild(U.el('div', 'tc-code', code));
1608
- body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to authorize…'));
1698
+ body.appendChild(U.el('div', 'tc-line small', U.t('Waiting for you to authorize…')));
1609
1699
  },
1610
1700
  onSuccess: function (user) {
1611
1701
  U.clear(body);
1612
- body.appendChild(U.el('div', 'tc-line', '✓ Connected as ' + user));
1702
+ body.appendChild(U.el('div', 'tc-line', U.t('✓ Connected as {user}', { user: user })));
1613
1703
  markHomeDirty();
1614
1704
  setTimeout(function () { if (isModalOpen()) { onModalClose(null); closeModal(); renderSettings(); } }, 1500);
1615
1705
  },
1616
1706
  onError: function (msg) {
1617
1707
  U.clear(body);
1618
- body.appendChild(U.el('div', 'tc-line', msg || 'Could not connect.'));
1708
+ body.appendChild(U.el('div', 'tc-line', msg || U.t('Could not connect.')));
1619
1709
  }
1620
1710
  });
1621
1711
  onModalClose(cancelFlow); // canceling the overlay stops polling
@@ -1623,18 +1713,18 @@
1623
1713
 
1624
1714
  // ---- Media servers: your Jellyfin servers ----
1625
1715
  function settingsMediaServers(wrap) {
1626
- wrap.appendChild(U.el('h2', null, 'Media servers'));
1716
+ wrap.appendChild(U.el('h2', null, U.t('Media servers')));
1627
1717
  var have = typeof Jellyfin !== 'undefined';
1628
1718
  var add = U.el('div', 'addon-item focusable cfg-row');
1629
- add.appendChild(U.el('div', 'a-name', '+ Add a Jellyfin or Emby server'));
1630
- add.appendChild(U.el('div', 'a-url', 'Its address on your network, then a user name and password, or Jellyfin’s Quick Connect'));
1719
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add a Jellyfin or Emby server')));
1720
+ 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')));
1631
1721
  add.__onselect = function () { askJellyfinAddress(''); };
1632
1722
  if (have) { wrap.appendChild(add); }
1633
1723
  var hasPlex = typeof Plex !== 'undefined';
1634
1724
  if (hasPlex) {
1635
1725
  var addPx = U.el('div', 'addon-item focusable cfg-row');
1636
- addPx.appendChild(U.el('div', 'a-name', '+ Add a Plex server'));
1637
- addPx.appendChild(U.el('div', 'a-url', 'A code to enter at plex.tv/link, then which of your servers'));
1726
+ addPx.appendChild(U.el('div', 'a-name', U.t('+ Add a Plex server')));
1727
+ addPx.appendChild(U.el('div', 'a-url', U.t('A code to enter at plex.tv/link, then which of your servers')));
1638
1728
  addPx.__onselect = function () { plexLink(); };
1639
1729
  wrap.appendChild(addPx);
1640
1730
  }
@@ -1645,11 +1735,11 @@
1645
1735
  all.forEach(function (x) {
1646
1736
  var srv = x.srv, mod = x.mod;
1647
1737
  var r = U.el('div', 'addon-item focusable cfg-row'), libs = mod.libraries(srv);
1648
- r.appendChild(U.el('div', 'a-name', srv.name + ' · ' + x.kind + ' ' + srv.version + (srv.off ? ' · Off' : '')));
1649
- 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(', ') : '')));
1738
+ r.appendChild(U.el('div', 'a-name', srv.name + ' · ' + x.kind + ' ' + srv.version + (srv.off ? ' · ' + U.t('Off') : '')));
1739
+ 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(', ') : '')));
1650
1740
  r.__onselect = function () {
1651
- var opts = srv.off ? [['on', 'Turn on']] : [['off', 'Turn off'], ['reload', 'Reload']];
1652
- pickList(srv.name, opts.concat([['remove', 'Sign out and remove']]), null, function (v) {
1741
+ var opts = srv.off ? [['on', U.t('Turn on')]] : [['off', U.t('Turn off')], ['reload', U.t('Reload')]];
1742
+ pickList(srv.name, opts.concat([['remove', U.t('Sign out and remove')]]), null, function (v) {
1653
1743
  if (v === 'on' || v === 'off') {
1654
1744
  mod.setOn(srv.id, v === 'on');
1655
1745
  markHomeDirty();
@@ -1660,10 +1750,10 @@
1660
1750
  } else if (v === 'reload') {
1661
1751
  mod.reload(srv.id);
1662
1752
  markHomeDirty();
1663
- U.toast('Reading “' + srv.name + '” again…');
1753
+ U.toast(U.t('Reading “{name}” again…', { name: srv.name }));
1664
1754
  setTimeout(function () { if (_settingsSection === 'mediaservers') { renderSettings(); } }, 1500);
1665
1755
  } else if (v === 'remove') {
1666
- confirm('Sign out of “' + srv.name + '” and remove it?', 'Remove', function () { mod.remove(srv.id); markHomeDirty(); renderSettings(); });
1756
+ confirm(U.t('Sign out of “{name}” and remove it?', { name: srv.name }), U.t('Remove'), function () { mod.remove(srv.id); markHomeDirty(); renderSettings(); });
1667
1757
  }
1668
1758
  });
1669
1759
  };
@@ -1671,23 +1761,23 @@
1671
1761
  wrap.appendChild(r);
1672
1762
  });
1673
1763
  if (all.length) {
1674
- wrap.appendChild(subPickRow('Wait for a server', SERVER_WAITS, 'serverWait', {
1764
+ wrap.appendChild(subPickRow(U.t('Wait for a server'), SERVER_WAITS, 'serverWait', {
1675
1765
  get: function () { return { serverWait: '' + Stremio.getPrefs().serverWait }; },
1676
1766
  set: function (cfg) { Stremio.setPref('serverWait', +cfg.serverWait || 0); }
1677
1767
  }));
1678
1768
  }
1679
- 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.'));
1769
+ 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.')));
1680
1770
  if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
1681
1771
  }
1682
1772
  function askJellyfinAddress(value) {
1683
1773
  App.openEntry({
1684
- title: 'Jellyfin or Emby server: address',
1685
- hint: 'Its address on your network, like http://192.168.0.50:8096. RETURN cancels.',
1774
+ title: U.t('Jellyfin or Emby server: address'),
1775
+ hint: U.t('Its address on your network, like http://192.168.0.50:8096. RETURN cancels.'),
1686
1776
  value: value || 'http://', placeholder: 'http://192.168.0.50:8096', phone: 'jellyfin',
1687
1777
  validate: function (v) { return Jellyfin.addressProblem(v); },
1688
1778
  onConfirm: function (v) {
1689
1779
  App.back();
1690
- U.spinner(true, 'Asking the server…');
1780
+ U.spinner(true, U.t('Asking the server…'));
1691
1781
  Jellyfin.probe(v).then(function (info) { U.spinner(false); if (info.kind === 'emby') { jellyfinPassword(info, ''); } else { jellyfinSignIn(info); } }, function (e) {
1692
1782
  U.spinner(false);
1693
1783
  U.toast(e.message, 6000);
@@ -1701,18 +1791,18 @@
1701
1791
  _settingsSection = 'mediaservers';
1702
1792
  _focusChild = 'jf:' + srv.id;
1703
1793
  renderSettings();
1704
- U.toast('✓ Signed in to “' + srv.name + '”' + (srv.user ? ' as ' + srv.user : ''));
1794
+ 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 }));
1705
1795
  }
1706
1796
  // Plex: its code to enter at plex.tv/link (a QR of the page too), then which server.
1707
1797
  function plexLink() {
1708
1798
  var existing = document.querySelector('.modal-overlay');
1709
1799
  if (existing) { existing.parentNode.removeChild(existing); }
1710
1800
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
1711
- box.appendChild(U.el('div', 'modal-msg', 'Add a Plex server'));
1801
+ box.appendChild(U.el('div', 'modal-msg', U.t('Add a Plex server')));
1712
1802
  var body = U.el('div', 'trakt-connect');
1713
- body.appendChild(U.el('div', 'tc-line', 'Asking Plex for a code…'));
1803
+ body.appendChild(U.el('div', 'tc-line', U.t('Asking Plex for a code…')));
1714
1804
  box.appendChild(body);
1715
- var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
1805
+ var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
1716
1806
  cancel.__onselect = function () { closeModal(); };
1717
1807
  row.appendChild(cancel);
1718
1808
  box.appendChild(row);
@@ -1720,7 +1810,7 @@
1720
1810
  document.body.appendChild(overlay);
1721
1811
  showModal(overlay, cancel);
1722
1812
  function addIt(res) {
1723
- U.spinner(true, 'Finding “' + res.name + '”…');
1813
+ U.spinner(true, U.t('Finding “{name}”…', { name: res.name }));
1724
1814
  Plex.add(res).then(function (srv) { U.spinner(false); jellyfinDone(srv); }, function (e) { U.spinner(false); U.toast(e.message, 8000); });
1725
1815
  }
1726
1816
  var stop = Plex.link({
@@ -1728,24 +1818,24 @@
1728
1818
  U.clear(body);
1729
1819
  var qrSpot = U.el('div', 'tc-qr-spot');
1730
1820
  body.appendChild(qrSpot);
1731
- var goTo = body.appendChild(U.el('div', 'tc-line', 'On your phone or computer, go to:'));
1821
+ var goTo = body.appendChild(U.el('div', 'tc-line', U.t('On your phone or computer, go to:')));
1732
1822
  (typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
1733
1823
  var qr = U.qrCanvas(url, 8);
1734
1824
  if (!qr || !qrSpot.parentNode) { return; }
1735
1825
  qr.className = 'tc-qr';
1736
- qrSpot.appendChild(U.el('div', 'tc-line', 'Scan with your phone:'));
1826
+ qrSpot.appendChild(U.el('div', 'tc-line', U.t('Scan with your phone:')));
1737
1827
  qrSpot.appendChild(qr);
1738
- goTo.textContent = 'or go to';
1828
+ goTo.textContent = U.t('or go to');
1739
1829
  }, function () {});
1740
1830
  body.appendChild(U.el('div', 'tc-url', url.replace(/^https:\/\//, '')));
1741
- body.appendChild(U.el('div', 'tc-line', 'sign in, and enter this code:'));
1831
+ body.appendChild(U.el('div', 'tc-line', U.t('sign in, and enter this code:')));
1742
1832
  body.appendChild(U.el('div', 'tc-code', code));
1743
- body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to enter it…'));
1833
+ body.appendChild(U.el('div', 'tc-line small', U.t('Waiting for you to enter it…')));
1744
1834
  },
1745
1835
  onServers: function (list) {
1746
1836
  if (isModalOpen()) { onModalClose(null); closeModal(); }
1747
1837
  if (list.length === 1) { addIt(list[0]); return; }
1748
- pickList('Which Plex server?', list.map(function (x, i) { return ['' + i, x.name + (x.owned ? '' : ' (shared with you)')]; }), null, function (v) { addIt(list[+v]); });
1838
+ 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]); });
1749
1839
  },
1750
1840
  onError: function (msg) { U.clear(body); body.appendChild(U.el('div', 'tc-line', msg)); }
1751
1841
  });
@@ -1756,13 +1846,13 @@
1756
1846
  var existing = document.querySelector('.modal-overlay');
1757
1847
  if (existing) { existing.parentNode.removeChild(existing); }
1758
1848
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
1759
- box.appendChild(U.el('div', 'modal-msg', 'Sign in to “' + info.name + '”'));
1849
+ box.appendChild(U.el('div', 'modal-msg', U.t('Sign in to “{name}”', { name: info.name })));
1760
1850
  var body = U.el('div', 'trakt-connect');
1761
- body.appendChild(U.el('div', 'tc-line', 'Starting Quick Connect…'));
1851
+ body.appendChild(U.el('div', 'tc-line', U.t('Starting Quick Connect…')));
1762
1852
  box.appendChild(body);
1763
1853
  var row = U.el('div', 'modal-row');
1764
- var pw = U.el('div', 'pill focusable modal-btn', 'User name and password');
1765
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
1854
+ var pw = U.el('div', 'pill focusable modal-btn', U.t('User name and password'));
1855
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
1766
1856
  row.appendChild(pw); row.appendChild(cancel);
1767
1857
  box.appendChild(row);
1768
1858
  overlay.appendChild(box);
@@ -1771,9 +1861,9 @@
1771
1861
  var stop = Jellyfin.quickConnect(info, {
1772
1862
  onCode: function (code) {
1773
1863
  U.clear(body);
1774
- body.appendChild(U.el('div', 'tc-line', 'In Jellyfin on your phone or computer, open your profile › Quick Connect, and enter:'));
1864
+ body.appendChild(U.el('div', 'tc-line', U.t('In Jellyfin on your phone or computer, open your profile › Quick Connect, and enter:')));
1775
1865
  body.appendChild(U.el('div', 'tc-code', code));
1776
- body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to enter it…'));
1866
+ body.appendChild(U.el('div', 'tc-line small', U.t('Waiting for you to enter it…')));
1777
1867
  },
1778
1868
  onSuccess: function (srv) { if (isModalOpen()) { onModalClose(null); closeModal(); } jellyfinDone(srv); },
1779
1869
  onError: function (msg) { U.clear(body); body.appendChild(U.el('div', 'tc-line', msg)); }
@@ -1784,16 +1874,16 @@
1784
1874
  }
1785
1875
  function jellyfinPassword(info, user) {
1786
1876
  App.openEntry({
1787
- title: Jellyfin.kindName(info) + ' “' + info.name + '”: user name', hint: 'Your ' + Jellyfin.kindName(info) + ' user name. RETURN cancels.', value: user || '', placeholder: 'user name',
1788
- validate: function (v) { return ('' + v).trim() ? null : 'Your user name'; },
1877
+ 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'),
1878
+ validate: function (v) { return ('' + v).trim() ? null : U.t('Your user name'); },
1789
1879
  onConfirm: function (u) {
1790
1880
  App.back();
1791
1881
  App.openEntry({
1792
- 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,
1882
+ 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,
1793
1883
  validate: function () { return null; },
1794
1884
  onConfirm: function (p) {
1795
1885
  App.back();
1796
- U.spinner(true, 'Signing in…');
1886
+ U.spinner(true, U.t('Signing in…'));
1797
1887
  Jellyfin.signIn(info, ('' + u).trim(), p).then(function (srv) { U.spinner(false); jellyfinDone(srv); }, function (e) {
1798
1888
  U.spinner(false);
1799
1889
  U.toast(e.message, 6000);
@@ -1805,71 +1895,71 @@
1805
1895
  }
1806
1896
 
1807
1897
  function settingsSubtitles(wrap) {
1808
- wrap.appendChild(U.el('h2', null, 'Subtitles'));
1809
- wrap.appendChild(subPickRow('Default language', SUB_LANGS, 'lang'));
1810
- wrap.appendChild(subPickRow('Second choice', SUB_LANGS2, 'lang2'));
1811
- wrap.appendChild(subPickRow('Second subtitle (at the top)', SUB_LANGS, 'second'));
1812
- wrap.appendChild(subPickRow('Only my languages', SUB_ONLY, 'only'));
1898
+ wrap.appendChild(U.el('h2', null, U.t('Subtitles')));
1899
+ wrap.appendChild(subPickRow(U.t('Default language'), SUB_LANGS, 'lang'));
1900
+ wrap.appendChild(subPickRow(U.t('Second choice'), SUB_LANGS2, 'lang2'));
1901
+ wrap.appendChild(subPickRow(U.t('Second subtitle (at the top)'), SUB_LANGS, 'second'));
1902
+ wrap.appendChild(subPickRow(U.t('Only my languages'), SUB_ONLY, 'only'));
1813
1903
  // lines to leave out: those with one of your words (a subtitle site's ads, a file's name…)
1814
1904
  var skip = Player.getSubCfg().skip || [];
1815
1905
  var sk = U.el('div', 'addon-item focusable cfg-row');
1816
- sk.appendChild(U.el('div', 'a-name', 'Skip lines with: ' + (skip.length ? skip.join(', ') : 'None')));
1817
- 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)'));
1906
+ sk.appendChild(U.el('div', 'a-name', U.t('Skip lines with:') + ' ' + (skip.length ? skip.join(', ') : U.t('None'))));
1907
+ 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)')));
1818
1908
  sk.__onselect = function () {
1819
- App.openEntry({ title: 'Skip subtitle lines with', value: skip.join(', '), placeholder: 'OPENSUBTITLES, .SRT',
1820
- 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.',
1909
+ App.openEntry({ title: U.t('Skip subtitle lines with'), value: skip.join(', '), placeholder: U.t('OPENSUBTITLES, .SRT'),
1910
+ 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.'),
1821
1911
  validate: function () { return null; },
1822
1912
  onConfirm: function (v) { var c = Player.getSubCfg(); c.skip = ('' + v).split(','); Player.setSubCfg(c); App.back(); renderSettings(); } });
1823
1913
  };
1824
1914
  wrap.appendChild(sk);
1825
- var look = sectionRow('Appearance ›', 'Size, color, background, edge, position, font', 'subtitlelook'); // (their own page: settingsSubtitleLook)
1915
+ var look = sectionRow(U.t('Appearance ›'), U.t('Size, color, background, edge, position, font'), 'subtitlelook'); // (their own page: settingsSubtitleLook)
1826
1916
  wrap.appendChild(look);
1827
1917
  if (_focusChild === 'subtitlelook') { _focusChild = null; Focus.setScope(scr('settings'), look); } else { focusSettings(); }
1828
1918
  }
1829
1919
  // Subtitles › Appearance: how subtitles look.
1830
1920
  function settingsSubtitleLook(wrap) {
1831
- wrap.appendChild(U.el('h2', null, 'Subtitle appearance'));
1832
- wrap.appendChild(subPickRow('Size', SUB_SIZES, 'size'));
1921
+ wrap.appendChild(U.el('h2', null, U.t('Subtitle appearance')));
1922
+ wrap.appendChild(subPickRow(U.t('Size'), SUB_SIZES, 'size'));
1833
1923
  // [id, label] for the picker (colors with a swatch)
1834
1924
  function plain(list) { return list.map(function (x) { return [x[0], x[1]]; }); }
1835
- wrap.appendChild(subPickRow('Color', Player.SUB_COLORS.map(function (x) { return [x[0], x[1], null, x[2]]; }), 'color'));
1836
- wrap.appendChild(subPickRow('Background', plain(Player.SUB_BGS), 'bg'));
1837
- wrap.appendChild(subPickRow('Edge', plain(Player.SUB_EDGES), 'edge'));
1838
- wrap.appendChild(subPickRow('Position', plain(Player.SUB_POSITIONS), 'pos'));
1839
- wrap.appendChild(subPickRow('Font', Player.SUB_FONTS, 'font'));
1925
+ wrap.appendChild(subPickRow(U.t('Color'), Player.SUB_COLORS.map(function (x) { return [x[0], x[1], null, x[2]]; }), 'color'));
1926
+ wrap.appendChild(subPickRow(U.t('Background'), plain(Player.SUB_BGS), 'bg'));
1927
+ wrap.appendChild(subPickRow(U.t('Edge'), plain(Player.SUB_EDGES), 'edge'));
1928
+ wrap.appendChild(subPickRow(U.t('Position'), plain(Player.SUB_POSITIONS), 'pos'));
1929
+ wrap.appendChild(subPickRow(U.t('Font'), Player.SUB_FONTS, 'font'));
1840
1930
  focusSettings();
1841
1931
  }
1842
1932
 
1843
1933
  // Skipping: intros and recaps skipped on their own after a countdown (with Cancel), or asked.
1844
- var SKIP_CHOICES = [['0', 'Ask (a Skip button)'], ['5', 'After 5 seconds'], ['10', 'After 10 seconds'], ['15', 'After 15 seconds'], ['30', 'After 30 seconds']];
1934
+ 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')]];
1845
1935
  // Settings › Addons: how long an addon's answer is waited for (an addon that sleeps when
1846
1936
  // unused fails the first time while it wakes up).
1847
- var SERVER_WAITS = [['0', 'Normal (20 s)'], ['45', '45 seconds'], ['90', '90 seconds'], ['180', '180 seconds']]; // (a media server's answer)
1848
- var ADDON_WAITS = [['0', 'Normal (12 s; sources 15, search 25)'], ['20', '20 seconds'], ['30', '30 seconds'], ['45', '45 seconds'], ['60', '60 seconds']];
1849
- var NEXT_CHOICES = [['0', 'Ask'], ['5', 'After 5 seconds'], ['10', 'After 10 seconds'], ['15', 'After 15 seconds'], ['30', 'After 30 seconds']];
1937
+ 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)
1938
+ 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')]];
1939
+ 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')]];
1850
1940
  // Seeking & buffering: how far LEFT / RIGHT jump; a bigger buffer for slow connections; how
1851
1941
  // often a live channel that drops is opened again.
1852
- var RECONNECTS = [['off', 'Off'], ['few', 'A few times (3 in 5 minutes)'], ['always', 'Keep trying']];
1942
+ var RECONNECTS = [['off', U.t('Off')], ['few', U.t('A few times (3 in 5 minutes)')], ['always', U.t('Keep trying')]];
1853
1943
  // (an HLS source through the service, with its own headers on every piece: see player-core's viaService)
1854
- var HLS_ROUTES = [['off', 'Off'], ['headers', 'Sources that need headers'], ['all', 'All HLS sources']];
1944
+ var HLS_ROUTES = [['off', U.t('Off')], ['headers', U.t('Sources that need headers')], ['all', U.t('All HLS sources')]];
1855
1945
  function settingsSeeking(wrap) {
1856
- wrap.appendChild(U.el('h2', null, 'Seeking & buffering'));
1946
+ wrap.appendChild(U.el('h2', null, U.t('Seeking & buffering')));
1857
1947
  var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect, hls: c.hls }; },
1858
1948
  set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect, hls: cfg.hls }); } };
1859
- wrap.appendChild(subPickRow('Seek step', [['5', '5 s'], ['10', '10 s'], ['15', '15 s'], ['30', '30 s']], 'seek', store));
1860
- wrap.appendChild(subPickRow('Buffer', [['normal', 'Normal (the TV’s own)'], ['more', 'More'], ['most', 'Most']], 'buffer', store));
1861
- wrap.appendChild(subPickRow('Reconnect live channels', RECONNECTS, 'reconnect', store));
1862
- wrap.appendChild(subPickRow('HLS through StremioK’s service', HLS_ROUTES, 'hls', store));
1949
+ wrap.appendChild(subPickRow(U.t('Seek step'), [['5', '5 s'], ['10', '10 s'], ['15', '15 s'], ['30', '30 s']], 'seek', store));
1950
+ wrap.appendChild(subPickRow(U.t('Buffer'), [['normal', U.t('Normal (the TV’s own)')], ['more', U.t('More')], ['most', U.t('Most')]], 'buffer', store));
1951
+ wrap.appendChild(subPickRow(U.t('Reconnect live channels'), RECONNECTS, 'reconnect', store));
1952
+ wrap.appendChild(subPickRow(U.t('HLS through StremioK’s service'), HLS_ROUTES, 'hls', store));
1863
1953
  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.'));
1864
1954
  focusSettings();
1865
1955
  }
1866
1956
  function settingsSkipping(wrap) {
1867
- wrap.appendChild(U.el('h2', null, 'Skipping'));
1868
- wrap.appendChild(subPickRow('Intros, recaps and previews', SKIP_CHOICES, 'autoSkip', {
1957
+ wrap.appendChild(U.el('h2', null, U.t('Skipping')));
1958
+ wrap.appendChild(subPickRow(U.t('Intros, recaps and previews'), SKIP_CHOICES, 'autoSkip', {
1869
1959
  get: function () { return { autoSkip: '' + Stremio.getPrefs().autoSkip }; },
1870
1960
  set: function (cfg) { Stremio.setPref('autoSkip', +cfg.autoSkip || 0); }
1871
1961
  }));
1872
- wrap.appendChild(subPickRow('Next episode', NEXT_CHOICES, 'autoNext', {
1962
+ wrap.appendChild(subPickRow(U.t('Next episode'), NEXT_CHOICES, 'autoNext', {
1873
1963
  get: function () { return { autoNext: '' + Stremio.getPrefs().autoNext }; },
1874
1964
  set: function (cfg) { Stremio.setPref('autoNext', +cfg.autoNext || 0); }
1875
1965
  }));
@@ -1877,15 +1967,15 @@
1877
1967
  focusSettings();
1878
1968
  }
1879
1969
 
1880
- var POSTER_SHAPES = [['portrait', 'Portrait'], ['landscape', 'Landscape']];
1970
+ var POSTER_SHAPES = [['portrait', U.t('Portrait')], ['landscape', U.t('Landscape')]];
1881
1971
  // ----- Diagnostics › Logs: the recent problems U.log kept (in memory, URLs masked), and
1882
1972
  // how long launches took -----
1883
1973
  function settingsLogs(wrap) {
1884
- wrap.appendChild(U.el('h2', null, 'Diagnostics › Logs'));
1974
+ wrap.appendChild(U.el('h2', null, U.t('Diagnostics › Logs')));
1885
1975
  var list = U.logEntries ? U.logEntries() : [];
1886
1976
  wrap.appendChild(U.el('div', 'hint', list.length
1887
- ? '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.'
1888
- : 'No problems since StremioK started.'));
1977
+ ? 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.')
1978
+ : U.t('No problems since StremioK started.')));
1889
1979
  function two(n) { return (n < 10 ? '0' : '') + n; }
1890
1980
  list.forEach(function (e) {
1891
1981
  var d = new Date(e.t);
@@ -1896,7 +1986,7 @@
1896
1986
  });
1897
1987
  if (list.length) {
1898
1988
  var clear = U.el('div', 'addon-item focusable');
1899
- clear.appendChild(U.el('div', 'a-name', 'Clear log'));
1989
+ clear.appendChild(U.el('div', 'a-name', U.t('Clear log')));
1900
1990
  clear.__onselect = function () { U.clearLog(); renderSettings(); };
1901
1991
  wrap.appendChild(clear);
1902
1992
  }
@@ -1906,23 +1996,23 @@
1906
1996
  // ----- Diagnostics › Storage: the database on or off, what's using the storage, tidying the
1907
1997
  // database up, giving up the copies that can be made again -----
1908
1998
  function settingsStorage(wrap) {
1909
- wrap.appendChild(U.el('h2', null, 'Diagnostics › Storage'));
1999
+ wrap.appendChild(U.el('h2', null, U.t('Diagnostics › Storage')));
1910
2000
  var was = Focus.current(), wasName = was && was.querySelector && was.querySelector('.a-name'); // (drawn again: on the same row)
1911
2001
  var wasKey = wasName ? wasName.textContent.split(/:| —/)[0] : '';
1912
2002
  var on = !!(U.bigStore && U.bigStore.enabled && U.bigStore.enabled());
1913
2003
  var db = U.el('div', 'addon-item focusable');
1914
- db.appendChild(U.el('div', 'a-name', 'Use the TV’s database: ' + (on ? 'On' : 'Off')));
1915
- 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'));
2004
+ db.appendChild(U.el('div', 'a-name', U.t('Use the TV’s database:') + ' ' + (on ? U.t('On') : U.t('Off'))));
2005
+ 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')));
1916
2006
  db.__onselect = function () {
1917
2007
  function apply(v) {
1918
2008
  U.bigStore.setEnabled(v).then(function (r) {
1919
2009
  _storageInfo = null;
1920
- 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' : ''));
2010
+ 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'));
1921
2011
  if (_settingsSection === 'storage') { renderSettings(); }
1922
2012
  });
1923
2013
  }
1924
2014
  if (!on) { apply(true); return; }
1925
- 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); });
2015
+ 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); });
1926
2016
  };
1927
2017
  wrap.appendChild(db);
1928
2018
  storageLines(wrap, on);
@@ -1943,31 +2033,32 @@
1943
2033
 
1944
2034
  // ----- Private viewing (see player-store): on or off; also on the player's quick bar (UP). -----
1945
2035
  function settingsPrivate(wrap) {
1946
- wrap.appendChild(U.el('h2', null, 'Private viewing'));
2036
+ wrap.appendChild(U.el('h2', null, U.t('Private viewing')));
1947
2037
  var on = Player.isPrivate();
1948
2038
  var r = U.el('div', 'addon-item focusable');
1949
- r.appendChild(U.el('div', 'a-name', 'Private viewing: ' + (on ? 'On' : 'Off')));
1950
- 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'));
2039
+ r.appendChild(U.el('div', 'a-name', U.t('Private viewing:') + ' ' + (on ? U.t('On') : U.t('Off'))));
2040
+ 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')));
1951
2041
  r.__onselect = function () { Player.setPrivate(!on); markHomeDirty(); renderSettings(); };
1952
2042
  wrap.appendChild(r);
1953
- 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.'));
2043
+ 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.')));
1954
2044
  Focus.setScope(scr('settings'), r);
1955
2045
  }
1956
2046
 
1957
2047
  // ----- USB drive: each drive's index (what it has, how much is matched to titles), the
1958
2048
  // hidden-files switch, and forgetting the matches. -----
1959
2049
  var _usbListening = false;
1960
- function usbDriveLine(st) {
1961
- if (st.state === 'scanning') { return st.phase === 'matching' ? 'Indexing: matching ' + st.done + ' of ' + st.total + ' titles · OK: stop' : 'Indexing: listing the drive… · OK: stop'; }
1962
- if (st.state === 'failed') { return 'Indexing failed: ' + st.error; }
1963
- if (st.state === 'none') { return 'Not indexed yet'; }
1964
- return st.videos + ' video' + (st.videos === 1 ? '' : 's') + ', ' + st.matched + ' matched to titles' + (st.truncated ? ' (a very large drive: only part of it)' : '') +
1965
- (st.left ? ', ' + st.left + ' titles left to match' : '') + ' · indexed ' + U.dayLabel(st.at) + ' ' + new Date(st.at).toTimeString().slice(0, 5);
2050
+ // folder: a network folder's (its own words: a folder, not a drive)
2051
+ function usbDriveLine(st, folder) {
2052
+ 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')); }
2053
+ if (st.state === 'failed') { return U.t('Indexing failed: {why}', { why: st.error }); }
2054
+ if (st.state === 'none') { return U.t('Not indexed yet'); }
2055
+ 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)')) : '') +
2056
+ (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) });
1966
2057
  }
1967
2058
  // ---- Network folders (WebDAV): NetFolders ----
1968
2059
  var _netListening = false;
1969
2060
  function settingsNetFolders(wrap) {
1970
- wrap.appendChild(U.el('h2', null, 'Network folders'));
2061
+ wrap.appendChild(U.el('h2', null, U.t('Network folders')));
1971
2062
  if (typeof NetFolders === 'undefined' || typeof LocalMedia === 'undefined') { focusSettings(); return; }
1972
2063
  if (!_netListening) {
1973
2064
  _netListening = true;
@@ -1980,21 +2071,21 @@
1980
2071
  });
1981
2072
  }
1982
2073
  var add = U.el('div', 'addon-item focusable cfg-row');
1983
- add.appendChild(U.el('div', 'a-name', '+ Add a network folder'));
1984
- add.appendChild(U.el('div', 'a-url', 'Its WebDAV address, then the user name and password it asks for, if any'));
2074
+ add.appendChild(U.el('div', 'a-name', U.t('+ Add a network folder')));
2075
+ add.appendChild(U.el('div', 'a-url', U.t('Its WebDAV address, then the user name and password it asks for, if any')));
1985
2076
  add.__onselect = function () { askNetAddress(''); };
1986
2077
  wrap.appendChild(add);
1987
2078
  var focus = null;
1988
2079
  NetFolders.all().forEach(function (f) {
1989
2080
  var r = U.el('div', 'addon-item focusable cfg-row');
1990
2081
  r.__netFolder = f;
1991
- r.appendChild(U.el('div', 'a-name', '🌐 ' + f.name + (f.off ? ' · Off' : '')));
2082
+ r.appendChild(U.el('div', 'a-name', '🌐 ' + f.name + (f.off ? ' · ' + U.t('Off') : '')));
1992
2083
  r.appendChild(U.el('div', 'a-url', netFolderLine(f)));
1993
2084
  r.__onselect = function () {
1994
2085
  var d = NetFolders.driveOf(f), st = LocalMedia.status(d);
1995
2086
  if (!f.off && st.state === 'scanning') { V.confirmStopIndexing(d, st, renderSettings); return; }
1996
- var opts = f.off ? [['on', 'Turn on']] : [['off', 'Turn off'], ['index', st.left ? 'Continue matching (' + st.left + ' titles left)' : 'Index again']];
1997
- pickList(f.name, opts.concat([['remove', 'Remove']]), null, function (v) {
2087
+ 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')]];
2088
+ pickList(f.name, opts.concat([['remove', U.t('Remove')]]), null, function (v) {
1998
2089
  _focusChild = 'nf:' + f.id;
1999
2090
  if (v === 'on' || v === 'off') {
2000
2091
  NetFolders.setOn(f.id, v === 'on');
@@ -2004,11 +2095,11 @@
2004
2095
  } else if (v === 'index') {
2005
2096
  (st.left ? LocalMedia.continueMatching(d) : LocalMedia.scan(d)).then(function () {
2006
2097
  var s2 = LocalMedia.status(d);
2007
- U.toast(s2.state === 'failed' ? 'Indexing failed' + (s2.error ? ': ' + s2.error : '') : 'Indexed: ' + s2.videos + ' videos, ' + s2.matched + ' matched', 5000);
2098
+ 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);
2008
2099
  });
2009
2100
  renderSettings();
2010
2101
  } else if (v === 'remove') {
2011
- confirm('Remove “' + f.name + '”? Its index goes too; the folder itself isn’t touched.', 'Remove', function () { NetFolders.remove(f.id); markHomeDirty(); renderSettings(); });
2102
+ 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(); });
2012
2103
  }
2013
2104
  });
2014
2105
  };
@@ -2019,26 +2110,26 @@
2019
2110
  if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
2020
2111
  }
2021
2112
  function netFolderLine(f) {
2022
- if (f.off) { return f.url + ' · its sources set aside, its index kept'; }
2113
+ if (f.off) { return f.url + ' · ' + U.t('its sources set aside, its index kept'); }
2023
2114
  var st = LocalMedia.status(NetFolders.driveOf(f));
2024
- 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');
2115
+ return f.url + (f.user ? ' · ' + U.t('as {user}', { user: f.user }) : '') + (f.cert ? ' · ' + U.t('its certificate trusted') : '') + ' · ' + usbDriveLine(st, true);
2025
2116
  }
2026
2117
  function askNetAddress(value) {
2027
2118
  App.openEntry({
2028
- title: 'Network folder: address',
2029
- hint: 'Its WebDAV address, like http://192.168.0.50:8080/media (https:// too). RETURN cancels.',
2119
+ title: U.t('Network folder: address'),
2120
+ hint: U.t('Its WebDAV address, like http://192.168.0.50:8080/media (https:// too). RETURN cancels.'),
2030
2121
  value: value || 'http://', placeholder: 'http://192.168.0.50:8080/media', phone: 'webdav',
2031
2122
  validate: function (v) { return NetFolders.addressProblem(v); },
2032
2123
  onConfirm: function (url) {
2033
2124
  App.back();
2034
2125
  App.openEntry({
2035
- 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',
2126
+ 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'),
2036
2127
  validate: function () { return null; },
2037
2128
  onConfirm: function (user) {
2038
2129
  App.back();
2039
2130
  if (!('' + user).trim()) { netProbe(url, '', '', ''); return; }
2040
2131
  App.openEntry({
2041
- title: 'Network folder: password', hint: 'Its password (kept on the TV, sent only to that folder). RETURN cancels.', value: '', placeholder: 'password', secret: true,
2132
+ 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,
2042
2133
  validate: function () { return null; },
2043
2134
  onConfirm: function (pass) { App.back(); netProbe(url, ('' + user).trim(), '' + pass, ''); }
2044
2135
  });
@@ -2049,7 +2140,7 @@
2049
2140
  }
2050
2141
  // Ask the folder with that sign-in; a certificate it made itself: asked about first.
2051
2142
  function netProbe(url, user, pass, cert) {
2052
- U.spinner(true, 'Asking the folder…');
2143
+ U.spinner(true, U.t('Asking the folder…'));
2053
2144
  NetFolders.probe(url, user, pass, cert).then(function (p) {
2054
2145
  U.spinner(false);
2055
2146
  var f;
@@ -2058,23 +2149,23 @@
2058
2149
  _settingsSection = 'netfolders';
2059
2150
  _focusChild = 'nf:' + f.id;
2060
2151
  renderSettings();
2061
- U.toast('✓ Added “' + f.name + '”: Home › Local shows it', 5000);
2152
+ U.toast(U.t('✓ Added “{name}”: Home › Local shows it', { name: f.name }), 5000);
2062
2153
  }, function (e) {
2063
2154
  U.spinner(false);
2064
2155
  if (e && e.why === 'untrusted' && e.cert && !cert) {
2065
- 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 : '') +
2066
- '. 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 });
2156
+ 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 }) : '') +
2157
+ '. ' + 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 });
2067
2158
  return;
2068
2159
  }
2069
- U.toast((e && e.message) || 'It failed', 7000);
2160
+ U.toast((e && e.message) || U.t('It failed'), 7000);
2070
2161
  if (_settingsSection === 'netfolders') { renderSettings(); }
2071
2162
  });
2072
2163
  }
2073
2164
 
2074
2165
  function settingsUsb(wrap) {
2075
- wrap.appendChild(U.el('h2', null, 'USB drive'));
2166
+ wrap.appendChild(U.el('h2', null, U.t('USB drive')));
2076
2167
  if (typeof LocalMedia === 'undefined' || !LocalMedia.available()) {
2077
- wrap.appendChild(U.el('div', 'hint', 'Only on the TV: this install can’t see USB drives.'));
2168
+ wrap.appendChild(U.el('div', 'hint', U.t('Only on the TV: this install can’t see USB drives.')));
2078
2169
  focusSettings();
2079
2170
  return;
2080
2171
  }
@@ -2091,25 +2182,25 @@
2091
2182
  }
2092
2183
  });
2093
2184
  }
2094
- 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.'));
2185
+ 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.')));
2095
2186
  if (!LocalMedia.isRead()) { // (read when asked, not at launch)
2096
- wrap.appendChild(U.el('div', 'hint', 'Reading USB drives…'));
2187
+ wrap.appendChild(U.el('div', 'hint', U.t('Reading USB drives…')));
2097
2188
  LocalMedia.ensure().then(function () { if (_settingsSection === 'usb') { renderSettings(); } });
2098
2189
  focusSettings();
2099
2190
  return;
2100
2191
  }
2101
2192
  var ds = LocalMedia.knownDrives().filter(function (d) { return !d.dav; }), first = null; // (network folders: their own page)
2102
- if (!ds.length) { wrap.appendChild(U.el('div', 'hint', 'No USB drive plugged in.')); }
2193
+ if (!ds.length) { wrap.appendChild(U.el('div', 'hint', U.t('No USB drive plugged in.'))); }
2103
2194
  ds.forEach(function (d) {
2104
2195
  var r = U.el('div', 'addon-item focusable');
2105
2196
  r.__usbDrive = d;
2106
- r.appendChild(U.el('div', 'a-name', '💾 ' + d.label.replace(/^removable_/, '') + ' — Index'));
2197
+ r.appendChild(U.el('div', 'a-name', '💾 ' + d.label.replace(/^removable_/, '') + ' — ' + U.t('Index')));
2107
2198
  r.appendChild(U.el('div', 'a-url', usbDriveLine(LocalMedia.status(d))));
2108
2199
  r.__onselect = function () {
2109
2200
  var st = LocalMedia.status(d);
2110
2201
  if (st.state === 'scanning') { V.confirmStopIndexing(d, st, renderSettings); return; }
2111
2202
  if (st.left) {
2112
- pickList('Index this drive', [['more', 'Continue matching (' + st.left + ' titles left)'], ['again', 'Index again (list the drive afresh)']], 'more', function (k) {
2203
+ 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) {
2113
2204
  if (k === 'more') { LocalMedia.continueMatching(d); } else { LocalMedia.scan(d); }
2114
2205
  renderSettings();
2115
2206
  });
@@ -2121,27 +2212,27 @@
2121
2212
  first = first || r;
2122
2213
  });
2123
2214
  var mt = U.el('div', 'addon-item focusable');
2124
- mt.appendChild(U.el('div', 'a-name', 'Match videos to titles: ' + (LocalMedia.matchingAllowed() ? 'On' : LocalMedia.matchingAsked() ? 'Off' : 'Off (not asked yet)')));
2125
- 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'));
2215
+ 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)'))));
2216
+ 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')));
2126
2217
  mt.__onselect = function () { LocalMedia.setMatching(!LocalMedia.matchingAllowed()); markHomeDirty(); renderSettings(); Focus.setScope(scr('settings'), scr('settings').querySelectorAll('.settings-wrap .addon-item')[ds.length]); };
2127
2218
  wrap.appendChild(mt);
2128
2219
  var hid = U.el('div', 'addon-item focusable');
2129
- hid.appendChild(U.el('div', 'a-name', 'Show hidden files: ' + (LocalMedia.showHidden() ? 'On' : 'Off')));
2130
- hid.appendChild(U.el('div', 'a-url', 'Names starting with “.” (a Mac leaves ._… copies, .DS_Store, .Spotlight-V100…), $RECYCLE.BIN, System Volume Information'));
2220
+ hid.appendChild(U.el('div', 'a-name', U.t('Show hidden files:') + ' ' + (LocalMedia.showHidden() ? U.t('On') : U.t('Off'))));
2221
+ 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')));
2131
2222
  hid.__onselect = function () { LocalMedia.setShowHidden(!LocalMedia.showHidden()); markHomeDirty(); renderSettings(); Focus.setScope(scr('settings'), scr('settings').querySelectorAll('.settings-wrap .addon-item')[ds.length + 1]); };
2132
2223
  wrap.appendChild(hid);
2133
2224
  var clr = U.el('div', 'addon-item focusable');
2134
- clr.appendChild(U.el('div', 'a-name', 'Clear the USB index'));
2135
- 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)'));
2225
+ clr.appendChild(U.el('div', 'a-name', U.t('Clear the USB index')));
2226
+ 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)')));
2136
2227
  clr.__onselect = function () {
2137
- confirm('Clear the index of your USB drives?', 'Clear', function () { LocalMedia.clearIndex(); U.toast('USB index cleared'); renderSettings(); });
2228
+ confirm(U.t('Clear the index of your USB drives?'), U.t('Clear'), function () { LocalMedia.clearIndex(); U.toast(U.t('USB index cleared')); renderSettings(); });
2138
2229
  };
2139
2230
  wrap.appendChild(clr);
2140
2231
  var forget = U.el('div', 'addon-item focusable');
2141
- forget.appendChild(U.el('div', 'a-name', 'Forget matches'));
2142
- 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)'));
2232
+ forget.appendChild(U.el('div', 'a-name', U.t('Forget matches')));
2233
+ 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)')));
2143
2234
  forget.__onselect = function () {
2144
- confirm('Forget which title each video is (yours too)? They’re matched again as you browse, or when a drive is indexed.', 'Forget', function () {
2235
+ 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 () {
2145
2236
  LocalMedia.forgetMatches();
2146
2237
  markHomeDirty();
2147
2238
  renderSettings();
@@ -2158,52 +2249,53 @@
2158
2249
  // An item in the TV's database by what it is: { name, unused: why it's no longer used, if so }
2159
2250
  function storageItem(key) {
2160
2251
  var m;
2161
- if (key === 'stremiok.homecache') { return { name: 'Home’s saved rows' }; }
2162
- if (key === 'stremiok.trakt.watched') { return { name: 'Trakt watched history' }; }
2163
- if (key === 'stremiok.media.watched') { return { name: 'Media servers’ watched marks' }; }
2252
+ if (key === 'stremiok.homecache') { return { name: U.t('Home’s saved rows') }; }
2253
+ if (key === 'stremiok.trakt.watched') { return { name: U.t('Trakt watched history') }; }
2254
+ if (key === 'stremiok.media.watched') { return { name: U.t('Media servers’ watched marks') }; }
2255
+ if (key === 'stremiok.stremio.items') { return { name: U.t('Your Stremio account’s library') }; }
2164
2256
  if ((m = key.match(/^stremiok\.iptv\.cache\.(.+)$/))) {
2165
2257
  var p = (typeof IPTV !== 'undefined' ? IPTV.getPlaylists() : []).filter(function (x) { return x.id === m[1]; })[0];
2166
- return p ? { name: 'IPTV playlist copy: ' + (p.name || (('' + p.url).match(/^[a-z]+:\/\/(?:[^\/@]*@)?([^\/?#:]+)/i) || [])[1] || 'a playlist') }
2167
- : { name: 'IPTV playlist copy (' + key + ')', unused: 'its playlist was removed' };
2258
+ return p ? { name: U.t('IPTV playlist copy: {name}', { name: p.name || (('' + p.url).match(/^[a-z]+:\/\/(?:[^\/@]*@)?([^\/?#:]+)/i) || [])[1] || U.t('a playlist') }) }
2259
+ : { name: U.t('IPTV playlist copy ({key})', { key: key }), unused: U.t('its playlist was removed') };
2168
2260
  }
2169
2261
  if ((m = key.match(/^stremiok\.local\.index\.(.+)$/))) {
2170
2262
  var kept = U.store.get('stremiok.local.indexes', {}) || {};
2171
- return kept[m[1]] ? { name: 'USB drive index: ' + m[1] } : { name: 'USB drive index: ' + m[1], unused: 'not one of the drives kept' };
2263
+ 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') };
2172
2264
  }
2173
- if (key === 'stremiok.local.index') { return { name: 'USB index (' + key + ')', unused: 'kept by an earlier version' }; }
2265
+ if (key === 'stremiok.local.index') { return { name: U.t('USB index ({key})', { key: key }), unused: U.t('kept by an earlier version') }; }
2174
2266
  return { name: key };
2175
2267
  }
2176
2268
  function fmtBytes(n) { return n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB'; }
2177
2269
  function storageLines(wrap, dbOn) {
2178
2270
  var r = U.el('div', 'addon-item focusable startup-row');
2179
- r.appendChild(U.el('div', 'a-name', 'TV storage' + (_storageInfo ? '' : ' — check what’s using it')));
2180
- if (_storageInfo === 'busy') { r.appendChild(U.el('div', 'a-url', 'Checking…')); }
2271
+ r.appendChild(U.el('div', 'a-name', U.t('TV storage') + (_storageInfo ? '' : ' — ' + U.t('check what’s using it'))));
2272
+ if (_storageInfo === 'busy') { r.appendChild(U.el('div', 'a-url', U.t('Checking…'))); }
2181
2273
  else if (_storageInfo) {
2182
2274
  var inf = _storageInfo;
2183
2275
  var line = function (t) { r.appendChild(U.el('div', 'a-url', t)); };
2184
2276
  var mine = inf.entries.reduce(function (n, e) { return n + e.bytes; }, 0);
2185
- if (inf.quota) { line('The TV’s database: ' + fmtBytes(inf.usage || 0) + ' used of ' + fmtBytes(inf.quota) + ' it allows StremioK'); }
2277
+ 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) })); }
2186
2278
  if (inf.entries.length) {
2187
- var own = 'StremioK’s own data: about ' + fmtBytes(mine) + ' in ' + inf.entries.length + (inf.entries.length === 1 ? ' item' : ' items');
2188
- 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);
2279
+ 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) });
2280
+ 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);
2189
2281
  }
2190
2282
  var sorted = inf.entries.slice().sort(function (a, b) { return b.bytes - a.bytes; });
2191
2283
  sorted.slice(0, STORAGE_ITEMS).forEach(function (e) {
2192
2284
  var d = storageItem(e.key), notes = [];
2193
- if (e.saves) { notes.push(e.saves === 1 ? 'saved once since StremioK started' : 'saved ' + e.saves + ' times since StremioK started'); }
2194
- if (d.unused) { notes.push('no longer used: ' + d.unused); }
2195
- if (inf.lsKeys[e.key]) { notes.push('also in the settings storage'); }
2285
+ if (e.saves) { notes.push(U.tn(e.saves, 'saved once since StremioK started', 'saved {n} times since StremioK started')); }
2286
+ if (d.unused) { notes.push(U.t('no longer used: {why}', { why: d.unused })); }
2287
+ if (inf.lsKeys[e.key]) { notes.push(U.t('also in the settings storage')); }
2196
2288
  line(fmtBytes(e.bytes) + ' ' + d.name + notes.map(function (n) { return ' · ' + n; }).join(''));
2197
2289
  });
2198
2290
  if (sorted.length > STORAGE_ITEMS) {
2199
- line('and ' + (sorted.length - STORAGE_ITEMS) + ' more: ' + fmtBytes(sorted.slice(STORAGE_ITEMS).reduce(function (n, e) { return n + e.bytes; }, 0)));
2291
+ 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)));
2200
2292
  }
2201
- if (!inf.entries.length) { line(dbOn ? 'Nothing in the TV’s database.' : 'The TV’s database isn’t used (turned off above).'); }
2202
- line('Settings storage: ' + fmtBytes(inf.ls) + ' (progress, watched marks, settings…)' + (inf.lsTop.length ? '; the largest:' : ''));
2293
+ 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).')); }
2294
+ line(U.t('Settings storage: {size} (progress, watched marks, settings…)', { size: fmtBytes(inf.ls) }) + (inf.lsTop.length ? '; ' + U.t('the largest:') : ''));
2203
2295
  inf.lsTop.forEach(function (e) { line(' ' + fmtBytes(e.bytes) + ' ' + e.key); });
2204
- 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')); }
2205
- 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')); }
2206
- 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)'); }
2296
+ 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) })); }
2297
+ 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) })); }
2298
+ 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) })); }
2207
2299
  }
2208
2300
  r.__onselect = function () {
2209
2301
  if (!U.bigStore || !U.bigStore.info || _storageInfo === 'busy') { return; }
@@ -2224,18 +2316,18 @@
2224
2316
  inf.lsTop = lsAll.sort(function (a, b) { return b.bytes - a.bytes; }).slice(0, 5);
2225
2317
  _storageInfo = inf;
2226
2318
  if (_settingsSection === 'storage') { renderSettings(); }
2227
- }, function () { _storageInfo = null; U.toast('Couldn’t check'); renderSettings(); });
2319
+ }, function () { _storageInfo = null; U.toast(U.t('Couldn’t check')); renderSettings(); });
2228
2320
  };
2229
2321
  wrap.appendChild(r);
2230
2322
  if (dbOn) { // (tidying up: only while it's used)
2231
2323
  var tidy = U.el('div', 'addon-item focusable');
2232
- tidy.appendChild(U.el('div', 'a-name', 'Tidy up the TV’s database'));
2233
- 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'));
2324
+ tidy.appendChild(U.el('div', 'a-name', U.t('Tidy up the TV’s database')));
2325
+ 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')));
2234
2326
  tidy.__onselect = function () {
2235
2327
  if (!U.bigStore || !U.bigStore.tidy) { return; }
2236
- U.toast('Tidying up the TV’s database…');
2328
+ U.toast(U.t('Tidying up the TV’s database…'));
2237
2329
  U.bigStore.tidy().then(function (res) {
2238
- 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');
2330
+ 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'));
2239
2331
  _storageInfo = null;
2240
2332
  if (_settingsSection === 'storage') { renderSettings(); }
2241
2333
  });
@@ -2243,10 +2335,10 @@
2243
2335
  wrap.appendChild(tidy);
2244
2336
  }
2245
2337
  var clr = U.el('div', 'addon-item focusable');
2246
- clr.appendChild(U.el('div', 'a-name', 'Clear saved copies'));
2247
- 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)'));
2338
+ clr.appendChild(U.el('div', 'a-name', U.t('Clear saved copies')));
2339
+ 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)')));
2248
2340
  clr.__onselect = function () {
2249
- confirm('Clear the copies StremioK can make again (Home rows, playlist copies, TV guides, Xtream lists, USB index)?', 'Clear', function () {
2341
+ confirm(U.t('Clear the copies StremioK can make again (Home rows, playlist copies, TV guides, Xtream lists, USB index)?'), U.t('Clear'), function () {
2250
2342
  U.bigStore.keys().then(function (ks) {
2251
2343
  return Promise.all(ks.filter(function (k) { return /^stremiok\.(homecache|local\.index|iptv\.cache\.)/.test(k); }).map(function (k) { return U.bigStore.remove(k); }));
2252
2344
  }).then(function () {
@@ -2255,7 +2347,7 @@
2255
2347
  if (typeof EPG !== 'undefined' && EPG.reset) { EPG.reset(); }
2256
2348
  if (typeof LocalMedia !== 'undefined') { LocalMedia.clearIndex(); }
2257
2349
  _storageInfo = null;
2258
- U.toast('Saved copies cleared');
2350
+ U.toast(U.t('Saved copies cleared'));
2259
2351
  renderSettings();
2260
2352
  });
2261
2353
  });
@@ -2265,7 +2357,7 @@
2265
2357
 
2266
2358
  // How long this launch (and the one before) took to get going, from when the TV
2267
2359
  // started loading the app.
2268
- var STARTUP_STEPS = [['css', 'stylesheet'], ['firstScreen', 'first screen'], ['addons', 'addons'], ['firstCard', 'first title']];
2360
+ var STARTUP_STEPS = [['css', U.t('stylesheet')], ['firstScreen', U.t('first screen')], ['addons', U.t('addons')], ['firstCard', U.t('first title')]];
2269
2361
  function startupText(m) {
2270
2362
  var parts = [];
2271
2363
  STARTUP_STEPS.forEach(function (st) { if (m && typeof m[st[0]] === 'number') { parts.push(st[1] + ' ' + (m[st[0]] / 1000).toFixed(1) + ' s'); } });
@@ -2276,9 +2368,9 @@
2276
2368
  var now = startupText(U.startupMarks()), before = startupText(U.startupMarks(true));
2277
2369
  if (!now && !before) { return; }
2278
2370
  var r = U.el('div', 'addon-item focusable startup-row');
2279
- r.appendChild(U.el('div', 'a-name', 'Startup'));
2280
- if (now) { r.appendChild(U.el('div', 'a-url', 'This launch: ' + now)); }
2281
- if (before) { r.appendChild(U.el('div', 'a-url', 'Launch before: ' + before)); }
2371
+ r.appendChild(U.el('div', 'a-name', U.t('Startup')));
2372
+ if (now) { r.appendChild(U.el('div', 'a-url', U.t('This launch: {steps}', { steps: now }))); }
2373
+ if (before) { r.appendChild(U.el('div', 'a-url', U.t('Launch before: {steps}', { steps: before }))); }
2282
2374
  wrap.appendChild(r);
2283
2375
  }
2284
2376
 
@@ -2287,16 +2379,16 @@
2287
2379
  var _appsFocus = null; // { id, ctl } to focus after a change
2288
2380
  var _appsAll = false; // the add list includes hidden (system) apps
2289
2381
  function settingsAppShortcuts(wrap) {
2290
- wrap.appendChild(U.el('h2', null, 'Streaming apps'));
2382
+ wrap.appendChild(U.el('h2', null, U.t('Streaming apps')));
2291
2383
  if (!canListApps()) {
2292
- wrap.appendChild(U.el('div', 'hint', 'Only on the TV: this install can\'t see or open the TV\'s apps.'));
2384
+ wrap.appendChild(U.el('div', 'hint', U.t('Only on the TV: this install can\'t see or open the TV\'s apps.')));
2293
2385
  focusSettings();
2294
2386
  return;
2295
2387
  }
2296
2388
  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.'));
2297
2389
  function redo(id, ctl) { _appsFocus = { id: id, ctl: ctl }; renderSettings(); }
2298
2390
  var mine = TVApps.shortcuts(), nameOf = {};
2299
- if (!mine.length) { wrap.appendChild(U.el('div', 'hint', 'None listed yet: pick apps below.')); }
2391
+ if (!mine.length) { wrap.appendChild(U.el('div', 'hint', U.t('None listed yet: pick apps below.'))); }
2300
2392
  mine.forEach(function (a, i) {
2301
2393
  var r = U.el('div', 'addon-item focusable app-mine');
2302
2394
  r.setAttribute('data-fk', a.id); r.setAttribute('data-ctl', 'name');
@@ -2305,14 +2397,14 @@
2305
2397
  r.appendChild(nameOf[a.id]);
2306
2398
  r.__onselect = function () {
2307
2399
  TVApps.remove(a.id);
2308
- U.toast(a.name + ' removed', 1500);
2400
+ U.toast(U.t('{name} removed', { name: a.name }), 1500);
2309
2401
  var next = mine[i + 1] || mine[i - 1]; // focus stays in the list
2310
2402
  redo(next ? next.id : null, next ? 'name' : 'add');
2311
2403
  };
2312
2404
  wrap.appendChild(r);
2313
2405
  });
2314
- wrap.appendChild(U.el('div', 'formats-group', 'Add an app'));
2315
- var status = U.el('div', 'hint', 'Reading this TV\'s apps…');
2406
+ wrap.appendChild(U.el('div', 'formats-group', U.t('Add an app')));
2407
+ var status = U.el('div', 'hint', U.t('Reading this TV\'s apps…'));
2316
2408
  wrap.appendChild(status);
2317
2409
  function focusNow() {
2318
2410
  var want = _appsFocus, pref = null;
@@ -2328,23 +2420,23 @@
2328
2420
  if (_settingsSection !== 'appshortcuts' || !wrap.parentNode) { return; } // left meanwhile
2329
2421
  var onTv = {};
2330
2422
  apps.forEach(function (a) { onTv[a.id] = true; });
2331
- mine.forEach(function (a) { if (!onTv[a.id]) { nameOf[a.id].textContent += ' · not on this TV any more'; } });
2423
+ mine.forEach(function (a) { if (!onTv[a.id]) { nameOf[a.id].textContent += ' · ' + U.t('not on this TV any more'); } });
2332
2424
  var hidden = 0;
2333
2425
  var list = apps.filter(function (a) {
2334
2426
  if (TVApps.has(a.id)) { return false; }
2335
2427
  if (!_appsAll && !a.show) { hidden++; return false; }
2336
2428
  return true;
2337
2429
  });
2338
- 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).'
2339
- : 'Every app on this TV is already listed.';
2430
+ 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).')
2431
+ : U.t('Every app on this TV is already listed.');
2340
2432
  list.forEach(function (a, i) {
2341
2433
  var r = U.el('div', 'addon-item focusable app-add');
2342
2434
  r.setAttribute('data-fk', a.id); r.setAttribute('data-ctl', 'add');
2343
2435
  r.appendChild(U.el('div', 'a-name', a.name));
2344
- r.appendChild(U.el('div', 'a-url', a.id + (a.show ? '' : ' · hidden (system) app')));
2436
+ r.appendChild(U.el('div', 'a-url', a.id + (a.show ? '' : ' · ' + U.t('hidden (system) app'))));
2345
2437
  r.__onselect = function () {
2346
- if (!TVApps.add(a)) { U.toast('That\'s the most apps StremioK keeps (' + TVApps.MAX + ')'); return; }
2347
- U.toast(a.name + ' added', 1500);
2438
+ if (!TVApps.add(a)) { U.toast(U.t('That\'s the most apps StremioK keeps ({n})', { n: TVApps.MAX })); return; }
2439
+ U.toast(U.t('{name} added', { name: a.name }), 1500);
2348
2440
  var next = list[i + 1] || list[i - 1]; // keep adding from here
2349
2441
  redo(next ? next.id : a.id, next ? 'add' : 'name');
2350
2442
  };
@@ -2353,14 +2445,14 @@
2353
2445
  if (_appsAll || hidden) {
2354
2446
  var more = U.el('div', 'addon-item focusable app-add');
2355
2447
  more.setAttribute('data-fk', '*hidden'); more.setAttribute('data-ctl', 'hidden');
2356
- more.appendChild(U.el('div', 'a-name', _appsAll ? 'Hide the hidden (system) apps' : 'Also show ' + hidden + ' hidden (system) app' + (hidden === 1 ? '' : 's')));
2448
+ 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')));
2357
2449
  more.__onselect = function () { _appsAll = !_appsAll; redo('*hidden', 'hidden'); };
2358
2450
  wrap.appendChild(more);
2359
2451
  }
2360
2452
  focusNow();
2361
2453
  }, function (e) {
2362
2454
  if (_settingsSection !== 'appshortcuts' || !wrap.parentNode) { return; }
2363
- status.textContent = 'The TV didn\'t list its apps: ' + e.message;
2455
+ status.textContent = U.t('The TV didn\'t list its apps: {why}', { why: e.message });
2364
2456
  focusNow();
2365
2457
  });
2366
2458
  }
@@ -2380,41 +2472,41 @@
2380
2472
  }, function (e) { done({ error: e.message }); });
2381
2473
  }
2382
2474
  function launchTvApp(a) {
2383
- TVApps.launch(a).then(null, function (e) { U.toast('Couldn\'t open ' + a.name + ': ' + e.message, 4000); });
2475
+ TVApps.launch(a).then(null, function (e) { U.toast(U.t('Couldn\'t open {name}: {why}', { name: a.name, why: e.message }), 4000); });
2384
2476
  }
2385
2477
  // Returns the first app row (to focus), if the list is showing.
2386
2478
  function tvAppsSection(wrap) {
2387
- wrap.appendChild(U.el('h2', null, 'Diagnostics › Installed apps'));
2479
+ wrap.appendChild(U.el('h2', null, U.t('Diagnostics › Installed apps')));
2388
2480
  if (!canListApps()) {
2389
- wrap.appendChild(U.el('div', 'hint', 'Only on the TV: this install can\'t see the TV\'s apps.'));
2481
+ wrap.appendChild(U.el('div', 'hint', U.t('Only on the TV: this install can\'t see the TV\'s apps.')));
2390
2482
  return null;
2391
2483
  }
2392
2484
  if (!_tvApps) {
2393
2485
  var show = U.el('div', 'addon-item focusable');
2394
- show.appendChild(U.el('div', 'a-name', 'Show installed apps'));
2395
- show.appendChild(U.el('div', 'a-url', 'Their names and IDs, as the TV reports them'));
2486
+ show.appendChild(U.el('div', 'a-name', U.t('Show installed apps')));
2487
+ show.appendChild(U.el('div', 'a-url', U.t('Their names and IDs, as the TV reports them')));
2396
2488
  show.__onselect = function () { readTvApps(false); };
2397
2489
  wrap.appendChild(show);
2398
2490
  return null;
2399
2491
  }
2400
2492
  if (_tvApps.error) {
2401
- wrap.appendChild(U.el('div', 'hint', 'The TV didn\'t list its apps: ' + _tvApps.error));
2493
+ wrap.appendChild(U.el('div', 'hint', U.t('The TV didn\'t list its apps: {why}', { why: _tvApps.error })));
2402
2494
  return null;
2403
2495
  }
2404
- wrap.appendChild(U.el('div', 'hint', _tvApps.list.length + ' app' + (_tvApps.list.length === 1 ? '' : 's') +
2405
- (_tvApps.all ? ', including hidden ones' : '') + '. OK on one opens it (to check StremioK can launch it).'));
2496
+ 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.')) +
2497
+ ' ' + U.t('OK on one opens it (to check StremioK can launch it).')));
2406
2498
  var first = null;
2407
2499
  _tvApps.list.forEach(function (a) {
2408
2500
  var r = U.el('div', 'addon-item focusable diag-row');
2409
2501
  r.appendChild(U.el('div', 'a-name', a.name));
2410
- r.appendChild(U.el('div', 'a-url', a.id + (a.version ? ' · version ' + a.version : '')));
2502
+ r.appendChild(U.el('div', 'a-url', a.id + (a.version ? ' · ' + U.t('version {v}', { v: a.version }) : '')));
2411
2503
  r.__onselect = function () { launchTvApp(a); };
2412
2504
  wrap.appendChild(r);
2413
2505
  if (!first) { first = r; }
2414
2506
  });
2415
2507
  if (!_tvApps.all && _tvApps.hidden > 0) {
2416
2508
  var more = U.el('div', 'addon-item focusable');
2417
- more.appendChild(U.el('div', 'a-name', 'Also show ' + _tvApps.hidden + ' hidden (system) app' + (_tvApps.hidden === 1 ? '' : 's')));
2509
+ more.appendChild(U.el('div', 'a-name', U.tn(_tvApps.hidden, 'Also show {n} hidden (system) app', 'Also show {n} hidden (system) apps')));
2418
2510
  more.__onselect = function () { readTvApps(true); };
2419
2511
  wrap.appendChild(more);
2420
2512
  }
@@ -2426,36 +2518,36 @@
2426
2518
  // that can search, IPTV as one per type). ▲/▼ moves one; OK on its name shows / hides it.
2427
2519
  // 'menu': the top menu between Watching and Settings (the tabs, Discover, Search: ViewParts'
2428
2520
  // menuOrder); OK on a tab shows / hides it, Discover and Search always show.
2429
- var MENU_FIXED = { discover: 'Discover', search: 'Search' };
2521
+ var MENU_FIXED = { discover: U.t('Discover'), search: U.t('Search') };
2430
2522
  function menuHidden(k) { return !MENU_FIXED[k] && (Stremio.getPrefs().hiddenTabs || []).indexOf(k) !== -1; }
2431
2523
  var FEED_KINDS = {
2432
- 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.',
2524
+ 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.'),
2433
2525
  list: function () {
2434
2526
  return Promise.resolve(V.menuOrder().map(function (k) {
2435
2527
  var t = (V.HOME_TABS || []).filter(function (x) { return x.key === k; })[0];
2436
- 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)' : '') };
2528
+ 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)') : '') };
2437
2529
  }));
2438
2530
  },
2439
2531
  keyOf: function (x) { return x.key; },
2440
2532
  move: function (k, d) { V.moveMenuItem(k, d); markHomeDirty(); return Promise.resolve(); },
2441
2533
  toggle: function (k) {
2442
- if (MENU_FIXED[k]) { U.toast(MENU_FIXED[k] + ' is always in the menu'); return; }
2534
+ if (MENU_FIXED[k]) { U.toast(U.t('{tab} is always in the menu', { tab: MENU_FIXED[k] })); return; }
2443
2535
  var now = (Stremio.getPrefs().hiddenTabs || []).filter(function (x) { return x !== k; });
2444
2536
  if (!menuHidden(k)) { now.push(k); }
2445
2537
  Stremio.setPref('hiddenTabs', now);
2446
2538
  markHomeDirty();
2447
2539
  },
2448
2540
  hidden: menuHidden },
2449
- home: { section: 'feeds', title: 'Home › Home feeds', hint: '▲/▼ reorder a feed · OK on the name shows/hides it on Home.',
2541
+ home: { section: 'feeds', title: U.t('Home › Home feeds'), hint: U.t('▲/▼ reorder a feed · OK on the name shows/hides it on Home.'),
2450
2542
  list: function () { return Stremio.listCatalogsOrdered(); }, keyOf: function (c) { return Stremio.catalogKey(c); },
2451
2543
  move: function (k, d) { return Stremio.moveFeed(k, d); }, toggle: function (k) { Stremio.toggleFeed(k); },
2452
2544
  hidden: function (k) { return Stremio.isFeedHidden(k); } },
2453
- search: { section: 'searchfeeds', title: 'Home › Search results', hint: '▲/▼ reorder the Search rows · OK on the name shows/hides one in Search.',
2545
+ 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.'),
2454
2546
  list: function () { return Stremio.searchSourcesOrdered(); }, keyOf: function (src) { return src.key; },
2455
2547
  move: function (k, d) { return Stremio.moveSearchFeed(k, d); }, toggle: function (k) { Stremio.toggleSearchFeed(k); },
2456
2548
  hidden: function (k) { return Stremio.isSearchFeedHidden(k); } },
2457
- ranking: { section: 'ranking', title: 'Playback › Source ranking', off: 'off',
2458
- 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.',
2549
+ ranking: { section: 'ranking', title: U.t('Playback › Source ranking'), off: 'off',
2550
+ 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.'),
2459
2551
  list: function () { return Promise.resolve(Stremio.getRanking().criteria); }, keyOf: function (c) { return c.key; },
2460
2552
  move: function (k, d) { Stremio.moveRanking(k, d); return Promise.resolve(); }, toggle: function (k) { Stremio.toggleRanking(k); },
2461
2553
  hidden: function (k) { return !Stremio.getRanking().criteria.some(function (c) { return c.key === k && c.on; }); },
@@ -2463,30 +2555,30 @@
2463
2555
  var played = Stremio.getRanking().played;
2464
2556
  var r = U.el('div', 'addon-item focusable cfg-row feed-extra');
2465
2557
  r.setAttribute('data-fk', 'played'); r.setAttribute('data-ctl', 'extra');
2466
- r.appendChild(U.el('div', 'a-name', 'Played before first: ' + (played ? 'On' : 'Off')));
2467
- r.appendChild(U.el('div', 'a-url', (played ? 'Sources you played for a title (for a series, its release) come before the resolution groups'
2468
- : 'Sources you played rank like any other') + ' · OK to turn ' + (played ? 'off' : 'on')));
2558
+ r.appendChild(U.el('div', 'a-name', U.t('Played before first:') + ' ' + (played ? U.t('On') : U.t('Off'))));
2559
+ 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')
2560
+ : U.t('Sources you played rank like any other')) + ' · ' + (played ? U.t('OK to turn off') : U.t('OK to turn on'))));
2469
2561
  r.__onselect = function () { Stremio.setPlayedFirst(!played); refeed('ranking', 'played', 'extra'); };
2470
2562
  wrap.appendChild(r);
2471
- wrap.appendChild(rankPageRow('Filters ›', filtersSummary(), 'rankfilters'));
2472
- wrap.appendChild(rankPageRow('When you press Play ›', onPlaySummary(), 'rankplay'));
2563
+ wrap.appendChild(rankPageRow(U.t('Filters ›'), filtersSummary(), 'rankfilters'));
2564
+ wrap.appendChild(rankPageRow(U.t('When you press Play ›'), onPlaySummary(), 'rankplay'));
2473
2565
  if (_focusChild === 'rankfilters' || _focusChild === 'rankplay') { _feedFocus = { key: _focusChild, ctl: 'extra' }; _focusChild = null; } // (BACK from one: on its row)
2474
- wrap.appendChild(U.el('div', 'formats-group', 'Then, in this order'));
2566
+ wrap.appendChild(U.el('div', 'formats-group', U.t('Then, in this order')));
2475
2567
  },
2476
2568
  after: function (wrap) {
2477
2569
  var r = U.el('div', 'addon-item focusable feed-extra');
2478
2570
  r.setAttribute('data-fk', 'reset'); r.setAttribute('data-ctl', 'extra');
2479
- r.appendChild(U.el('div', 'a-name', 'Restore defaults'));
2571
+ r.appendChild(U.el('div', 'a-name', U.t('Restore defaults')));
2480
2572
  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)'));
2481
- r.__onselect = function () { Stremio.resetRanking(); refeed('ranking', 'reset', 'extra'); U.toast('Source ranking restored'); };
2573
+ r.__onselect = function () { Stremio.resetRanking(); refeed('ranking', 'reset', 'extra'); U.toast(U.t('Source ranking restored')); };
2482
2574
  wrap.appendChild(r);
2483
2575
  // The addons that provide sources (Feed sources): their order, and on / off
2484
- wrap.appendChild(U.el('div', 'formats-group', 'Addons'));
2485
- wrap.appendChild(U.el('div', 'hint', 'The addons that give sources: ▲/▼ sets their order, OK turns one off (it isn\'t asked).'));
2576
+ wrap.appendChild(U.el('div', 'formats-group', U.t('Addons')));
2577
+ wrap.appendChild(U.el('div', 'hint', U.t('The addons that give sources: ▲/▼ sets their order, OK turns one off (it isn\'t asked).')));
2486
2578
  return Stremio.feedSourcesOrdered().then(function (items) {
2487
- if (!items.length) { wrap.appendChild(U.el('div', 'hint', 'None of your addons provide sources: add a stream addon in Settings › Content › Addons.')); }
2579
+ 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.'))); }
2488
2580
  feedRows(wrap, 'ranking', items, SOURCE_ROWS);
2489
- }, function () { wrap.appendChild(U.el('div', 'hint', 'Your addons couldn\'t be read just now.')); });
2581
+ }, function () { wrap.appendChild(U.el('div', 'hint', U.t('Your addons couldn\'t be read just now.'))); });
2490
2582
  } }
2491
2583
  };
2492
2584
  // Source ranking's two pages (rankfilters, rankplay): a row on it that opens one, saying
@@ -2500,19 +2592,19 @@
2500
2592
  return r;
2501
2593
  }
2502
2594
  function filtersSummary() {
2503
- var P = Stremio.getPrefs(), bits = ['Sources the TV can’t play: ' + (P.hideUnplayable ? 'Hidden' : 'Shown')], sizes = [];
2504
- [['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)); } });
2505
- bits.push(sizes.length ? sizes.join(', ') : 'No size limits');
2506
- bits.push(P.hideWords.length ? 'Words: ' + P.hideWords.join(', ') : 'No words');
2595
+ var P = Stremio.getPrefs(), bits = [U.t('Sources the TV can’t play:') + ' ' + (P.hideUnplayable ? U.t('Hidden') : U.t('Shown'))], sizes = [];
2596
+ [['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)); } });
2597
+ bits.push(sizes.length ? sizes.join(', ') : U.t('No size limits'));
2598
+ bits.push(P.hideWords.length ? U.t('Words: {words}', { words: P.hideWords.join(', ') }) : U.t('No words'));
2507
2599
  return bits.join(' · ');
2508
2600
  }
2509
2601
  function onPlaySummary() {
2510
2602
  var P = Stremio.getPrefs();
2511
- return 'Source list: ' + (P.skipSourceList ? 'skipped' : 'shown') + ' · The next source if one doesn’t start: ' + (P.nextOnFail ? 'On' : 'Off');
2603
+ 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'));
2512
2604
  }
2513
2605
  // A page of its own: its title, a hint, its rows; focus back on the one just changed.
2514
2606
  function rankPage(wrap, title, hint, rows) {
2515
- wrap.appendChild(U.el('h2', null, 'Playback › Source ranking › ' + title));
2607
+ wrap.appendChild(U.el('h2', null, U.t('Playback') + ' › ' + U.t('Source ranking') + ' › ' + title));
2516
2608
  wrap.appendChild(U.el('div', 'hint feeds-hint', hint));
2517
2609
  rows.forEach(function (r) { wrap.appendChild(r); });
2518
2610
  var pref = null;
@@ -2521,21 +2613,21 @@
2521
2613
  }
2522
2614
  // Filters: what's left out, or sent to the bottom.
2523
2615
  function settingsRankFilters(wrap) {
2524
- rankPage(wrap, 'Filters', 'Sources these leave out, or send to the bottom of the list: never picked on their own.',
2525
- [unplayableRow(), sizeRow('movie', 'Movies’ sizes'), sizeRow('series', 'Series’ sizes (an episode)'), wordsRow()]);
2616
+ rankPage(wrap, U.t('Filters'), U.t('Sources these leave out, or send to the bottom of the list: never picked on their own.'),
2617
+ [unplayableRow(), sizeRow('movie', U.t('Movies’ sizes')), sizeRow('series', U.t('Series’ sizes (an episode)')), wordsRow()]);
2526
2618
  }
2527
2619
  // When you press Play: whether the list shows, and a source that doesn't start.
2528
2620
  function settingsRankPlay(wrap) {
2529
- rankPage(wrap, 'When you press Play', 'What ▶ Play does with the ranked list.', [skipListRow(), nextOnFailRow()]);
2621
+ rankPage(wrap, U.t('When you press Play'), U.t('What ▶ Play does with the ranked list.'), [skipListRow(), nextOnFailRow()]);
2530
2622
  }
2531
2623
  // direct links only: the sources the TV can't play left out of the list
2532
2624
  function unplayableRow() {
2533
2625
  var hideUn = Stremio.getPrefs().hideUnplayable;
2534
2626
  var un = U.el('div', 'addon-item focusable cfg-row feed-extra');
2535
2627
  un.setAttribute('data-fk', 'unplayable'); un.setAttribute('data-ctl', 'extra');
2536
- un.appendChild(U.el('div', 'a-name', 'Sources the TV can’t play: ' + (hideUn ? 'Hidden' : 'Shown')));
2537
- un.appendChild(U.el('div', 'a-url', (hideUn ? 'Left out (torrents, links it can’t open): direct links only; where-to-watch apps stay'
2538
- : 'Listed, dimmed, at the bottom (torrents, links it can’t open)') + ' · OK to ' + (hideUn ? 'show them' : 'hide them')));
2628
+ un.appendChild(U.el('div', 'a-name', U.t('Sources the TV can’t play:') + ' ' + (hideUn ? U.t('Hidden') : U.t('Shown'))));
2629
+ 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')
2630
+ : 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'))));
2539
2631
  un.__onselect = function () { Stremio.setPref('hideUnplayable', !hideUn); refeed('ranking', 'unplayable', 'extra'); };
2540
2632
  return un;
2541
2633
  }
@@ -2544,9 +2636,9 @@
2544
2636
  var skipList = Stremio.getPrefs().skipSourceList;
2545
2637
  var sl = U.el('div', 'addon-item focusable cfg-row feed-extra');
2546
2638
  sl.setAttribute('data-fk', 'skiplist'); sl.setAttribute('data-ctl', 'extra');
2547
- sl.appendChild(U.el('div', 'a-name', 'Skip the source list: ' + (skipList ? 'On' : 'Off')));
2548
- 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)'
2549
- : '▶ 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')));
2639
+ sl.appendChild(U.el('div', 'a-name', U.t('Skip the source list:') + ' ' + (skipList ? U.t('On') : U.t('Off'))));
2640
+ 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)')
2641
+ : 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'))));
2550
2642
  sl.__onselect = function () { Stremio.setPref('skipSourceList', !skipList); refeed('ranking', 'skiplist', 'extra'); };
2551
2643
  return sl;
2552
2644
  }
@@ -2555,9 +2647,9 @@
2555
2647
  var nextOn = Stremio.getPrefs().nextOnFail;
2556
2648
  var nx = U.el('div', 'addon-item focusable cfg-row feed-extra');
2557
2649
  nx.setAttribute('data-fk', 'nextonfail'); nx.setAttribute('data-ctl', 'extra');
2558
- nx.appendChild(U.el('div', 'a-name', 'The next source if one doesn’t start: ' + (nextOn ? 'On' : 'Off')));
2559
- 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)'
2560
- : 'A source that doesn’t start takes you back to the list') + ' · OK to turn ' + (nextOn ? 'off' : 'on')));
2650
+ nx.appendChild(U.el('div', 'a-name', U.t('The next source if one doesn’t start:') + ' ' + (nextOn ? U.t('On') : U.t('Off'))));
2651
+ 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)')
2652
+ : 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'))));
2561
2653
  nx.__onselect = function () { Stremio.setPref('nextOnFail', !nextOn); refeed('ranking', 'nextonfail', 'extra'); };
2562
2654
  return nx;
2563
2655
  }
@@ -2566,11 +2658,11 @@
2566
2658
  var words = Stremio.getPrefs().hideWords;
2567
2659
  var w = U.el('div', 'addon-item focusable cfg-row feed-extra');
2568
2660
  w.setAttribute('data-fk', 'words'); w.setAttribute('data-ctl', 'extra');
2569
- w.appendChild(U.el('div', 'a-name', 'Hide sources with these words: ' + (words.length ? words.join(', ') : 'None')));
2570
- 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'));
2661
+ w.appendChild(U.el('div', 'a-name', U.t('Hide sources with these words:') + ' ' + (words.length ? words.join(', ') : U.t('None'))));
2662
+ 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')));
2571
2663
  w.__onselect = function () {
2572
- App.openEntry({ title: 'Hide sources with these words', value: words.join(', '), placeholder: 'CAM, HDTS, TELESYNC',
2573
- 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.',
2664
+ App.openEntry({ title: U.t('Hide sources with these words'), value: words.join(', '), placeholder: U.t('CAM, HDTS, TELESYNC'),
2665
+ 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.'),
2574
2666
  validate: function () { return null; },
2575
2667
  onConfirm: function (v) { App.back(); Stremio.setHideWords(v); refeed('ranking', 'words', 'extra'); } });
2576
2668
  };
@@ -2579,23 +2671,23 @@
2579
2671
  // Size limits (Settings › Source ranking › Filters): smallest, largest and most per hour, for movies or
2580
2672
  // series; OK on the row: which one, then its value.
2581
2673
  var SIZE_CHOICES = {
2582
- min: { label: 'Smallest', none: 'None', values: [0.1, 0.3, 0.5, 1, 2] },
2583
- max: { label: 'Largest', none: 'None', values: [2, 4, 8, 15, 20, 30, 50, 80] },
2584
- perHour: { label: 'Most per hour', none: 'None', values: [1, 1.5, 2, 3, 4, 6, 10], unit: ' an hour' }
2674
+ min: { label: U.t('Smallest'), none: U.t('None'), values: [0.1, 0.3, 0.5, 1, 2] },
2675
+ max: { label: U.t('Largest'), none: U.t('None'), values: [2, 4, 8, 15, 20, 30, 50, 80] },
2676
+ 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') }
2585
2677
  };
2586
2678
  function sizeSummary(L) {
2587
2679
  var bits = [];
2588
- if (L.min) { bits.push('at least ' + Stremio.gbText(L.min)); }
2589
- if (L.max) { bits.push('up to ' + Stremio.gbText(L.max)); }
2590
- if (L.perHour) { bits.push('up to ' + Stremio.gbText(L.perHour) + ' an hour'); }
2591
- return bits.length ? bits.join(', ') : 'No limits';
2680
+ if (L.min) { bits.push(U.t('at least {size}', { size: Stremio.gbText(L.min) })); }
2681
+ if (L.max) { bits.push(U.t('up to {size}', { size: Stremio.gbText(L.max) })); }
2682
+ if (L.perHour) { bits.push(U.t('up to {size} an hour', { size: Stremio.gbText(L.perHour) })); }
2683
+ return bits.length ? bits.join(', ') : U.t('No limits');
2592
2684
  }
2593
2685
  function sizeRow(kind, title) {
2594
2686
  var L = Stremio.getPrefs().sizeLimits[kind];
2595
2687
  var r = U.el('div', 'addon-item focusable cfg-row feed-extra');
2596
2688
  r.setAttribute('data-fk', 'size-' + kind); r.setAttribute('data-ctl', 'extra');
2597
2689
  r.appendChild(U.el('div', 'a-name', title + ': ' + sizeSummary(L)));
2598
- 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'));
2690
+ 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')));
2599
2691
  r.__onselect = function () {
2600
2692
  var which = ['min', 'max', 'perHour'].map(function (w) {
2601
2693
  var C = SIZE_CHOICES[w];
@@ -2664,7 +2756,7 @@
2664
2756
  wrap.appendChild(U.el('div', 'hint feeds-hint', K.hint));
2665
2757
  if (K.before) { K.before(wrap); }
2666
2758
  K.list().then(function (items) {
2667
- 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.')); }
2759
+ 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.'))); }
2668
2760
  feedRows(wrap, kind, items, K);
2669
2761
  return K.after ? K.after(wrap) : null;
2670
2762
  }).then(function () {