1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #6276 from thornbill/plugin-categories

Update plugin category labels
This commit is contained in:
Bill Thornton 2024-11-01 14:19:05 -04:00 committed by GitHub
commit 9ff9f05a26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 19 deletions

View file

@ -0,0 +1,15 @@
/** A mapping of category names used by the plugin repository to translation keys. */
export const CATEGORY_LABELS = {
Administration: 'HeaderAdmin',
Anime: 'Anime',
Authentication: 'LabelAuthProvider', // Legacy
Books: 'Books',
Channel: 'Channels', // Unused?
General: 'General',
LiveTV: 'LiveTV',
Metadata: 'LabelMetadata', // Legacy
MoviesAndShows: 'MoviesAndShows',
Music: 'TabMusic',
Subtitles: 'Subtitles',
Other: 'Other'
};

View file

@ -1,12 +1,14 @@
import escapeHTML from 'escape-html'; import escapeHTML from 'escape-html';
import loading from '../../../../components/loading/loading'; import { CATEGORY_LABELS } from 'apps/dashboard/features/plugins/constants/categoryLabels';
import globalize from '../../../../lib/globalize'; import { getDefaultBackgroundClass } from 'components/cardbuilder/cardBuilderUtils';
import '../../../../components/cardbuilder/card.scss'; import loading from 'components/loading/loading';
import '../../../../elements/emby-button/emby-button'; import globalize from 'lib/globalize';
import '../../../../elements/emby-checkbox/emby-checkbox';
import '../../../../elements/emby-select/emby-select'; import 'components/cardbuilder/card.scss';
import { getDefaultBackgroundClass } from '../../../../components/cardbuilder/cardBuilderUtils'; import 'elements/emby-button/emby-button';
import 'elements/emby-checkbox/emby-checkbox';
import 'elements/emby-select/emby-select';
function reloadList(page) { function reloadList(page) {
loading.show(); loading.show();
@ -23,19 +25,14 @@ function reloadList(page) {
} }
function getHeaderText(category) { function getHeaderText(category) {
category = category.replace(' ', ''); const categoryKey = category.replaceAll(' ', '');
// TODO: Replace with switch
if (category === 'Channel') { if (CATEGORY_LABELS[categoryKey]) {
category = 'Channels'; return globalize.translate(CATEGORY_LABELS[categoryKey]);
} else if (category === 'Theme') {
category = 'Themes';
} else if (category === 'LiveTV') {
category = 'LiveTV';
} else if (category === 'ScreenSaver') {
category = 'HeaderScreenSavers';
} }
return globalize.translate(category); console.warn('[AvailablePlugins] unmapped category label', category);
return category;
} }
function populateList(options) { function populateList(options) {
@ -43,7 +40,7 @@ function populateList(options) {
const installedPlugins = options.installedPlugins; const installedPlugins = options.installedPlugins;
availablePlugins.forEach(function (plugin, index, array) { availablePlugins.forEach(function (plugin, index, array) {
plugin.category = plugin.category || 'General'; plugin.category = plugin.category || 'Other';
plugin.categoryDisplayName = getHeaderText(plugin.category); plugin.categoryDisplayName = getHeaderText(plugin.category);
array[index] = plugin; array[index] = plugin;
}); });

View file

@ -54,6 +54,7 @@
"AlwaysRemuxFlacAudioFilesHelp": "If you have files that your browser rejects to play or where it inaccurately calculates timestamps, enable this as a workaround.", "AlwaysRemuxFlacAudioFilesHelp": "If you have files that your browser rejects to play or where it inaccurately calculates timestamps, enable this as a workaround.",
"AlwaysRemuxMp3AudioFilesHelp": "If you have files that your browser inaccurately calculates timestamps, enable this as a workaround.", "AlwaysRemuxMp3AudioFilesHelp": "If you have files that your browser inaccurately calculates timestamps, enable this as a workaround.",
"AndOtherArtists": "{0} and {1} other artists.", "AndOtherArtists": "{0} and {1} other artists.",
"Anime": "Anime",
"AnyLanguage": "Any Language", "AnyLanguage": "Any Language",
"Anytime": "Anytime", "Anytime": "Anytime",
"ApiKeysCaption": "List of the currently enabled API keys", "ApiKeysCaption": "List of the currently enabled API keys",
@ -1181,6 +1182,7 @@
"Movie": "Movie", "Movie": "Movie",
"MovieLibraryHelp": "Review the {0}movie naming guide{1}.", "MovieLibraryHelp": "Review the {0}movie naming guide{1}.",
"Movies": "Movies", "Movies": "Movies",
"MoviesAndShows": "Movies and Shows",
"MusicAlbum": "Music Album", "MusicAlbum": "Music Album",
"MusicArtist": "Music Artist", "MusicArtist": "Music Artist",
"MusicLibraryHelp": "Review the {0}music naming guide{1}.", "MusicLibraryHelp": "Review the {0}music naming guide{1}.",