From 8c22340978293ecbbb590cac9c193e3da92ace00 Mon Sep 17 00:00:00 2001 From: Rafael Vieira Date: Tue, 6 Jul 2021 01:27:32 -0300 Subject: [PATCH] feat(web): add ng-i18next and implements on xmltv-settings, plex-settings, guide and top-menu close #266 --- web/app.js | 27 ++++++- web/controllers/guide.js | 1 - web/public/index.html | 7 +- web/public/locales/en/main.json | 77 +++++++++++++++++++ web/public/templates/plex-settings.html | 96 ++++++++++++------------ web/public/templates/xmltv-settings.html | 22 +++--- web/public/views/guide.html | 4 +- 7 files changed, 170 insertions(+), 64 deletions(-) create mode 100644 web/public/locales/en/main.json diff --git a/web/app.js b/web/app.js index ca21a73..eab458c 100644 --- a/web/app.js +++ b/web/app.js @@ -4,8 +4,33 @@ require('./ext/lazyload')(angular) require('./ext/dragdrop') require('./ext/angularjs-scroll-glue') require('angular-vs-repeat'); +require('angular-sanitize'); +const i18next = require('i18next'); +const i18nextHttpBackend = require('i18next-http-backend'); +window.i18next = i18next; -var app = angular.module('myApp', ['ngRoute', 'vs-repeat', 'angularLazyImg', 'dndLists', 'luegg.directives']) +window.i18next.use(i18nextHttpBackend); + +window.i18next.init({ + // debug: true, + lng: 'en', + fallbackLng: 'en', + preload: ['en'], + ns: [ 'main' ], + defaultNS: [ 'main' ], + initImmediate: false, + backend: { + loadPath: '/locales/{{lng}}/{{ns}}.json' + }, + useCookie: false, + useLocalStorage: false, +}, function (err, t) { + console.log('resources loaded'); +}); + +require('ng-i18next'); + +var app = angular.module('myApp', ['ngRoute', 'vs-repeat', 'angularLazyImg', 'dndLists', 'luegg.directives', 'jm.i18next']) app.service('plex', require('./services/plex')) app.service('dizquetv', require('./services/dizquetv')) diff --git a/web/controllers/guide.js b/web/controllers/guide.js index 7098b73..1922e8b 100644 --- a/web/controllers/guide.js +++ b/web/controllers/guide.js @@ -83,7 +83,6 @@ module.exports = function ($scope, $timeout, dizquetv) { $scope.t1 = (new Date()).getTime(); $scope.t1 = ($scope.t1 - $scope.t1 % MINUTE ); $scope.t0 = $scope.t1 - $scope.before + $scope.offset; - $scope.title = "TV Guide"; $scope.times = []; $scope.updateJustNow(); diff --git a/web/public/index.html b/web/public/index.html index 201bd08..e9f8d7b 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -33,7 +33,12 @@ - Guide - Channels - Library - Player - Settings - Version + {{'topMenu.guide' | i18next}} - + {{'topMenu.channels' | i18next}} - + {{'topMenu.library' | i18next}} - + {{'topMenu.player' | i18next}} - + {{'topMenu.settings' | i18next}} - + {{'topMenu.version' | i18next}} XMLTV diff --git a/web/public/locales/en/main.json b/web/public/locales/en/main.json new file mode 100644 index 0000000..3bf946d --- /dev/null +++ b/web/public/locales/en/main.json @@ -0,0 +1,77 @@ +{ + "topMenu": { + "guide": "Guide", + "channels": "Channels", + "library": "Library", + "player": "Player", + "settings": "Settings", + "version": "Version" + }, + "guide": { + "title": "Tv Guide", + "attempt_to_play_channel": "Attempt to play channel: {{title}} in local media player" + }, + "settings_server": { + "title": "Plex Settings", + "servers": "Plex Servers", + "sign_server": "Sign In/Add Servers", + "add_server": "Add a Plex Server", + "minutes_to_sign_plex": "You have 2 minutes to sign into your Plex Account.", + "name": "Name", + "uri": "URI", + "ui_route": "UI Route", + "backend_route": "Backend Route", + "ok": "ok", + "error": "error", + "ui_bad": "If a Plex server configuration has problems with the UI route, the channel editor won't be able to access its content.", + "backend_bad": "If a Plex server configuration has problems with the backend route, dizqueTV won't be able to play its content.", + "plex_transcoder_settings": "Plex Transcoder Settings", + "update": "Update", + "reset_options": "Reset Options", + "debug_logging": "Debug logging", + "paths": "Paths", + "send_status_plex": "Send play status to Plex", + "send_status_plex_note": "Note: This affects the \"on deck\" for your plex account.", + "no_plex_path": "If stream changes video codec, audio codec, or audio channels upon episode change, you will experience playback issues unless ffmpeg transcoding and normalization are also enabled.", + + "video_options": "Video Options", + "supported_video_formats": "Supported Video Formats", + "max_playable_resolution": "Max Playable Resolution", + "max_transcode_resolution": "Max Transcode Resolution", + "audio_options": "Audio Options", + "supported_audio_formats": "Supported Audio Formats", + "supported_audio_formats_note": "Comma separated list. Some possible values are 'ac3,aac,mp3'.", + "max_audio_channels": "Maximum Audio Channels", + "max_audio_channels_note": "Note: 7.1 audio and on some clients, 6.1, is known to cause playback issues.", + "audio_boost": "Audio Boost", + "audio_boost_note": "Note: Only applies when downmixing to stereo.", + "miscellaneous_options": "Miscellaneous Options", + "max_direct_stream_bitrate": "Max Direct Stream Bitrate (Kbps)", + "max_transcode_bitrate": "Max Transcode Bitrate (Kbps)", + "max_transcode_bitrate_note": "Plex will decide to transcode or direct play based on these settings and if Plex transcodes, it will try to match the transcode bitrate.", + "direct_stream_media_buffer": "Direct Stream Media Buffer Size", + "transcode_media_buffer": "Transcode Media Buffer Size", + "stream_protocol": "Stream Protocol", + "force_direct_play": "Force Direct Play", + "subtitle_options": "Subtitle Options", + "subtitle_size": "Subtitle Size", + "enable_subtitle": "Enable Subtitles (Requires Transcoding)", + "path_replacements": "Path Replacements", + "original_plex_path": "Original Plex path to replace:", + "replace_plex_path": "Replace Plex path with:" + + }, + "settings_xmltv": { + "title": "XMLTV Settings", + "update": "Update", + "reset_options": "Reset Options", + "output_path": "Output Path", + "output_path_note": "You can edit this location in file xmltv-settings.json.", + "epg_hours": "EPG Hours", + "epg_hours_note": "How many hours of programming to include in the xmltv file.", + "refresh_timer": "Refresh Timer (hours)", + "refresh_timer_note": "How often should the xmltv file be updated.", + "image_cache": "Image Cache", + "image_cache_note": "If enabled the pictures used for Movie and TV Show posters will be cached in dizqueTV's .dizqueTV folder and will be delivered by dizqueTV's server instead of requiring calls to Plex. Note that using fixed xmltv location in Plex (as opposed to url) will not work correctly in this case." + } +} \ No newline at end of file diff --git a/web/public/templates/plex-settings.html b/web/public/templates/plex-settings.html index 158b224..805d147 100644 --- a/web/public/templates/plex-settings.html +++ b/web/public/templates/plex-settings.html @@ -1,28 +1,28 @@
-
Plex Settings
-
Plex Servers +
{{'settings_server.title' | i18next}}
+
{{'settings_server.servers' | i18next}}

