feat: Added detailed message for permission error and clean up english language from unused strings.

This commit is contained in:
Marco Rodolfi
2023-06-26 08:53:41 +02:00
parent ef9afa8cbc
commit 3e64e53cd7
5 changed files with 17 additions and 13 deletions
+6 -11
View File
@@ -20,6 +20,7 @@
"FilePickerError": { "FilePickerError": {
"errors": { "errors": {
"file_not_found": "The path specified is not valid. Please check it and reenter it correctly.", "file_not_found": "The path specified is not valid. Please check it and reenter it correctly.",
"perm_denied": "You do not have access to the specified directory. Please check if your user (deck on Steam Deck) has the corresponding permission to access the specified folder/file.",
"unknown": "An unknown error occurred. The raw error is: {{raw_error}}" "unknown": "An unknown error occurred. The raw error is: {{raw_error}}"
} }
}, },
@@ -159,10 +160,6 @@
"label_url": "Install Plugin from URL", "label_url": "Install Plugin from URL",
"label_zip": "Install Plugin from ZIP File" "label_zip": "Install Plugin from ZIP File"
}, },
"toast_zip": {
"body": "Installation failed! Only ZIP files are supported.",
"title": "Decky"
},
"valve_internal": { "valve_internal": {
"desc1": "Enables the Valve internal developer menu.", "desc1": "Enables the Valve internal developer menu.",
"desc2": "Do not touch anything in this menu unless you know what it does.", "desc2": "Do not touch anything in this menu unless you know what it does.",
@@ -178,25 +175,23 @@
"header": "Beta participation" "header": "Beta participation"
}, },
"developer_mode": { "developer_mode": {
"desc": "Enables Decky's developer settings.",
"label": "Developer mode" "label": "Developer mode"
}, },
"notifications": {
"decky_updates_label": "Decky update available",
"header": "Notifications",
"plugin_updates_label": "Plugin updates available"
},
"other": { "other": {
"header": "Other" "header": "Other"
}, },
"updates": { "updates": {
"header": "Updates" "header": "Updates"
},
"notifications": {
"header": "Notifications",
"decky_updates_label": "Decky update available",
"plugin_updates_label": "Plugin updates available"
} }
}, },
"SettingsIndex": { "SettingsIndex": {
"developer_title": "Developer", "developer_title": "Developer",
"general_title": "General", "general_title": "General",
"navbar_settings": "Decky Settings",
"plugins_title": "Plugins" "plugins_title": "Plugins"
}, },
"Store": { "Store": {
+1
View File
@@ -20,6 +20,7 @@
"FilePickerError": { "FilePickerError": {
"errors": { "errors": {
"file_not_found": "Il percorso specificato non è valido. Controllalo e prova a reinserirlo di nuovo.", "file_not_found": "Il percorso specificato non è valido. Controllalo e prova a reinserirlo di nuovo.",
"perm_denied": "Il tuo utente (deck su Steam Deck) non ha accesso al percorso specificato. Controlla che abbia i permessi corrispondenti per accedere alla cartella/file desiderato.",
"unknown": "È avvenuto un'errore sconosciuto. L'errore segnalato è {{raw_error}}" "unknown": "È avvenuto un'errore sconosciuto. L'errore segnalato è {{raw_error}}"
} }
}, },
+1 -1
View File
@@ -36,7 +36,7 @@ export default {
lineEnding: 'auto', lineEnding: 'auto',
// Control the line ending. See options at https://github.com/ryanve/eol // Control the line ending. See options at https://github.com/ryanve/eol
locales: ['en-US', 'it-IT'], locales: ['en-US'],
// An array of the locales in your applications // An array of the locales in your applications
namespaceSeparator: false, namespaceSeparator: false,
@@ -1,10 +1,11 @@
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { IconContext } from 'react-icons'; import { IconContext } from 'react-icons';
import { FaExclamationTriangle, FaQuestionCircle } from 'react-icons/fa'; import { FaExclamationTriangle, FaQuestionCircle, FaUserSlash } from 'react-icons/fa';
export enum FileErrorTypes { export enum FileErrorTypes {
FileNotFound, FileNotFound,
PermissionDenied,
Unknown, Unknown,
None, None,
} }
@@ -25,6 +26,10 @@ const FilePickerError: FC<FilePickerErrorProps> = ({ error, rawError = null }) =
setText(t('FilePickerError.errors.file_not_found')); setText(t('FilePickerError.errors.file_not_found'));
setIcon(<FaExclamationTriangle />); setIcon(<FaExclamationTriangle />);
break; break;
case FileErrorTypes.PermissionDenied:
setText(t('FilePickerError.errors.perm_denied'));
setIcon(<FaUserSlash />);
break;
case FileErrorTypes.Unknown: case FileErrorTypes.Unknown:
setText(t('FilePickerError.errors.unknown', { raw_error: rawError })); setText(t('FilePickerError.errors.unknown', { raw_error: rawError }));
setIcon(<FaQuestionCircle />); setIcon(<FaQuestionCircle />);
@@ -210,6 +210,9 @@ const FilePicker: FunctionComponent<FilePickerProps> = ({
case theError.match(/\[WinError\s3.*/i)?.input: case theError.match(/\[WinError\s3.*/i)?.input:
setError(FileErrorTypes.FileNotFound); setError(FileErrorTypes.FileNotFound);
break; break;
case theError.match(/\[Errno\s13.*/i)?.input:
setError(FileErrorTypes.PermissionDenied);
break;
default: default:
setRawError(theError); setRawError(theError);
setError(FileErrorTypes.Unknown); setError(FileErrorTypes.Unknown);