stremiok 2.3.4 → 2.3.5

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