- {{ isProcessing ? 'You have 2 minutes to sign into your Plex Account.' : ''}} + {{ isProcessing ? 'settings_server.minutes_to_sign_plex' : '' | i18next}}

- - - - + + + + @@ -33,13 +33,13 @@
NameuriUI RouteBackend Route{{'settings_server.name' | i18next}}{{'settings_server.uri' | i18next}}{{'settings_server.ui_route' | i18next}}{{'settings_server.backend_route' | i18next}}
-

Add a Plex Server

+

{{'settings_server.add_server' | i18next}}

{{ x.uri }}
-
ok
-
error
+
{{'settings_server.ok' | i18next}}
+
{{'settings_server.error' | i18next}}
-
ok
-
error
+
{{'settings_server.ok' | i18next}}
+
{{'settings_server.error' | i18next}}
-

If a Plex server configuration has problems with the UI route, the channel editor won't be able to access its content.

+

{{'settings_server.ui_bad' | i18next}}

-

If a Plex server configuration has problems with the backend route, dizqueTV won't be able to play its content.

+

{{'settings_server.server_bad' | i18next}}


-
Plex Transcoder Settings +
{{'settings_server.plex_transcoder_settings' | i18next}}

@@ -79,10 +79,10 @@
- +
- +
@@ -90,110 +90,110 @@
- - Note: This affects the "on deck" for your plex account. + + {{'settings_server.send_status_plex_note' | i18next}}
-

