fix: dropdown options and titles translations

This commit is contained in:
Botzy 2025-05-27 17:55:17 +03:00
parent 5a942c5f73
commit fe871f03f1
4 changed files with 6 additions and 6 deletions

View file

@ -9,7 +9,7 @@ const useTranslate = () => {
const string = useCallback((key) => t(key), [t]); const string = useCallback((key) => t(key), [t]);
const stringWithPrefix = useCallback((value, prefix, fallback = null) => { const stringWithPrefix = useCallback((value, prefix, fallback = null) => {
const key = `${prefix}${value}`; const key = `${prefix || ''}${value}`;
const defaultValue = fallback ?? value.charAt(0).toUpperCase() + value.slice(1); const defaultValue = fallback ?? value.charAt(0).toUpperCase() + value.slice(1);
return t(key, { return t(key, {

View file

@ -10,8 +10,8 @@ const mapSelectableInputs = (installedAddons, remoteAddons, t) => {
.concat(installedAddons.selectable.catalogs) .concat(installedAddons.selectable.catalogs)
.map(({ name, deepLinks }) => ({ .map(({ name, deepLinks }) => ({
value: deepLinks.addons, value: deepLinks.addons,
label: t.stringWithPrefix(name, 'ADDON_'), label: t.stringWithPrefix(name.toUpperCase(), 'ADDON_'),
title: t.stringWithPrefix(name, 'ADDON_'), title: t.stringWithPrefix(name.toUpperCase(), 'ADDON_'),
})), })),
selected: remoteAddons.selectable.catalogs selected: remoteAddons.selectable.catalogs
.concat(installedAddons.selectable.catalogs) .concat(installedAddons.selectable.catalogs)

View file

@ -46,7 +46,7 @@ const mapSelectableInputs = (discover, t) => {
} }
}; };
const extraSelects = discover.selectable.extra.map(({ name, isRequired, options }) => ({ const extraSelects = discover.selectable.extra.map(({ name, isRequired, options }) => ({
title: t.stringWithPrefix(name, 'SELECT_'), title: t.stringWithPrefix(name),
isRequired: isRequired, isRequired: isRequired,
options: options.map(({ value, deepLinks }) => ({ options: options.map(({ value, deepLinks }) => ({
label: typeof value === 'string' ? t.stringWithPrefix(value) : t.string('NONE'), label: typeof value === 'string' ? t.stringWithPrefix(value) : t.string('NONE'),
@ -62,7 +62,7 @@ const mapSelectableInputs = (discover, t) => {
value value
})), })),
renderLabelText: options.some(({ selected, value }) => selected && value === null) ? renderLabelText: options.some(({ selected, value }) => selected && value === null) ?
() => t.stringWithPrefix(name, 'SELECT_') () => t.stringWithPrefix(name.toUpperCase(), 'SELECT_')
: :
null, null,
onSelect: (event) => { onSelect: (event) => {

View file

@ -140,7 +140,7 @@ const useStreamingServerSettingsInputs = (streamingServer) => {
return { return {
options: Object.keys(TORRENT_PROFILES) options: Object.keys(TORRENT_PROFILES)
.map((profileName) => ({ .map((profileName) => ({
label: profileName, label: t('TORRENT_PROFILE_' + profileName.replace(' ', '_').toUpperCase()),
value: JSON.stringify(TORRENT_PROFILES[profileName]) value: JSON.stringify(TORRENT_PROFILES[profileName])
})) }))
.concat( .concat(