diff --git a/src/gui/src/UI/UIWindowRequestPermission.js b/src/gui/src/UI/UIWindowRequestPermission.js
index 254e6bf4e..64411818a 100644
--- a/src/gui/src/UI/UIWindowRequestPermission.js
+++ b/src/gui/src/UI/UIWindowRequestPermission.js
@@ -170,19 +170,26 @@ async function get_permission_description (permission) {
} else {
fsentry = await puter.fs.stat({ uid: resource_id, consistency: 'eventual' });
}
- fs_description_html = `use ${html_encode(fsentry.name)} located at ${html_encode(fsentry.dirpath)} with ${html_encode(action)} access.`;
+ fs_description_html = i18n('perm_fs_file_access', {
+ name: fsentry.name,
+ path: fsentry.dirpath,
+ access: action,
+ });
} catch (e) {
// Can't stat, use resource_id directly
- fs_description_html = `access ${html_encode(resource_id)} with ${html_encode(action)} access.`;
+ fs_description_html = i18n('perm_fs_resource_access', {
+ resource_id: resource_id,
+ access: action,
+ });
}
}
}
const permission_mappings = {
'fs': fs_description_html,
- 'thread': action === 'post' ? `post to thread ${html_encode(resource_id)}.` : null,
- 'service': action === 'ii' ? `use ${html_encode(resource_id)} to invoke ${html_encode(interface_name)}.` : null,
- 'driver': `use ${html_encode(resource_id)} to ${html_encode(action)}.`,
+ 'thread': action === 'post' ? i18n('perm_thread_post', { thread: resource_id }) : null,
+ 'service': action === 'ii' ? i18n('perm_service_invoke', { service: resource_id, interface: interface_name }) : null,
+ 'driver': i18n('perm_driver_use', { driver: resource_id, action: action }),
};
return permission_mappings[resource_type];
@@ -194,7 +201,7 @@ async function get_permission_description (permission) {
if ( whoami.uuid !== parts[1] ) return null;
if ( parts[2] === 'email' && parts[3] === 'read' ) {
- return 'see your email address';
+ return i18n('perm_email_read');
}
}
@@ -212,12 +219,12 @@ async function get_standard_folder_description (resource_id, action) {
const whoami = await puter.auth.whoami();
const directories = whoami.directories || {};
- // Standard folder names we recognize
- const folder_descriptions = {
- 'Desktop': 'your Desktop folder',
- 'Documents': 'your Documents folder',
- 'Pictures': 'your Pictures folder',
- 'Videos': 'your Videos folder',
+ // Standard folder names we recognize - maps to i18n keys
+ const folder_i18n_keys = {
+ 'Desktop': 'perm_folder_desktop',
+ 'Documents': 'perm_folder_documents',
+ 'Pictures': 'perm_folder_pictures',
+ 'Videos': 'perm_folder_videos',
};
// Check if resource_id matches any of the user's standard directories
@@ -231,10 +238,14 @@ async function get_standard_folder_description (resource_id, action) {
if ( path_parts.length !== 2 ) continue;
const folder_name = path_parts[1];
- const folder_desc = folder_descriptions[folder_name];
- if ( ! folder_desc ) continue;
+ const folder_i18n_key = folder_i18n_keys[folder_name];
+ if ( ! folder_i18n_key ) continue;
- return `${html_encode(action)} ${folder_desc}.`;
+ const folder_desc = i18n(folder_i18n_key);
+ return i18n('perm_folder_access', {
+ access: `${html_encode(action)}`,
+ folder: folder_desc,
+ }, false);
}
return null;
diff --git a/src/gui/src/i18n/translations/en.js b/src/gui/src/i18n/translations/en.js
index 643f9a821..f39d80fb7 100644
--- a/src/gui/src/i18n/translations/en.js
+++ b/src/gui/src/i18n/translations/en.js
@@ -514,6 +514,19 @@ const en = {
'set_as_background': 'Set as Desktop Background',
+ // Permission Descriptions
+ 'perm_fs_file_access': 'use {{name}} located at {{path}} with {{access}} access.',
+ 'perm_fs_resource_access': 'access {{resource_id}} with {{access}} access.',
+ 'perm_folder_access': '{{access}} {{folder}}.',
+ 'perm_thread_post': 'post to thread {{thread}}.',
+ 'perm_service_invoke': 'use {{service}} to invoke {{interface}}.',
+ 'perm_driver_use': 'use {{driver}} to {{action}}.',
+ 'perm_email_read': 'see your email address',
+ 'perm_folder_desktop': 'your Desktop folder',
+ 'perm_folder_documents': 'your Documents folder',
+ 'perm_folder_pictures': 'your Pictures folder',
+ 'perm_folder_videos': 'your Videos folder',
+
'error_user_or_path_not_found': 'User or path not found.',
'error_invalid_username': 'Invalid username.',
},