If stream changes video codec, audio codec, or audio channels upon episode change, you will experience playback issues unless ffmpeg transcoding and normalization are also enabled.

+

{{'settings_server.no_plex_path' | i18next}}

-
Video Options
+
{{'settings_server.video_options' | i18next}}
- +
- +
- +
-
Audio Options
+
{{'settings_server.audio_options' | i18next}}
- + - Comma separated list. Some possible values are 'ac3,aac,mp3'. + {{'settings_server.supported_audio_formats_note' | i18next}}
- + - Note: 7.1 audio and on some clients, 6.1, is known to cause playback issues. + {{'settings_server.max_audio_channels_note' | i18next}}
- + - Note: Only applies when downmixing to stereo. + {{'settings_server.audio_boost_note' | i18next}}
-
Miscellaneous Options
+
{{'settings_server.miscellaneous_options' | i18next}}
- +
- + - Plex will decide to transcode or direct play based on these settings and if Plex transcodes, it will try to match the transcode bitrate. + {{'settings_server.max_transcode_bitrate_note' | i18next}}
- +
- +
- +
- +
-
Subtitle Options
+
{{'settings_server.subtitle_options' | i18next}}
- +
- +
-
Path Replacements
+
{{'settings_server.path_replacements' | i18next}}
- +
- +
diff --git a/web/public/templates/xmltv-settings.html b/web/public/templates/xmltv-settings.html index 2826a1b..189e862 100644 --- a/web/public/templates/xmltv-settings.html +++ b/web/public/templates/xmltv-settings.html @@ -1,35 +1,35 @@
-
XMLTV Settings +
{{'settings_xmltv.title' | i18next}}
-
Output Path
+
{{'settings_xmltv.output_path' | i18next}}
- You can edit this location in file xmltv-settings.json. + {{'settings_xmltv.output_path_note' | i18next}}

- + - How many hours of programming to include in the xmltv file. + {{'settings_xmltv.epg_hours_note' | i18next}}
- + - How often should the xmltv file be updated. + {{'settings_xmltv.refresh_timer_note' | i18next}}


- + -
If enabled the pictures used for Movie and TV Show posters will be cached in dizqueTV's .dizqueTV folder and will be delivered by dizqueTV's server instead of requiring calls to Plex. Note that using fixed xmltv location in Plex (as opposed to url) will not work correctly in this case.
+
{{'settings_xmltv.image_cache_note' | i18next}}
diff --git a/web/public/views/guide.html b/web/public/views/guide.html index deae186..4b829b1 100644 --- a/web/public/views/guide.html +++ b/web/public/views/guide.html @@ -1,7 +1,7 @@
- {{title}} + {{'guide.title' | i18next}}
@@ -29,7 +29,7 @@